Class: LessCurse::Widgets::TextView

Inherits:
Base
  • Object
show all
Defined in:
lib/less_curse/widgets/text_view.rb

Instance Attribute Summary

Attributes inherited from Base

#actions, #data, #focus, #title

Instance Method Summary collapse

Methods inherited from Base

#focused?, #handle_input, #initialize, #set_default_actions, #unfocus

Constructor Details

This class inherits a constructor from LessCurse::Widgets::Base

Instance Method Details

#draw(window) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/less_curse/widgets/text_view.rb', line 4

def draw window
  LessCurse::Renderer::bold_if(focused?, window) do
    LessCurse::Renderer::box_with_title window, @title
  end
  FFI::NCurses.wmove window, 1, 1
  @data.to_s.split("\n").each_with_index do |line, idx|
    FFI::NCurses.mvwaddstr window, idx + 1, 1, line
  end
end