Class: Redwood::FileBrowserMode

Inherits:
LineCursorMode show all
Defined in:
lib/sup/modes/file_browser_mode.rb

Overview

meant to be spawned via spawn_modal!

Constant Summary collapse

RESERVED_ROWS =
1

Instance Attribute Summary collapse

Attributes inherited from LineCursorMode

#curpos

Attributes inherited from ScrollMode

#botline, #leftcol, #status, #topline

Attributes inherited from Mode

#buffer

Instance Method Summary collapse

Methods inherited from LineCursorMode

#cleanup, #draw

Methods inherited from ScrollMode

#at_bottom?, #at_top?, #cancel_search!, #col_jump, #col_left, #col_right, #continue_search_in_buffer, #draw, #ensure_mode_validity, #half_page_down, #half_page_up, #in_search?, #jump_to_col, #jump_to_end, #jump_to_left, #jump_to_line, #jump_to_start, #line_down, #line_up, #page_down, #page_up, #resize, #rightcol, #search_goto_line, #search_goto_pos, #search_in_buffer, #search_start_line

Methods inherited from Mode

#blur, #cancel_search!, #cleanup, #draw, #focus, #handle_input, #help_text, #in_search?, keymap, keymaps, #killable?, load_all_modes, make_name, #name, #pipe_to_process, register_keymap, #resize, #resolve_input, #save_to_file, #status, #unsaved?

Constructor Details

#initialize(dir = ".") ⇒ FileBrowserMode

Returns a new instance of FileBrowserMode.



19
20
21
22
23
24
25
# File 'lib/sup/modes/file_browser_mode.rb', line 19

def initialize dir="."
  @dirs = [Pathname.new(dir).realpath]
  @done = false
  @value = nil
  regen_text
  super :skip_top_rows => RESERVED_ROWS
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17
18
19
# File 'lib/sup/modes/file_browser_mode.rb', line 17

def value
  @value
end

Instance Method Details

#[](i) ⇒ Object



29
# File 'lib/sup/modes/file_browser_mode.rb', line 29

def [] i; @text[i]; end

#cwdObject



27
# File 'lib/sup/modes/file_browser_mode.rb', line 27

def cwd; @dirs.last end

#linesObject



28
# File 'lib/sup/modes/file_browser_mode.rb', line 28

def lines; @text.length; end