Class: Marvi::Renderer::Curses

Inherits:
Object
  • Object
show all
Defined in:
lib/marvi/renderer/curses.rb,
lib/marvi/renderer/curses/tab.rb,
lib/marvi/renderer/curses/tab_bar.rb,
lib/marvi/renderer/curses/file_picker.rb

Defined Under Namespace

Modules: TabBar Classes: FilePicker, Tab

Constant Summary collapse

COLOR_PAIRS =
{
  cyan: 1,
  green: 2,
  yellow: 3,
  magenta: 4,
  white: 5,
  cyan_on_dark: 6,
  green_on_dark: 7,
  yellow_on_dark: 8,
  magenta_on_dark: 9,
  white_on_dark: 10
}.freeze
ITALIC_ATTR =
(::Curses::A_ITALIC) ? ::Curses::A_ITALIC : 0)
FILE_POLL_INTERVAL_MS =
500
CTRL_D =
4
CTRL_N =
14
CTRL_P =
16
CTRL_U =
21
TAB_KEY =
9
MIN_HORIZONTAL_PADDING =
2
HORIZONTAL_PADDING_DIVISOR =
12
TAB_BAR_MARGIN_ROWS =

Blank row between the tab bar and the document. Clicks landing on it are attributed to the tab directly above, giving each tab a taller effective click target than the single character cell.

1

Instance Method Summary collapse

Instance Method Details

#render(markdown, file: nil) ⇒ Object



40
41
42
# File 'lib/marvi/renderer/curses.rb', line 40

def render(markdown, file: nil)
  run([Tab.new(file: file, markdown: markdown)])
end

#render_files(files) ⇒ Object



44
45
46
# File 'lib/marvi/renderer/curses.rb', line 44

def render_files(files)
  run(files.map { |file| Tab.new(file: file) })
end