unstash a stashed file

akkartik
Mar 17, 2024, 10:24 PM
BWZW73XTQVQAMNAPK7MLQGANDOTWQ6RY5NEN7QUYK6KXNQC4CFJAC

Dependencies

  • [2] YRN76EXV load stashed files
  • [3] 5MEJ7XNH lay out buttons based on device dimensions
  • [4] GYFNSF33 new menu option: revert local changes
  • [5] RLXBO23F swap copy and paste menu buttons
  • [6] NM2SILGF start implementing stashed files
  • [7] JIERZ45W resolve conflicts
  • [*] R5QXEHUI somebody stop me
  • [*] 5RUFNRJO start of the visual skeleton

Change contents

  • file addition: 0195-can_be_unstashed (----------)
    [9.2]
    can_be_unstashed = function(pane)
    if not pane.is_stash then return end
    assert(pane.filename)
    local filename = unstash_filename(pane.filename)
    return not nativefs.getInfo(App.save_dir..Directory..filename)
    end
  • file addition: 0194-unstash_filename (----------)
    [9.2]
    unstash_filename = function(filename)
    return filename:gsub('%..*', '')
    end
  • file addition: 0193-unstash_pane (----------)
    [9.2]
    unstash_pane = function(pane)
    local src = Stash_directory..pane.filename
    local contents, error = love.filesystem.read(src)
    if not contents then return print_to_output(error) end
    love.filesystem.createDirectory(Directory)
    local filename = unstash_filename(pane.filename)
    local dest = Directory..filename
    local success, error = love.filesystem.write(dest, contents)
    if not success then return print_to_output(error) end
    pane.filename = filename
    pane.is_stash = nil
    end
  • file addition: 0192-press_unstash_button (----------)
    [9.2]
    press_unstash_button = function()
    -- disable local modifications to a file without deleting it or saving the pane
    Show_menu = nil
    unstash_pane(Current_pane)
    end
  • file addition: 0191-unstash_button (----------)
    [9.2]
    unstash_button = function(x,y, r)
    return overflowable_button('unstash', x, y, r, press_unstash_button)
    end
  • replacement in 0021-draw_menu at line 18
    [3.29][3.668:750](),[3.750][2.1448:1484]()
    if Current_pane.filename and has_local_modifications(Current_pane.filename) then
    if not Current_pane.is_stash then
    [3.29]
    [3.2856]
    if Current_pane.filename then
    if has_local_modifications(Current_pane.filename) then
  • edit in 0021-draw_menu at line 21
    [3.2888]
    [3.2888]
    x, y = revert_button(x, y, r)
    elseif can_be_unstashed(Current_pane) then
    x, y = unstash_button(x, y, r)
  • edit in 0021-draw_menu at line 25
    [3.2894][3.750:782](),[3.750][3.750:782]()
    x, y = revert_button(x, y, r)