Skip to content

Commit

Permalink
Ignore shift key input (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
Riey authored Mar 20, 2021
1 parent ba7b1a0 commit 192d38c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### Improve

* Fix shift input error [#396](https://github.com/Riey/kime/issues/396)

## 2.1.2

### Improve
Expand Down
3 changes: 0 additions & 3 deletions res/default_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ global_hotkeys:
behavior:
Switch: Latin
result: Bypass
Shift:
behavior: Ignore
result: Consume
Muhenkan:
behavior:
Toggle:
Expand Down
1 change: 0 additions & 1 deletion src/engine/core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand Down
3 changes: 3 additions & 0 deletions src/engine/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/engine/core/tests/dubeolsik.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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), "걔", ""),
])
}
Expand Down
1 change: 1 addition & 0 deletions src/frontends/gtk2/src/immodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 192d38c

Please sign in to comment.