class Amun::Windows::TextRenderer

this class renders the buffer in a curses window makes sure the current character under point is highlighted highlight the space between point and mark and make sure to color text and other stuff consider it the rendering engine of the buffer

Public Instance Methods

render(buffer) click to toggle source
# File lib/amun/windows/text_renderer.rb, line 11
def render(buffer)
  curses_window.erase
  curses_window.scrollok(true)
  render_text(buffer)
  curses_window.refresh
end

Private Instance Methods

render_point(buffer) click to toggle source
# File lib/amun/windows/text_renderer.rb, line 27
def render_point(buffer)
  curses_window.attron(Helpers::Colors::REVERSE)
  curses_window << case buffer[buffer.point]
                   when "\n"
                     " \n"
                   when nil
                     " "
                   else
                     buffer[buffer.point]
                   end
  curses_window.attroff(Helpers::Colors::REVERSE)
end
render_text(buffer) click to toggle source
# File lib/amun/windows/text_renderer.rb, line 20
def render_text(buffer)
  point = buffer.point
  curses_window << buffer[0...point]
  render_point(buffer)
  curses_window << buffer[(point + 1)..-1]
end