diff --git a/README.md b/README.md index f1f92e7..1768ef3 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ Vietnamese Telex is also available as a compatibility mode. | `Ctrl+E` | Emoji and symbol search | | `Ctrl+H` | One-shot Hanja search | +A Korean keyboard's 한/영 key toggles Korean and English, and its 한자 key +is `Ctrl+H`. + A complete Japanese reading shows its Kanji candidates with none chosen. `Space` chooses the first and then steps on, wrapping (`Shift+Space` steps back); `Up`/`Down` and `PageUp`/`PageDown` move without wrapping. An diff --git a/ipc.h b/ipc.h index 67ff230..3bedfd9 100644 --- a/ipc.h +++ b/ipc.h @@ -39,6 +39,8 @@ enum Kdown = Kspec|0x54, Kpgup = Kspec|0x55, Kpgdown = Kspec|0x56, + Khangul = Kspec|0x31, + Khanja = Kspec|0x34, Kmodfirst = Kspec|0xe1, Kmodlast = Kspec|0xee, diff --git a/strans.c b/strans.c index da368cb..5712855 100644 --- a/strans.c +++ b/strans.c @@ -682,6 +682,14 @@ transition(u32int ks, u32int mod, Str *com) ks = kokey(ks, mod); else if(isjp(&im) && ks >= 'A' && ks <= 'Z') ks += 'a' - 'A'; /* romaji is case-blind, Caps Lock included */ + /* The Korean keyboard's 한/영 and 한자 keys are Ctrl+S or Ctrl+T, and Ctrl+H. */ + if(ks == Khangul){ + ks = im.l->lang == LangKO ? 't' : 's'; + mod = Mctrl; + }else if(ks == Khanja){ + ks = 'h'; + mod = Mctrl; + } if(search.lang) return searchkey(ks, mod, com); n = movedelta(ks); diff --git a/tests/engine_test.c b/tests/engine_test.c index 48fe708..7dcf3ec 100644 --- a/tests/engine_test.c +++ b/tests/engine_test.c @@ -1855,6 +1855,22 @@ engine_hanja_input_languages(struct ct *t) checkstr(t, "Japanese Hanja commit", "か", &com); CT_EQ_INT(t, LangJP, im.l->lang); + /* The keyboard's own keys: 한자 seeds like Ctrl+H, 한/영 toggles. */ + init(); + im.l = getlang(LangKO); + sclear(&com); + if(typekeys(t, "gks", &com)){ + CT_CHECK(t, keystroke(Khanja, 0, &com)); + checkstr(t, "Hanja key seed", "한", &search.text); + CT_EQ_INT(t, 2, im.nkouho); + CT_CHECK(t, keystroke(Khangul, 0, &com)); + checkstr(t, "Hangul key commits the query", "한", &com); + CT_EQ_INT(t, 0, search.lang); + CT_EQ_INT(t, LangEN, im.l->lang); + CT_CHECK(t, keystroke(Khangul, 0, &com)); + CT_EQ_INT(t, LangKO, im.l->lang); + } + init(); im.l = getlang(LangEN); sclear(&com);