[JetBrains] Custom global key handler supporting Enter/Delete/Backspace and Enter+Shift in all IntelliJ IDEs flavors in the uniform way #7480
+46
−0
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.
CLOSE https://linear.app/sourcegraph/issue/CODY-4704/backspace-and-enter-keys-not-working-in-rider-cody-window-macos
Special global handler for
Backspace
,Delete
,Enter
, andShift+Enter
which are not working properly in the CEF instance in Rider and potentially in other IntelliJ IDEs flavors. Even, when there are no shortcuts defined for these keys in the current keymap, press key events still aren't forwarded to the CEF instance, but looks like they are swallowed by other dispatchers (DefaultKeyboardFocusManager.keyEventDispatcher
) in the pipeline:The implementation un-consume a key event (via reflection), already consumed by other dispatchers, which allow a key event to be later handled by Cef component (webview).
Detecting the event source using
JBCefOsrComponent
type, which is about 30% faster than callingbrowser.uiComponent.hasFocus()
, 2080.00 ns. vs 2923.53 ns. on average (handler is called for every keystroke, but the execution is narrowed only forJBCefOsrComponent
to make minimal performance impact on IDE UI.Test plan