Class: Ruco::StatusBar
Instance Method Summary collapse
- #change_indicator ⇒ Object
-
#initialize(editor, options) ⇒ StatusBar
constructor
A new instance of StatusBar.
- #style_map ⇒ Object
- #view ⇒ Object
- #writable_indicator ⇒ Object
Constructor Details
#initialize(editor, options) ⇒ StatusBar
Returns a new instance of StatusBar.
3 4 5 6 |
# File 'lib/ruco/status_bar.rb', line 3 def initialize(editor, ) @editor = editor @options = end |
Instance Method Details
#change_indicator ⇒ Object
29 30 31 |
# File 'lib/ruco/status_bar.rb', line 29 def change_indicator @editor.modified? ? '*' : ' ' end |
#style_map ⇒ Object
25 26 27 |
# File 'lib/ruco/status_bar.rb', line 25 def style_map Dispel::StyleMap.single_line_reversed(@options[:columns]) end |
#view ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruco/status_bar.rb', line 8 def view columns = @options[:columns] version = "Ruco #{Ruco::VERSION} -- " position = " #{@editor.position.line + 1}:#{@editor.position.column + 1}" indicators = "#{change_indicator}#{writable_indicator}" essential = version + position + indicators space_left = [columns - essential.size, 0].max # fit file name into remaining space file = @editor.file file = file.ellipsize(:max => space_left) space_left -= file.size "#{version}#{file}#{indicators}#{' ' * space_left}#{position}"[0, columns] end |