diff --git a/README.md b/README.md index a8c07a3..e255940 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,6 @@ To preview ANSI art files in file managers like Nautilus, Thunar, Nemo, or Caja, - Status bar description can be left blank when selecting a menu item - Menu items like Copy/Cut/Paste are not grayed out when inapplicable. Only unimplemented items are grayed out. - Set As Wallpaper may not work on your system. For me, on Ubuntu, the wallpaper setting is updated but the picture is not, unless I manually pick it. There is however untested support for many platforms, and you may have better luck than me. -- If you paste and then stamp the selection with Ctrl+Click, the stamp(s) can't be undone. An undo state is only created when finalizing the selection, for pasted selections. - ANSI files (.ans) are treated as UTF-8 when saving and loading, rather than CP437 or Windows-1252 or any other encodings. Unicode is nice and modern terminals support it, but it's not the standard for ANSI files. There isn't really a standard for ANSI files. - ANSI files are loaded with a white background. This may make sense as a default for text files, but ANSI files either draw a background or assume a black background, being designed for terminals. - Can click Cancel button of Edit Colors dialog while opening it, if the mouse lines up with it. diff --git a/src/textual_paint/paint.py b/src/textual_paint/paint.py index 8362baa..bf8cc14 100755 --- a/src/textual_paint/paint.py +++ b/src/textual_paint/paint.py @@ -3964,7 +3964,23 @@ Columns: {len(palette) // 2} # Already cut out, don't replace the image data. # But if you hold Ctrl, stamp the selection. if event.ctrl: + # If pasted, it needs an undo state. + # Otherwise, one should have been already created. + if sel.pasted: + sel.pasted = False # don't create undo when melding (TODO: rename flag or refactor) + + action = Action("Paste") + if len(self.redos) > 0: + self.redos = [] + self.undos.append(action) + # The region must be the whole canvas, because when the selection + # is melded with the canvas, it could be anywhere. + # This could be optimized, see extract_to_selection. + action.region = Region(0, 0, self.image.width, self.image.height) + action.update(self.image) sel.copy_to_document(self.image) + # Don't need to refresh canvas since selection occludes the affected region, + # and has the same content anyway, being a stamp. return self.extract_to_selection(not event.ctrl) return