Skip to content

Commit

Permalink
state: Ignore unassigned keys in start and select states
Browse files Browse the repository at this point in the history
That would cause incompatible behavior when we switched to
libxkbcommon to resolve keysyms:
#54 (comment)
  • Loading branch information
ueno committed Aug 20, 2018
1 parent 725dc97 commit 10555a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libskk/state.vala
Expand Up @@ -745,6 +745,11 @@ namespace Skk {
ref KeyEvent key)
{
var command = state.lookup_key (key);

// if no command nor code is assigned to key, we can't proceed
if (command == null && key.code == 0)
return true;

if (command == "abort" ||
command == "abort-to-latin" ||
command == "abort-to-latin-unhandled") {
Expand Down Expand Up @@ -976,6 +981,11 @@ namespace Skk {
ref KeyEvent key)
{
var command = state.lookup_key (key);

// if no command nor code is assigned to key, we can't proceed
if (command == null && key.code == 0)
return true;

if (command == "previous-candidate") {
if (!state.candidates.previous ()) {
state.candidates.clear ();
Expand Down
2 changes: 2 additions & 0 deletions tests/basic.c
Expand Up @@ -57,6 +57,7 @@ static SkkTransition rom_kana_transitions[] =
{ SKK_INPUT_MODE_LATIN, "a \t", "", "a", SKK_INPUT_MODE_LATIN },
/* Issue#11 */
{ SKK_INPUT_MODE_HIRAGANA, "q s a n S y a", "▽シャ", "サン", SKK_INPUT_MODE_KATAKANA },
{ SKK_INPUT_MODE_HIRAGANA, "H o h Control_L a a a a a", "▽ほはああああ", "", SKK_INPUT_MODE_HIRAGANA },
{ 0, NULL }
};

Expand All @@ -78,6 +79,7 @@ static SkkTransition okuri_nasi_transitions[] =
{ SKK_INPUT_MODE_KATAKANA, "K a n j i SPC q", "", "漢字", SKK_INPUT_MODE_HIRAGANA },
{ SKK_INPUT_MODE_HIRAGANA, "N A N A", "▼な*んあ【】", "", SKK_INPUT_MODE_HIRAGANA },
{ SKK_INPUT_MODE_HIRAGANA, "N A N a", "▼な*な【】", "", SKK_INPUT_MODE_HIRAGANA },
{ SKK_INPUT_MODE_HIRAGANA, "A o SPC Control_L", "▼青", "", SKK_INPUT_MODE_HIRAGANA },
{ 0, NULL }
};

Expand Down

0 comments on commit 10555a2

Please sign in to comment.