mirror of
https://github.com/1j01/textual-paint.git
synced 2024-11-28 10:03:29 +03:00
Make Text tool undoable
This commit is contained in:
parent
5faaccbd2a
commit
f33802af30
@ -127,7 +127,7 @@ cat file.ans
|
||||
## Known Issues
|
||||
|
||||
- Pressing Delete while using the Text tool deletes the whole text box. Similarly, Ctrl+A selects the canvas instead of the text in the text box.
|
||||
- The Text tool cannot be undone, and immediately affects the canvas. It doesn't go away if you click off without typing anything.
|
||||
- The Text tool is finalized instead of discarded even if you don't type anything.
|
||||
- Text and Selection box borders are inside instead of outside (and have no dashes).
|
||||
- The currently selected foreground (text) color is not displayed in the palette.
|
||||
- Pick Color can't be cancelled with Escape or by pressing both mouse buttons.
|
||||
|
11
paint.py
11
paint.py
@ -2243,7 +2243,16 @@ class PaintApp(App[None]):
|
||||
if not self.image.selection:
|
||||
return
|
||||
|
||||
make_undo_state = self.image.selection.contained_image is None and not meld
|
||||
if self.image.selection.textbox_mode:
|
||||
# The Text tool creates an undo state only when you switch tools
|
||||
# or click outside the textbox, melding the textbox into the image.
|
||||
# If you're deleting the textbox, an undo state doesn't need to be created.
|
||||
make_undo_state = meld
|
||||
else:
|
||||
# The Select tool creates an undo state when you drag a selection,
|
||||
# so we only need to create one if you haven't dragged it.
|
||||
# Once it's dragged, it cuts out the image data, and contained_image is not None.
|
||||
make_undo_state = self.image.selection.contained_image is None and not meld
|
||||
|
||||
if make_undo_state:
|
||||
# TODO: DRY with other undo state creation
|
||||
|
Loading…
Reference in New Issue
Block a user