diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 738869f6..9fb01404 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,8 @@ ### Improve +* Fix shift input error [#396](https://github.com/Riey/kime/issues/396) + ## 2.1.2 ### Improve diff --git a/res/default_config.yaml b/res/default_config.yaml index 261c04f3..a42dfd0a 100644 --- a/res/default_config.yaml +++ b/res/default_config.yaml @@ -21,9 +21,6 @@ global_hotkeys: behavior: Switch: Latin result: Bypass - Shift: - behavior: Ignore - result: Consume Muhenkan: behavior: Toggle: diff --git a/src/engine/core/src/config.rs b/src/engine/core/src/config.rs index ae235274..8940f385 100644 --- a/src/engine/core/src/config.rs +++ b/src/engine/core/src/config.rs @@ -105,7 +105,6 @@ impl Default for RawConfig { Key::normal(KeyCode::Hangul) => Hotkey::new(HotkeyBehavior::toggle_hangul_latin(), HotkeyResult::Consume), Key::super_(KeyCode::Space) => Hotkey::new(HotkeyBehavior::toggle_hangul_latin(), HotkeyResult::Consume), Key::normal(KeyCode::Muhenkan) => Hotkey::new(HotkeyBehavior::toggle_hangul_latin(), HotkeyResult::Consume), - Key::normal(KeyCode::Shift) => Hotkey::new(HotkeyBehavior::Ignore, HotkeyResult::Consume), Key::new(KeyCode::E, ModifierState::CONTROL | ModifierState::ALT) => Hotkey::new(HotkeyBehavior::Mode(InputMode::Emoji), HotkeyResult::ConsumeIfProcessed), Key::new(KeyCode::Backslash, ModifierState::CONTROL | ModifierState::ALT) => Hotkey::new(HotkeyBehavior::Mode(InputMode::Math), HotkeyResult::ConsumeIfProcessed), }, diff --git a/src/engine/core/src/lib.rs b/src/engine/core/src/lib.rs index 14704a46..fa48182a 100644 --- a/src/engine/core/src/lib.rs +++ b/src/engine/core/src/lib.rs @@ -139,6 +139,9 @@ impl InputEngine { .press_key(config, key, &mut self.commit_buf) { ret |= InputResult::CONSUMED; + } else if key.code == KeyCode::Shift { + // ignore shift key + ret |= InputResult::CONSUMED; } else { // clear preedit when get unhandled key self.clear_preedit(); diff --git a/src/engine/core/tests/dubeolsik.rs b/src/engine/core/tests/dubeolsik.rs index 7d3f823a..505db2b6 100644 --- a/src/engine/core/tests/dubeolsik.rs +++ b/src/engine/core/tests/dubeolsik.rs @@ -66,6 +66,9 @@ fn shift_ignore() { test_input(&[ (Key::normal(R), "ㄱ", ""), (Key::normal(Shift), "ㄱ", ""), + (Key::shift(Shift), "ㄱ", ""), + (Key::super_(Shift), "ㄱ", ""), + (Key::alt(Shift), "ㄱ", ""), (Key::shift(O), "걔", ""), ]) } diff --git a/src/frontends/gtk2/src/immodule.c b/src/frontends/gtk2/src/immodule.c index 10fafc05..f7220345 100644 --- a/src/frontends/gtk2/src/immodule.c +++ b/src/frontends/gtk2/src/immodule.c @@ -144,6 +144,7 @@ gboolean commit_event(KimeImContext *ctx, GdkModifierType state, guint keyval) { gboolean on_key_input(KimeImContext *ctx, guint16 code, KimeModifierState state) { ctx->preedit_has_ended = FALSE; + // debug("(%d, %d)", code, state); KimeInputResult ret = kime_engine_press_key(ctx->engine, ctx->config, code, state);