Skip to content

Added deselect on esc shortcut when selection tool active#2205

Open
Sam-Gledhill wants to merge 1 commit into
PintaProject:masterfrom
Sam-Gledhill:master
Open

Added deselect on esc shortcut when selection tool active#2205
Sam-Gledhill wants to merge 1 commit into
PintaProject:masterfrom
Sam-Gledhill:master

Conversation

@Sam-Gledhill

Copy link
Copy Markdown

Calls existing deselect function on escape key press, but only when a selection tool is active (EllipseSelect, RectangleSelect, LassoSelect).

Addresses #1849.

@Sam-Gledhill

Copy link
Copy Markdown
Author

Hi there. The Ubuntu test failed with dozens of formatting errors, but when I ran dotnet format --no-restore, it only picked up one formatting issue. Is there something I'm missing? I'm seeing similar issues on other PRs.

@cameronwhite cameronwhite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes the CI builds have a newer version of dotnet format which has different behaviours from the local version - don't worry about it and I can fix it up before merging

shortcuts: ["<Primary><Shift>A", "<Ctrl>D"]);

DeselectSelection = new Command (
"deselect",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giving this command the same identifier as the other deselect command will probably cause some issues - e.g. on macOS this seems to cause the menu item to not show its shortcut.

However, I think it'd be worth trying to just merge this with the other command and just add Escape as an alternative shortcut which works while in any tool (matching Paint.NET behaviour). The only thing to test would be to verify that the text tool can still handle Escape to finish editing the text while a selection is active, then pressing Escape again would clear the selection

private void HandlePintaCoreActionsEditDeselectSelectionActivated (object sender, EventArgs e)
{

if (!selection_tools.Contains (tools.CurrentTool?.ToString ())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an IsSelectionTool property that can be checked on the current tool instead of hardcoding names, but we may not need to check this anyways (see other comment)

@cameronwhite cameronwhite linked an issue Jun 27, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESC should Deselect

2 participants