module LessCurse::Renderer

Public Class Methods

bold_if(condition, window) { || ... } click to toggle source

Switch on boldness depending on condition

# File lib/less_curse/renderer.rb, line 21
def self.bold_if condition, window
  if condition
    FFI::NCurses.wattron window, FFI::NCurses::A_BOLD
  end
  yield
  if condition
    FFI::NCurses.wattroff window, FFI::NCurses::A_BOLD
  end
end
box_foot(window, text) click to toggle source

Draw into lower border of a box

# File lib/less_curse/renderer.rb, line 10
def self.box_foot window, text
  height,width = FFI::NCurses::getmaxyx(window)
  FFI::NCurses.mvwaddstr window, height - 1, 1, text
end
box_with_title(window, title) click to toggle source

Draw box and title in top border of box

# File lib/less_curse/renderer.rb, line 4
def self.box_with_title window, title
  FFI::NCurses.box window, 0, 0
  FFI::NCurses.mvwaddstr window, 0, 1, title
end
write_line(window, line_number, text) click to toggle source

Write a line in window

# File lib/less_curse/renderer.rb, line 16
def self.write_line window, line_number, text
  FFI::NCurses.mvwaddstr window, line_number + 1, 1, text
end