module GitCrecord::UI::StatusBar

Public Class Methods

branch() click to toggle source
# File lib/git_crecord/ui/status_bar.rb, line 39
def self.branch
  @branch = Git.branch
end
fill_to_eol() click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/git_crecord/ui/status_bar.rb, line 43
def self.reverse
  @reverse
end
reverse=(reverse) click to toggle source
# File lib/git_crecord/ui/status_bar.rb, line 47
def self.reverse=(reverse)
  @reverse = reverse
end
win() click to toggle source
# 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.status_bar | Curses::A_BOLD)
  end
end
write_left(_main_win) click to toggle source
# 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) click to toggle source
# 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