-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Accept individual modifier keys as valid keybindings #637
Merged
krassowski
merged 48 commits into
jupyterlab:main
from
g547315:allow-mapping-to-mod-keys
Apr 4, 2024
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
c82fc4a
extend keystrokes to mod keys
g547315 835f745
fix doubled keys
g547315 b9d2db3
remove comments
g547315 12f6921
remove console-log
g547315 77330ad
Merge branch 'jupyterlab:main' into allow-mapping-to-mod-keys
m158261 6cfdf12
Removed whitespace from keystrokes
m158261 2167496
Run prettier
m158261 d9ddb6c
Updated normalizeKeystroke to account for empty string
m158261 4efbfc7
Check for empty string in key
m158261 5e5e65c
Check for empty string
m158261 d4e384c
Checking for whitespace
m158261 36fcbad
Trim whitespace
m158261 d520616
Added check for keys
m158261 4926fd0
refactor add space for puley modifier key
g547315 9bf4c47
Changed tests to reflect mod keys creating events
m158261 85a1362
Changed tests to match key bindings
m158261 5ed4103
Revert test changes
m158261 d9a3f6f
remove added white space
g547315 3ebd720
Merge branch 'jupyterlab:main' into allow-mapping-to-mod-keys
g547315 ab4c7bf
Merge branch 'allow-mapping-to-mod-keys' of ssh://ssh.github.com:443/…
g547315 c248e7a
Removed ctrl key from test to check functionality
m158261 10e25fc
Modified test
m158261 a89b601
delay modifier key only execution
g547315 7818bf5
Merge branch 'allow-mapping-to-mod-keys' of ssh://ssh.github.com:443/…
g547315 7ffa17c
Update packages/commands/src/index.ts
g547315 d115929
re-write
g547315 203c38a
removed redundantcode
g547315 1008417
Ran Prettier to fix failing test
g547315 e773b5e
Update packages/commands/src/index.ts
g547315 ef7bc6f
Refactored func and test
g547315 2cca0ab
Merge branch 'main' into allow-mapping-to-mod-keys
g547315 5a1bfd9
modifier key bindings trigger on key holds
g547315 5e13b06
reverted changed test
g547315 4468167
undo reverted test changes
g547315 109298a
Ran Prettier
g547315 b004546
Starts the timer for mod keys only before updating the keystrokes list
brichet dd5451b
Merge pull request #1 from brichet/modifier-timer
g547315 843012b
Merge branch 'main' into allow-mapping-to-mod-keys
brichet 088a379
Update packages/commands/src/index.ts
g547315 d670fce
added new variable with a shorter delay
g547315 7d385f6
Merge branch 'allow-mapping-to-mod-keys' of ssh://ssh.github.com:443/…
g547315 57d8170
ran yarn run api and committing changes
g547315 b3c4237
ran linter
g547315 aef9685
refactor variable to camelcase
g547315 1873564
refactor variable to camelcase
g547315 4b67ed0
updated api
g547315 c8b1f39
Merge branch 'main' into allow-mapping-to-mod-keys
g547315 73873be
Clear modifier timeout if an exact match is found
brichet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks for the ping @brichet!
Should the modifier timer also be stopped if an exact match for a chord is found?
For example if the sequence is
Ctrl Z
(notCtrl + Z
butCtrl
followed byZ
) we would get two events (one forCtrl
, one forZ
). My impression from just reading the code (I could be wrong) is that currently it would trigger both the handler forCtrl
and for theCtrl
followed byZ
chord.In other words, should
_clearModifierTimer
be called in_clearPendingState
too?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.
You are right, but this behavior seems OK if this feature is only used to display overlays.
You may want to keep the modifier key(s) pressed (and the overlays visible) to trigger another shortcut.
If we keep it that way, we should probably document it somewhere, to avoid using this modifier key(s) for unexpected action.
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.
Yes, but I also do not want to have the overlay visible ("sticky") after I already pressed the combo I was interested in. I think if user is pressing two shortcuts and they need overlays, say Ctrl + C and Ctrl + V it is fine it they do that in sequence:
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.
Actually, the overlay visible or not depends on the command that will be triggered.
Here it is only about the timeout before triggering the command, so you're right we better clear it if an other command is triggered. BTW the timeout is also cleared on key up event with this PR.
I updated it.