Class: Redwood::EditMessageAsyncMode
- Inherits:
-
LineCursorMode
- Object
- Mode
- ScrollMode
- LineCursorMode
- Redwood::EditMessageAsyncMode
- Defined in:
- lib/sup/modes/edit_message_async_mode.rb
Instance Attribute Summary
Attributes inherited from LineCursorMode
Attributes inherited from ScrollMode
#botline, #leftcol, #status, #topline
Attributes inherited from Mode
Instance Method Summary collapse
- #[](i) ⇒ Object
-
#initialize(parent_edit_mode, file_path, msg_subject) ⇒ EditMessageAsyncMode
constructor
A new instance of EditMessageAsyncMode.
- #killable? ⇒ Boolean
- #lines ⇒ Object
- #unsaved? ⇒ Boolean
Methods inherited from LineCursorMode
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, load_all_modes, make_name, #name, #pipe_to_process, register_keymap, #resize, #resolve_input, #save_to_file, #status
Constructor Details
#initialize(parent_edit_mode, file_path, msg_subject) ⇒ EditMessageAsyncMode
Returns a new instance of EditMessageAsyncMode.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sup/modes/edit_message_async_mode.rb', line 26 def initialize parent_edit_mode, file_path, msg_subject @parent_edit_mode = parent_edit_mode @file_path = file_path @orig_mtime = File.mtime @file_path @text = ["ASYNC MESSAGE EDIT", "", "Your message with subject:", msg_subject, "is saved in a file:", "", @file_path, "", "You can edit your message in the editor of your choice and continue to", "use sup while you edit your message.", "", "Press <Enter> to have the file path copied to the clipboard.", "", "When you have finished editing, select this buffer and press 'E'.",] super() end |
Instance Method Details
#[](i) ⇒ Object
42 43 44 |
# File 'lib/sup/modes/edit_message_async_mode.rb', line 42 def [] i @text[i] end |
#killable? ⇒ Boolean
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/sup/modes/edit_message_async_mode.rb', line 46 def killable? if file_being_edited? if !BufferManager.ask_yes_or_no("It appears the file is still being edited. Are you sure?") return false end end @parent_edit_mode. true true end |
#lines ⇒ Object
40 |
# File 'lib/sup/modes/edit_message_async_mode.rb', line 40 def lines; @text.length end |
#unsaved? ⇒ Boolean
57 58 59 |
# File 'lib/sup/modes/edit_message_async_mode.rb', line 57 def unsaved? !file_being_edited? && !file_has_been_edited? end |