Module: GitCrecord::UI::HelpWindow

Defined in:
lib/git_crecord/ui/help_window.rb

Constant Summary collapse

CONTENT =
"  q      - quit\n  s      - stage selection and quit\n  c      - commit selection and quit\n  j / \u2193  - down\n  k / \u2191  - up\n  h / \u2190  - collapse fold\n  l / \u2192  - expand fold\n  f      - toggle fold\n  g      - go to first line\n  G      - go to last line\n  C-P    - up to previous hunk / file\n  C-N    - down to next hunk / file\n  SPACE  - toggle selection\n  A      - toggle all selections\n  ?      - display help\n  R      - force redraw\n"

Class Method Summary collapse

Class Method Details

.heightObject



42
43
44
# File 'lib/git_crecord/ui/help_window.rb', line 42

def self.height
  CONTENT.lines.size + 2
end

.showObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/git_crecord/ui/help_window.rb', line 27

def self.show
  win = Curses::Window.new(height, width, 0, 0)
  win.box('|', '-')
  CONTENT.split("\n").each_with_index do |line, index|
    win.setpos(index + 1, 1)
    win.addstr(line)
  end
  win.getch
  win.close
end

.widthObject



38
39
40
# File 'lib/git_crecord/ui/help_window.rb', line 38

def self.width
  CONTENT.lines.map(&:size).max + 3
end