Sha256: 3ee2c6bc7c5ffa5992ac2a7bd4db7a46ba25a67e618ae8cc2130dd306bbf4021

Contents?: true

Size: 1003 Bytes

Versions: 3

Compression:

Stored size: 1003 Bytes

Contents

# frozen_string_literal: true

require 'curses'

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

      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

3 entries across 3 versions & 1 rubygems

Version Path
git-crecord-1.2.0 lib/git_crecord/ui/help_window.rb
git-crecord-1.1.1 lib/git_crecord/ui/help_window.rb
git-crecord-1.1.0 lib/git_crecord/ui/help_window.rb