ImGui: a bare modifier key does not end the C-k prefix
After C-k, pressing Shift (for C-k C, C-k ^ or a shifted symbol), or pressing Ctrl again for C-k C-d, reached the k-prefix handler as a key with no ASCII value, which reported an unknown command and left the prefix; the suffix was then inserted as text. Modifier keys pressed on their own are now ignored while the prefix waits. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -157,6 +157,24 @@ map_key(const SDL_Keycode key,
|
||||
|
||||
// If we are in k-prefix, interpret the very next key via the C-k keymap immediately.
|
||||
if (k_prefix) {
|
||||
// A modifier pressed on its own (Shift for C-k C or C-k ^, Ctrl
|
||||
// pressed again for C-k C-d) is not the suffix: keep waiting.
|
||||
switch (key) {
|
||||
case SDLK_LSHIFT:
|
||||
case SDLK_RSHIFT:
|
||||
case SDLK_LCTRL:
|
||||
case SDLK_RCTRL:
|
||||
case SDLK_LALT:
|
||||
case SDLK_RALT:
|
||||
case SDLK_LGUI:
|
||||
case SDLK_RGUI:
|
||||
case SDLK_CAPSLOCK:
|
||||
case SDLK_MODE:
|
||||
out.hasCommand = false;
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
esc_meta = false;
|
||||
// Normalize to ASCII; preserve case for letters using Shift
|
||||
int ascii_key = 0;
|
||||
|
||||
Reference in New Issue
Block a user