mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-02 23:28:52 +03:00
Allow undoing color or character information loss
Of course, this highlights the need to prompt during Save as well, not just Save As, or to make creating color or character information impossible depending on the type of file that is open.
This commit is contained in:
parent
17b4a67455
commit
2ed803631b
@ -45,6 +45,7 @@
|
||||
"getpixel",
|
||||
"goland",
|
||||
"gvim",
|
||||
"hackily",
|
||||
"Haha",
|
||||
"hkey",
|
||||
"hslrgb",
|
||||
|
@ -2606,7 +2606,7 @@ class PaintApp(App[None]):
|
||||
self.saved_undo_count = len(self.undos)
|
||||
window.close()
|
||||
if reload_after_save:
|
||||
# TODO: make this undoable
|
||||
self.resize_document(self.image.width, self.image.height) # (hackily) make this undoable
|
||||
new_image = AnsiArtDocument.decode_based_on_file_extension(content, file_path)
|
||||
self.canvas.image = self.image = new_image
|
||||
self.canvas.refresh(layout=True)
|
||||
@ -3269,7 +3269,7 @@ class PaintApp(App[None]):
|
||||
self.cancel_preview()
|
||||
|
||||
# NOTE: This function is relied on to create an undo even if the size doesn't change,
|
||||
# when recovering from a backup.
|
||||
# when recovering from a backup, and when reloading file content when losing information during Save As.
|
||||
# TODO: DRY undo state creation (at least the undos/redos part)
|
||||
action = Action(_("Attributes"), Region(0, 0, self.image.width, self.image.height))
|
||||
action.is_resize = True
|
||||
|
Loading…
Reference in New Issue
Block a user