Fix arrow keys not moving selected data if not moved with mouse first

This commit is contained in:
Isaiah Odhner 2023-07-08 01:46:00 -04:00
parent 505cb389f2
commit 46c52fcaf1
2 changed files with 7 additions and 2 deletions

View File

@ -179,7 +179,6 @@ To preview ANSI art files in file managers like Nautilus, Thunar, Nemo, or Caja,
- Some languages don't display correctly.
- Large files can make the program very slow, as can magnifying the canvas. There is a 500 KB limit when opening files to prevent it from freezing.
- Free-Form Select stamping/finalizing is incorrect when the selection is off-screen to the left or top.
- Moving the selection with the arrow keys does not cut out the selection from the canvas, it only moves the selection box.
- Status bar description can be left blank when selecting a menu item <!--I'm guessing Leave can come after close-->
- 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.

View File

@ -3875,9 +3875,13 @@ Columns: {len(palette) // 2}
# )
def extract_to_selection(self, erase_underlying: bool = True) -> None:
"""Extracts image data underlying the selection from the document into the selection."""
"""Extracts image data underlying the selection from the document into the selection.
This creates an undo state with the current tool's name, which should be Select or Free-Form Select.
"""
sel = self.image.selection
assert sel is not None, "extract_to_selection called without a selection"
assert sel.contained_image is None, "extract_to_selection called after a selection was already extracted"
# TODO: DRY action handling
self.image_at_start = AnsiArtDocument(self.image.width, self.image.height)
self.image_at_start.copy_region(self.image)
@ -4443,6 +4447,8 @@ Columns: {len(palette) // 2}
# (It is useless to position it _completely_ outside, since you could just delete it.)
sel = self.image.selection
assert sel is not None, "move_selection_absolute called without a selection"
if sel.contained_image is None:
self.extract_to_selection()
offset = Offset(
max(1-sel.region.width, min(self.image.width - 1, x)),
max(1-sel.region.height, min(self.image.height - 1, y)),