Class: Redwood::FileBrowserMode
- Inherits:
-
LineCursorMode
- Object
- Mode
- ScrollMode
- LineCursorMode
- Redwood::FileBrowserMode
- Defined in:
- lib/sup/modes/file-browser-mode.rb
Overview
meant to be spawned via spawn_modal!
Constant Summary collapse
- RESERVED_ROWS =
1
Constants inherited from ScrollMode
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from LineCursorMode
Attributes inherited from ScrollMode
#botline, #leftcol, #status, #topline
Attributes inherited from Mode
Instance Method Summary collapse
- #[](i) ⇒ Object
- #cwd ⇒ Object
-
#initialize(dir = ".") ⇒ FileBrowserMode
constructor
A new instance of FileBrowserMode.
- #lines ⇒ Object
Methods inherited from LineCursorMode
Methods inherited from ScrollMode
#at_bottom?, #at_top?, #cancel_search!, #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
#value ⇒ Object (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 |
#cwd ⇒ Object
27 |
# File 'lib/sup/modes/file-browser-mode.rb', line 27 def cwd; @dirs.last end |
#lines ⇒ Object
28 |
# File 'lib/sup/modes/file-browser-mode.rb', line 28 def lines; @text.length; end |