new menu option: revert local changes

This commit is contained in:
Kartik K. Agaram 2024-03-17 12:12:31 -07:00
parent 9246567511
commit 8508638582
3 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,9 @@ draw_menu = function()
x, y = load_button(x, y, r)
x, y = paste_button(x, y, r)
x, y = copy_button(x, y, r)
if Current_pane.filename and has_local_modifications(Current_pane.filename) then
x, y = revert_button(x, y, r)
end
x, y = new_pane_button(x, y, r)
x, y = delete_pane_button(x, y, r)
-- nav buttons along sides

3
0178-revert_button Normal file
View File

@ -0,0 +1,3 @@
revert_button = function(x,y, r)
return overflowable_button('revert', x, y, r, press_revert_button, --[[final button?]] false)
end

6
0179-press_revert_button Normal file
View File

@ -0,0 +1,6 @@
press_revert_button = function()
Show_menu = nil
love.filesystem.remove(Directory..Current_pane.filename)
-- As a sort of undo, we don't mess with the bufferr. Conservatively indicate that there are unsaved changes.
Current_pane.editor_state.next_save = Current_time + 3
end