Class/Module Index [+]

Quicksearch

Redwood::BufferListMode

Public Class Methods

new() click to toggle source
# File lib/sup/modes/buffer-list-mode.rb, line 10
def initialize
  regen_text
  super
end

Public Instance Methods

[](i;) click to toggle source
# File lib/sup/modes/buffer-list-mode.rb, line 16
def [] i; @text[i] end
focus() click to toggle source
# File lib/sup/modes/buffer-list-mode.rb, line 18
def focus
  reload # buffers may have been killed or created since last view
  set_cursor_pos 0
end
lines() click to toggle source
# File lib/sup/modes/buffer-list-mode.rb, line 15
def lines; @text.length end

Protected Instance Methods

jump_to_buffer() click to toggle source
# File lib/sup/modes/buffer-list-mode.rb, line 41
def jump_to_buffer
  BufferManager.raise_to_front @bufs[curpos][1]
end
kill_selected_buffer() click to toggle source
# File lib/sup/modes/buffer-list-mode.rb, line 45
def kill_selected_buffer
  reload if BufferManager.kill_buffer_safely @bufs[curpos][1]
end
regen_text() click to toggle source
# File lib/sup/modes/buffer-list-mode.rb, line 30
def regen_text
  @bufs = BufferManager.buffers.reject { |name, buf| buf.mode == self }.sort_by { |name, buf| buf.atime }.reverse
  width = @bufs.max_of { |name, buf| buf.mode.name.length }
  @text = @bufs.map do |name, buf|
    base_color = buf.system? ? :system_buf_color : :regular_buf_color
    [[base_color, sprintf("%#{width}s ", buf.mode.name)],
     [:modified_buffer_color, (buf.mode.unsaved? ? '*' : ' ')],
     [base_color, " " + name]]
  end
end
reload() click to toggle source
# File lib/sup/modes/buffer-list-mode.rb, line 25
def reload
  regen_text
  buffer.mark_dirty
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.