Module: GitCrecord::UI::StatusBar
- Defined in:
- lib/git_crecord/ui/status_bar.rb
Class Method Summary collapse
- .branch ⇒ Object
- .fill_to_eol ⇒ Object
- .refresh(main_win) ⇒ Object
- .reverse ⇒ Object
- .reverse=(reverse) ⇒ Object
- .win ⇒ Object
- .write_left(_main_win) ⇒ Object
- .write_right(main_win) ⇒ Object
Class Method Details
.branch ⇒ Object
39 40 41 |
# File 'lib/git_crecord/ui/status_bar.rb', line 39 def self.branch @branch = Git.branch end |
.fill_to_eol ⇒ Object
28 29 30 31 |
# File 'lib/git_crecord/ui/status_bar.rb', line 28 def self.fill_to_eol fill_width = win.maxx - win.curx win.addstr(' ' * fill_width) if fill_width.positive? end |
.refresh(main_win) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/git_crecord/ui/status_bar.rb', line 10 def self.refresh(main_win) write_left(main_win) fill_to_eol write_right(main_win) win.refresh end |
.reverse ⇒ Object
43 44 45 |
# File 'lib/git_crecord/ui/status_bar.rb', line 43 def self.reverse @reverse end |
.reverse=(reverse) ⇒ Object
47 48 49 |
# File 'lib/git_crecord/ui/status_bar.rb', line 47 def self.reverse=(reverse) @reverse = reverse end |
.win ⇒ Object
33 34 35 36 37 |
# File 'lib/git_crecord/ui/status_bar.rb', line 33 def self.win @win ||= Curses::Window.new(1, Curses.cols, 0, 0).tap do |win| win.attrset(Color. | Curses::A_BOLD) end end |
.write_left(_main_win) ⇒ Object
17 18 19 20 |
# File 'lib/git_crecord/ui/status_bar.rb', line 17 def self.write_left(_main_win) win.setpos(0, 0) win.addstr(" #{branch}") end |
.write_right(main_win) ⇒ Object
22 23 24 25 26 |
# File 'lib/git_crecord/ui/status_bar.rb', line 22 def self.write_right(main_win) str = " #{reverse ? '[reverse]' : ''} #{main_win.highlight_position} " win.setpos(0, [0, win.maxx - str.size].max) win.addstr(str) end |