-
Notifications
You must be signed in to change notification settings - Fork 228
FindReplaceOverlay: add support from mnemonics from the Dialog #2235
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
Conversation
HeikoKlare
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, it's great to have the existing mnemonics of the dialog supported in the overlay as well. My only concern is that they derivate from existing behavior in the sense that for the search options/action they are only available when the search input field has focus, while the replace actions are only available when the replace input field has focus. So when the focus is anywhere else (any toolbar item or the other input field), the shortcuts are not available. This was already a limitation before, but it somehow becomes worse when readding the existing mnemonics, as they were dialog-unique and accessible from everywhere in the dialog. Maybe we should extend the design to also support that case?
| private static final List<KeyStroke> SEARCH_FORWARD = List.of( // | ||
| KeyStroke.getInstance(SWT.CR), KeyStroke.getInstance(SWT.KEYPAD_CR)); | ||
| KeyStroke.getInstance(SWT.CR), KeyStroke.getInstance(SWT.KEYPAD_CR), | ||
| KeyStroke.getInstance(SWT.ALT, 'n')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the dialog, all the added bindings also work when having the shift key pressed. Maybe an additional KeyStroke instance should be added for that combination as well?
| private static final List<KeyStroke> OPTION_REGEX = List.of( // | ||
| KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'P'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'p')); | ||
| KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'P'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'p'), | ||
| KeyStroke.getInstance(SWT.ALT, 'X')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be 'x' instead of 'X'.
|
After merging into the FindReplaceOverlay which is drawn as a composite inside of the page, some of the "alt+..." keybindings don't work anymore, and trigger a global action instead (e.g. alt+s opens "source" from the menu bar at the top). I believe this is a reason to drop this feature all together.
This is the table of mnemonics which work:
I have updated my PR with a subset of all the mnemonics - every registered mnemonic still works. |
In order to preserve the workflow of users who use the Mnemonics of the Find/Replace Dialog a lot, add support to these key combinations as well fixes eclipse-platform#2080
7c69e19 to
b2610b5
Compare
I agree with this. In particular, now the overlay is not a separate dialog with its completely independent shortcut processing anymore. Shortcuts defined for the editor scope will apply, such that depending on the individual configuration different shortcuts may be conflicting. E.g., configuring some editor action for shortcut ALT+C would lead to a conflict with the support for the find/replace dialog mnemonic to toggle case-sensitive search. This also demands for making even the current shortcuts for the overlay configurable so that conflicting shortcuts are detected/avoided. |
|
@HeikoKlare in this case, I am now closing this PR |
In order to preserve the workflow of users who use the Mnemonics of the Find/Replace Dialog a lot, add support to these key combinations as well
fixes #2080