Sha256: dc55b9f7757fb6a34cb9c1eaf251dbe37394664b1a99210b9c2c98a73152129c
Contents?: true
Size: 700 Bytes
Versions: 7
Compression:
Stored size: 700 Bytes
Contents
module Redwood class BufferListMode < LineCursorMode register_keymap do |k| k.add :jump_to_buffer, "Jump to selected buffer", :enter k.add :reload, "Reload buffer list", "R" end def initialize regen_text super end def lines; @text.length; end def [] i; @text[i]; end protected def reload regen_text buffer.mark_dirty end def regen_text @bufs = BufferManager.buffers.sort_by { |name, buf| name } width = @bufs.map { |name, buf| buf.mode.name.length }.max @text = @bufs.map do |name, buf| sprintf "%#{width}s %s", buf.mode.name, name end end def jump_to_buffer BufferManager.raise_to_front @bufs[curpos][1] end end end
Version data entries
7 entries across 7 versions & 1 rubygems