Class: Muxr::Drawer
- Inherits:
-
Object
- Object
- Muxr::Drawer
- Defined in:
- lib/muxr/drawer.rb
Overview
A Drawer is a single persistent overlay pane, rendered on top of the tiled layout. Toggling visibility never tears down the underlying PTY — the drawer’s shell process and scrollback survive across hide/show.
The actual Pane is injected (rather than constructed here) so tests can exercise the visibility/state machine without spawning real shells.
Instance Attribute Summary collapse
-
#origin_cwd ⇒ Object
readonly
Returns the value of attribute origin_cwd.
-
#pane ⇒ Object
Returns the value of attribute pane.
-
#visible ⇒ Object
Returns the value of attribute visible.
Instance Method Summary collapse
- #close ⇒ Object
- #cwd ⇒ Object
- #hide! ⇒ Object
-
#initialize(pane: nil, origin_cwd: nil) ⇒ Drawer
constructor
A new instance of Drawer.
- #show! ⇒ Object
- #toggle! ⇒ Object
- #visible? ⇒ Boolean
Constructor Details
#initialize(pane: nil, origin_cwd: nil) ⇒ Drawer
Returns a new instance of Drawer.
12 13 14 15 16 |
# File 'lib/muxr/drawer.rb', line 12 def initialize(pane: nil, origin_cwd: nil) @pane = pane @visible = false @origin_cwd = origin_cwd end |
Instance Attribute Details
#origin_cwd ⇒ Object (readonly)
Returns the value of attribute origin_cwd.
10 11 12 |
# File 'lib/muxr/drawer.rb', line 10 def origin_cwd @origin_cwd end |
#pane ⇒ Object
Returns the value of attribute pane.
9 10 11 |
# File 'lib/muxr/drawer.rb', line 9 def pane @pane end |
#visible ⇒ Object
Returns the value of attribute visible.
9 10 11 |
# File 'lib/muxr/drawer.rb', line 9 def visible @visible end |
Instance Method Details
#close ⇒ Object
38 39 40 41 42 |
# File 'lib/muxr/drawer.rb', line 38 def close @pane&.close @pane = nil @visible = false end |
#cwd ⇒ Object
34 35 36 |
# File 'lib/muxr/drawer.rb', line 34 def cwd pane&.cwd || @origin_cwd end |
#hide! ⇒ Object
26 27 28 |
# File 'lib/muxr/drawer.rb', line 26 def hide! @visible = false end |
#show! ⇒ Object
22 23 24 |
# File 'lib/muxr/drawer.rb', line 22 def show! @visible = true end |
#toggle! ⇒ Object
30 31 32 |
# File 'lib/muxr/drawer.rb', line 30 def toggle! @visible = !@visible end |
#visible? ⇒ Boolean
18 19 20 |
# File 'lib/muxr/drawer.rb', line 18 def visible? @visible end |