Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Ctrl+Shift+Z redo shortcut #5258

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Conversation

YgorSouza
Copy link
Contributor

This shortcut was previously triggering the Undo action due to the matches_logically method ignoring the state of the Shift key. This was solved by simply inverting the order of the undo and redo arms, so the undo is not matched if the shortcut corresponds to redo.

Sorry, something went wrong.

This shortcut was previously triggering the Undo action due to the
matches_logically method ignoring the state of the Shift key. This was
solved by simply inverting the undo and redo arms, so the undo is not
matched if the shortcut corresponds to redo.
Copy link

Preview available at https://egui-pr-preview.github.io/pr/5258-fix-redo-shortcut
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@YgorSouza
Copy link
Contributor Author

YgorSouza commented Oct 13, 2024

Not sure if this is the best solution, or if it would be better to just use matches_exact instead. I don't know if there would be any undesirable side effects on different keyboards.

Edit: according to the consume_shortcut documentation, the correct approach is to order the shortcuts from most to least "specific" as is done in this PR, so I'm leaving it as is.

Copy link
Contributor

@bircni bircni left a comment

Choose a reason for hiding this comment

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

lgtm

maybe it would be good to use KeyboardShortcut here

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Good catch

@emilk emilk added bug Something is broken egui labels Oct 23, 2024
@emilk emilk merged commit e5c502f into emilk:master Oct 23, 2024
24 of 25 checks passed
hacknus pushed a commit to hacknus/egui that referenced this pull request Oct 30, 2024
This shortcut was previously triggering the Undo action due to the
matches_logically method ignoring the state of the Shift key. This was
solved by simply inverting the order of the undo and redo arms, so the
undo is not matched if the shortcut corresponds to redo.

* Closes <emilk#5255>
* [x] I have followed the instructions in the PR template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken egui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl+Shift+Z should restore data to the state that was before like Ctrl+Y does
3 participants