Sha256: 374cd1fb42917b884bdeb9d6b7fa743d4c1952b782d2d3090749b54f30e9684b
Contents?: true
Size: 907 Bytes
Versions: 1
Compression:
Stored size: 907 Bytes
Contents
module TermNote class Show attr_accessor :panes def initialize @panes = [] end def add(pane) raise ArgumentError, "Pane required" if pane.nil? panes << pane pane.show = self end def pane @pane || panes.first end def position panes.index pane end def total panes.size end def start active = true while active pane.call $stdout.winsize case command when "j" then forward when "k" then backward when "q" then active = false end end end def forward @pane = panes[position + 1] || panes.first end def backward @pane = panes[position - 1] || panes.last end def header "[#{position}/#{total}] - #{panes.first.title}\n".bold end private def command $stdin.getch end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
termnote-1.1.0 | lib/termnote/show.rb |