Class: PWKeep::StatusBar

Inherits:
Object
  • Object
show all
Defined in:
lib/pwkeep/editor.rb

Instance Method Summary (collapse)

Constructor Details

- (StatusBar) initialize(editor, options)

A new instance of StatusBar



422
423
424
425
# File 'lib/pwkeep/editor.rb', line 422

def initialize(editor, options)
  @editor = editor
  @options = options
end

Instance Method Details

- (Object) change_indicator



444
445
446
# File 'lib/pwkeep/editor.rb', line 444

def change_indicator
  @editor.modified? ? '*' : ' '
end

- (Object) style_map



440
441
442
# File 'lib/pwkeep/editor.rb', line 440

def style_map
  Dispel::StyleMap.single_line_reversed(@options[:columns])
end

- (Object) view



427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/pwkeep/editor.rb', line 427

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
  "#{version}#{indicators}#{' ' * space_left}#{position}"[0, columns]
end

- (Object) writable_indicator



448
449
450
# File 'lib/pwkeep/editor.rb', line 448

def writable_indicator
  true
end