Make Select All select text within the textbox, if applicable

This commit is contained in:
Isaiah Odhner 2023-04-26 17:04:20 -04:00
parent 088b7e9b2d
commit c1375d81ed
2 changed files with 11 additions and 6 deletions

View File

@ -126,7 +126,7 @@ cat file.ans
## Known Issues
- Pressing Ctrl+A in textbox selects the canvas instead of the text in the text box.
- Pressing delete in a textbox can crash the program.
- Selection box border is inside instead of outside (and lacks dashes). For the text box, I hid the border because it was too visually confusing, but it should also have an outer border.
- Pick Color can't be cancelled, since it samples the color continuously.
- Pressing both mouse buttons to cancel tools can sometimes result the the tool restarting, or it's just my mouse. It's probably my mouse, now that I think about it. But also, it should actually undo current action, not just end it.

View File

@ -1909,11 +1909,16 @@ class PaintApp(App[None]):
self.selected_tool = Tool.select
def action_select_all(self) -> None:
"""Select the entire image."""
self.stop_action_in_progress()
self.image.selection = Selection(Region(0, 0, self.image.width, self.image.height))
self.canvas.refresh()
self.selected_tool = Tool.select
"""Select the entire image, or in a textbox, all the text."""
if self.image.selection and self.image.selection.textbox_mode:
assert self.image.selection.contained_image is not None
self.image.selection.text_selection_start = Offset(0, 0)
self.image.selection.text_selection_end = Offset(self.image.selection.contained_image.width, self.image.selection.contained_image.height)
else:
self.stop_action_in_progress()
self.image.selection = Selection(Region(0, 0, self.image.width, self.image.height))
self.canvas.refresh()
self.selected_tool = Tool.select
def action_copy_to(self) -> None:
self.warning_message_box(_("Paint"), "Not implemented.", "ok")
def action_paste_from(self) -> None: