Class: Muxr::Drawer

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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_cwdObject (readonly)

Returns the value of attribute origin_cwd.



10
11
12
# File 'lib/muxr/drawer.rb', line 10

def origin_cwd
  @origin_cwd
end

#paneObject

Returns the value of attribute pane.



9
10
11
# File 'lib/muxr/drawer.rb', line 9

def pane
  @pane
end

#visibleObject

Returns the value of attribute visible.



9
10
11
# File 'lib/muxr/drawer.rb', line 9

def visible
  @visible
end

Instance Method Details

#closeObject



38
39
40
41
42
# File 'lib/muxr/drawer.rb', line 38

def close
  @pane&.close
  @pane = nil
  @visible = false
end

#cwdObject



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

Returns:

  • (Boolean)


18
19
20
# File 'lib/muxr/drawer.rb', line 18

def visible?
  @visible
end