Class: GitSpelunk::UI::StatusWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/git_spelunk/ui/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStatusWindow

Returns a new instance of StatusWindow.



4
5
6
7
8
# File 'lib/git_spelunk/ui/status.rb', line 4

def initialize
  @command_buffer = ""
  @status_message = ""
  @onetime_message = nil
end

Instance Attribute Details

#command_bufferObject

Returns the value of attribute command_buffer.



10
11
12
# File 'lib/git_spelunk/ui/status.rb', line 10

def command_buffer
  @command_buffer
end

#status_messageObject

Returns the value of attribute status_message.



10
11
12
# File 'lib/git_spelunk/ui/status.rb', line 10

def status_message
  @status_message
end

Instance Method Details

#clear_onetime_message!Object



12
13
14
# File 'lib/git_spelunk/ui/status.rb', line 12

def clear_onetime_message!
  @onetime_message = nil
end

#drawObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/git_spelunk/ui/status.rb', line 24

def draw
  styles = Dispel::StyleMap.new(1)

  view = if command_buffer.size > 0
    ":" + command_buffer
  else
    message = (@onetime_message || @status_message)
    styles.add(:reverse, 0, 0...999)
    message
  end

  [view, styles]
end

#exit_command_mode!Object



20
21
22
# File 'lib/git_spelunk/ui/status.rb', line 20

def exit_command_mode!
  self.command_buffer = ""
end

#set_onetime_message(message) ⇒ Object



16
17
18
# File 'lib/git_spelunk/ui/status.rb', line 16

def set_onetime_message(message)
  @onetime_message = message
end