Sha256: ed65bea2ff8707f4ccef722f602bee68b4091fe7a3b6591cca91f2c028c4d7b5

Contents?: true

Size: 976 Bytes

Versions: 5

Compression:

Stored size: 976 Bytes

Contents

require 'curses'

module GitCrecord
  module UI
    module HelpWindow
      CONTENT = <<EOS.freeze
  q      - quit
  s      - stage selection and quit
  c      - commit selection and quit
  j / ↓  - down
  k / ↑  - up
  h / ←  - collapse hunk
  l / →  - expand
  f      - toggle fold
  g      - go to first line
  G      - go to last line
  C-P    - up to previous hunk / file
  C-N    - down to previous hunk / file
  SPACE  - toggle selection
  A      - toggle all selections
  ?      - display help
  R      - force redraw
EOS

      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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-crecord-1.0.4 lib/git_crecord/ui/help_window.rb
git-crecord-1.0.3 lib/git_crecord/ui/help_window.rb
git-crecord-1.0.2 lib/git_crecord/ui/help_window.rb
git-crecord-1.0.1 lib/git_crecord/ui/help_window.rb
git-crecord-1.0.0 lib/git_crecord/ui/help_window.rb