load stashed files
Dependencies
- [2]
JGGV3SU7bugfix: loading a file with text selected - [3]
NM2SILGFstart implementing stashed files - [4]
GYFNSF33new menu option: revert local changes - [5]
FIUQJVL2first draft of load/save buttons - [6]
RLXBO23Fswap copy and paste menu buttons - [7]
YR7AXEYBadd keyboard shortcuts for common operations - [8]
PO77NPCOindicate unsaved changes - [9]
JOY24JW6indicate local modifications in load/save dialog - [10]
2IJLEJGTindicate local modifications in editor title bar - [*]
R5QXEHUIsomebody stop me - [*]
5RUFNRJOstart of the visual skeleton
Change contents
- file addition: 0189-add_stash_files_to_dialog[12.2]
add_stash_files_to_dialog = function(x,y)for _,filename in ipairs(Stash_directory_contents) doif filename:find(File_dialog_input_text) thenlocal w = Font:getWidth(filename) + 10if x ~= Menu_left+10 and x+w > Safe_width-Menu_left-10 thenx = Menu_left+10y = y+Line_height+10if y > Safe_height-Menu_bottom-10 thenbreakendendstyled_button(filename, x,y, function()File_dialog_callback(filename, --[[is stash?]] true)reset_file_dialog_state()end,--[[tooltip text]] nil,Stash_color)x = x+w+10endendreturn yend - replacement in 0188-add_files_to_dialog at line 1
add_files_to_dialog = function(contents, x,y, colorfn)for _,filename in ipairs(contents) doadd_files_to_dialog = function(x,y)for _,filename in ipairs(Directory_contents) do - edit in 0188-add_files_to_dialog at line 13
-- TODO: File_dialog_callback needs to somehow know to load stashed files. - replacement in 0188-add_files_to_dialog at line 17
colorfn(filename))local_modifications_color(filename)) - replacement in 0185-stash_pane at line 10
pane.stash_note = ''pane.is_stash = true - replacement in 0166-press_load_button at line 4
File_dialog_callback = function(filename)File_dialog_callback = function(filename, is_stash) - edit in 0166-press_load_button at line 11
Current_pane.is_stash = is_stash - edit in 0165-press_save_button at line 8
assert(not Current_pane.is_stash) - replacement in 0127-one_time_load at line 2
print('loading '..Current_pane.filename)if Current_pane.is_stash thenprint('loading '..Current_pane.filename..' from stash')elseprint('loading '..Current_pane.filename)end - replacement in 0127-one_time_load at line 8
Current_pane.editor_state.filename = Directory..Current_pane.filenamelocal dir = Current_pane.is_stash and Stash_directory or DirectoryCurrent_pane.editor_state.filename = dir..Current_pane.filename - edit in 0127-one_time_load at line 15
Current_pane.stash_note = nil - replacement in 0126-one_time_save at line 3
Current_pane.editor_state.filename = Directory..Current_pane.filenamelocal dir = Current_pane.is_stash and Stash_directory or DirectoryCurrent_pane.editor_state.filename = dir..Current_pane.filename - replacement in 0119-draw_file_dialog at line 34
local y = add_files_to_dialog(Directory_contents, Menu_left+10, Menu_bottom+10, local_modifications_color)local y = add_files_to_dialog(Menu_left+10, Menu_bottom+10) - replacement in 0119-draw_file_dialog at line 43
y = add_files_to_dialog(Stash_directory_contents, Menu_left+10, y,function(filename) return Stash_color end)y = add_stash_files_to_dialog(Menu_left+10, y) - replacement in 0021-draw_menu at line 19
if not Current_pane.stash_note thenif not Current_pane.is_stash then - replacement in 0020-draw_editor_border at line 21
if Current_pane.stash_note thenif Current_pane.is_stash then