load stashed files

akkartik
Mar 17, 2024, 9:41 PM
YRN76EXV3KEOH3TD23RSL56RB2UJPBB7OC7PT64GSVWVTJUOJGFQC

Dependencies

  • [2] JGGV3SU7 bugfix: loading a file with text selected
  • [3] NM2SILGF start implementing stashed files
  • [4] GYFNSF33 new menu option: revert local changes
  • [5] FIUQJVL2 first draft of load/save buttons
  • [6] RLXBO23F swap copy and paste menu buttons
  • [7] YR7AXEYB add keyboard shortcuts for common operations
  • [8] PO77NPCO indicate unsaved changes
  • [9] JOY24JW6 indicate local modifications in load/save dialog
  • [10] 2IJLEJGT indicate local modifications in editor title bar
  • [*] R5QXEHUI somebody stop me
  • [*] 5RUFNRJO start 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) do
    if filename:find(File_dialog_input_text) then
    local w = Font:getWidth(filename) + 10
    if x ~= Menu_left+10 and x+w > Safe_width-Menu_left-10 then
    x = Menu_left+10
    y = y+Line_height+10
    if y > Safe_height-Menu_bottom-10 then
    break
    end
    end
    styled_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+10
    end
    end
    return y
    end
  • replacement in 0188-add_files_to_dialog at line 1
    [3.49][3.50:144]()
    add_files_to_dialog = function(contents, x,y, colorfn)
    for _,filename in ipairs(contents) do
    [3.49]
    [3.144]
    add_files_to_dialog = function(x,y)
    for _,filename in ipairs(Directory_contents) do
  • edit in 0188-add_files_to_dialog at line 13
    [3.455][3.455:535]()
    -- TODO: File_dialog_callback needs to somehow know to load stashed files.
  • replacement in 0188-add_files_to_dialog at line 17
    [3.639][3.639:662]()
    colorfn(filename))
    [3.639]
    [3.662]
    local_modifications_color(filename))
  • replacement in 0185-stash_pane at line 10
    [3.1730][3.1730:1752]()
    pane.stash_note = ''
    [3.1730]
    [3.1752]
    pane.is_stash = true
  • replacement in 0166-press_load_button at line 4
    [4.583][4.583:626]()
    File_dialog_callback = function(filename)
    [4.583]
    [4.626]
    File_dialog_callback = function(filename, is_stash)
  • edit in 0166-press_load_button at line 11
    [4.754]
    [4.754]
    Current_pane.is_stash = is_stash
  • edit in 0165-press_save_button at line 8
    [4.1243]
    [4.1243]
    assert(not Current_pane.is_stash)
  • replacement in 0127-one_time_load at line 2
    [4.71][4.71:113]()
    print('loading '..Current_pane.filename)
    [4.71]
    [2.46]
    if Current_pane.is_stash then
    print('loading '..Current_pane.filename..' from stash')
    else
    print('loading '..Current_pane.filename)
    end
  • replacement in 0127-one_time_load at line 8
    [2.85][4.113:184](),[4.113][4.113:184]()
    Current_pane.editor_state.filename = Directory..Current_pane.filename
    [2.85]
    [4.184]
    local dir = Current_pane.is_stash and Stash_directory or Directory
    Current_pane.editor_state.filename = dir..Current_pane.filename
  • edit in 0127-one_time_load at line 15
    [3.2199][3.2199:2230]()
    Current_pane.stash_note = nil
  • replacement in 0126-one_time_save at line 3
    [4.495][4.495:566]()
    Current_pane.editor_state.filename = Directory..Current_pane.filename
    [4.495]
    [4.566]
    local dir = Current_pane.is_stash and Stash_directory or Directory
    Current_pane.editor_state.filename = dir..Current_pane.filename
  • replacement in 0119-draw_file_dialog at line 34
    [4.1906][3.2328:2436]()
    local y = add_files_to_dialog(Directory_contents, Menu_left+10, Menu_bottom+10, local_modifications_color)
    [4.1906]
    [3.2436]
    local y = add_files_to_dialog(Menu_left+10, Menu_bottom+10)
  • replacement in 0119-draw_file_dialog at line 43
    [3.2704][3.2704:2817]()
    y = add_files_to_dialog(Stash_directory_contents, Menu_left+10, y,
    function(filename) return Stash_color end)
    [3.2704]
    [4.624]
    y = add_stash_files_to_dialog(Menu_left+10, y)
  • replacement in 0021-draw_menu at line 19
    [4.750][3.2818:2856]()
    if not Current_pane.stash_note then
    [4.750]
    [3.2856]
    if not Current_pane.is_stash then
  • replacement in 0020-draw_editor_border at line 21
    [4.322][3.2899:2933]()
    if Current_pane.stash_note then
    [4.322]
    [3.2933]
    if Current_pane.is_stash then