Class: GitSpelunk::UI::RepoWindow

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(height) ⇒ RepoWindow

Returns a new instance of RepoWindow.



6
7
8
9
# File 'lib/git_spelunk/ui/repo.rb', line 6

def initialize(height)
  @height = height
  self.content = ""
end

Instance Attribute Details

#command_bufferObject

Returns the value of attribute command_buffer.



4
5
6
# File 'lib/git_spelunk/ui/repo.rb', line 4

def command_buffer
  @command_buffer
end

#command_modeObject

Returns the value of attribute command_mode.



4
5
6
# File 'lib/git_spelunk/ui/repo.rb', line 4

def command_mode
  @command_mode
end

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/git_spelunk/ui/repo.rb', line 4

def content
  @content
end

Instance Method Details

#drawObject



11
12
13
14
15
16
17
# File 'lib/git_spelunk/ui/repo.rb', line 11

def draw
  styles = Dispel::StyleMap.new(@height)
  styles.add(:reverse, 0, 0..999)
  view = [status_line] + content.split("\n")
  view = Array.new(@height).each_with_index.map {|_,i| view[i] }
  [view, styles]
end