Class: Amun::Windows::ModeLine
- Defined in:
- lib/amun/windows/mode_line.rb
Overview
a line of small segments that display information about the current window, like mode name, line number, buffer name…etc
Instance Attribute Summary collapse
-
#left_segments ⇒ Object
readonly
Returns the value of attribute left_segments.
-
#right_segments ⇒ Object
readonly
Returns the value of attribute right_segments.
Attributes inherited from Base
Attributes inherited from Object
Instance Method Summary collapse
-
#initialize(size) ⇒ ModeLine
constructor
A new instance of ModeLine.
- #render(buffer) ⇒ Object
Constructor Details
#initialize(size) ⇒ ModeLine
Returns a new instance of ModeLine.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/amun/windows/mode_line.rb', line 14 def initialize(size) super(size) @right_segments = [] @left_segments = [ ModeLineSegments::BufferName.new, ModeLineSegments::MajorMode.new ] Helpers::Colors.register_default(:mode_line, 0, 255) end |
Instance Attribute Details
#left_segments ⇒ Object (readonly)
Returns the value of attribute left_segments.
12 13 14 |
# File 'lib/amun/windows/mode_line.rb', line 12 def left_segments @left_segments end |
#right_segments ⇒ Object (readonly)
Returns the value of attribute right_segments.
12 13 14 |
# File 'lib/amun/windows/mode_line.rb', line 12 def right_segments @right_segments end |
Instance Method Details
#render(buffer) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/amun/windows/mode_line.rb', line 25 def render(buffer) right_output = render_segments(right_segments, buffer) left_output = render_segments(left_segments, buffer) filler = empty_space(right_output, left_output) curses_window.erase Helpers::Colors.print(curses_window, *left_output, filler, *right_output) curses_window.refresh end |