Class: GitSpelunk::UI::StatusWindow
- Inherits:
-
Window
- Object
- Window
- GitSpelunk::UI::StatusWindow
show all
- Defined in:
- lib/git_spelunk/ui/status.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Window
#line_remainder, #with_highlighting
Constructor Details
#initialize(height, offset) ⇒ StatusWindow
Returns a new instance of StatusWindow.
4
5
6
7
8
9
10
|
# File 'lib/git_spelunk/ui/status.rb', line 4
def initialize(height, offset)
@window = Curses::Window.new(height, Curses.cols, offset, 0)
@offset = offset
@command_buffer = ""
@status_message = ""
@onetime_message = nil
end
|
Instance Attribute Details
#command_buffer ⇒ Object
Returns the value of attribute command_buffer.
12
13
14
|
# File 'lib/git_spelunk/ui/status.rb', line 12
def command_buffer
@command_buffer
end
|
#status_message ⇒ Object
Returns the value of attribute status_message.
12
13
14
|
# File 'lib/git_spelunk/ui/status.rb', line 12
def status_message
@status_message
end
|
Instance Method Details
#clear_onetime_message! ⇒ Object
14
15
16
|
# File 'lib/git_spelunk/ui/status.rb', line 14
def clear_onetime_message!
@onetime_message = nil
end
|
#draw ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/git_spelunk/ui/status.rb', line 31
def draw
@window.setpos(0,0)
if !command_buffer.empty?
Curses.curs_set(1)
@window.addstr(":" + command_buffer)
@window.addstr(" " * line_remainder)
else
Curses.curs_set(0)
with_highlighting do
@window.addstr(@onetime_message || @status_message)
@window.addstr(" " * line_remainder + "\n")
end
end
set_cursor
@window.refresh
end
|
#exit_command_mode! ⇒ Object
23
24
25
|
# File 'lib/git_spelunk/ui/status.rb', line 23
def exit_command_mode!
self.command_buffer = ""
end
|
#set_cursor ⇒ Object
27
28
29
|
# File 'lib/git_spelunk/ui/status.rb', line 27
def set_cursor
Curses::stdscr.setpos(@offset, command_buffer.size + 1)
end
|
#set_onetime_message(message) ⇒ Object
18
19
20
21
|
# File 'lib/git_spelunk/ui/status.rb', line 18
def set_onetime_message(message)
@onetime_message = message
draw
end
|