Class: Redwood::EditMessageAsyncMode
Instance Attribute Summary
#curpos
Attributes inherited from ScrollMode
#botline, #leftcol, #status, #topline
Attributes inherited from Mode
#buffer
Instance Method Summary
collapse
#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, 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# 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'.",]
run_async_hook()
super()
end
|
Instance Method Details
43
44
45
|
# File 'lib/sup/modes/edit_message_async_mode.rb', line 43
def [] i
@text[i]
end
|
#killable? ⇒ Boolean
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/sup/modes/edit_message_async_mode.rb', line 47
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.edit_message_async_resume true
true
end
|
41
|
# File 'lib/sup/modes/edit_message_async_mode.rb', line 41
def lines; @text.length end
|
#unsaved? ⇒ Boolean
58
59
60
|
# File 'lib/sup/modes/edit_message_async_mode.rb', line 58
def unsaved?
!file_being_edited? && !file_has_been_edited?
end
|