fix(keybindings): honor null overrides and terminal shortcut forwarding#2024
Conversation
Greptile SummaryThis PR fixes two related keybinding bugs: (1) Confidence Score: 5/5Safe to merge — both bug fixes are correct and no regressions were found. All findings are P2 style suggestions. The null-override fix correctly uses hasOwnProperty to distinguish an explicit null from an absent key. The terminal caching logic is sound: the -1 sentinel guarantees at least one recompute after the first rebuildKeymap call, and the version counter reliably invalidates the cache on every keybinding reload. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[setKeyBindings called] --> B[loadCustomKeyBindings]
B --> |file exists| C[resolvedKeyBindings = file contents]
B --> |file missing| D[resolvedKeyBindings = keyBindings default]
C --> E[rebuildKeymap]
D --> E
E --> F[buildResolvedKeyBindingsSnapshot\ncachedResolvedKeyBindings]
F --> G[resolveBindingInfo per name]
G --> |override === null| H[key: null — binding disabled]
G --> |override is object| I[merged binding]
G --> |no override| J[base keyBinding]
E --> K[resolvedKeyBindingsVersion++]
K --> L[commandMap updated\ncommand.key / description]
L --> M[cachedKeymap rebuilt for CodeMirror]
N[Terminal keypress] --> O[parseAppKeybindings]
O --> P{version match?}
P --> |yes| Q[return cached parsedAppKeybindings]
P --> |no| R[getResolvedKeyBindings\ncachedResolvedKeyBindings]
R --> S[parse + cache new bindings\nupdate version]
S --> T{isAppKeybinding?}
Q --> T
T --> |yes| U[dispatch to document\nreturn false — terminal skips]
T --> |no| V[return true — terminal handles normally]
Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile |
No description provided.