libskk icon indicating copy to clipboard operation
libskk copied to clipboard

Unexpected dictionary registration behavior with okuri-ari entry

Open buzztaiki opened this issue 4 years ago • 1 comments

I'm using libskk with fcitx5-skk. When I register ググる to the dictionary as follows, the output after registration will be ググる but ググ.

▼ぐぐ*る【ググ】

Also, The following entry was registered in user.dict.

ぐぐ*る /ググ/

The result of the skk command is as follows:

$ echo -e "G u g u R u G u g u q RET" | skk
{ "input": "G u g u R u G u g u q RET", "output": "ググ", "preedit": "" }

buzztaiki avatar Nov 14 '21 15:11 buzztaiki

The following is a test case that reproduces this problem:

static void
save_okuri_ari (void)
{
  SkkContext *context;
  gboolean retval;
  const gchar *preedit;
  const gchar *output;
  SkkCandidate **candidates;
  SkkDict **dictionaries;
  gint len;
  GError *error;

  context = create_context (TRUE, FALSE);

  retval = skk_context_process_key_events (context, "G u g u R u G u g u q RET");
  g_assert (retval);

  output = skk_context_get_output(context);
  g_assert_cmpstr (output, ==, "ググる");

  error = NULL;
  skk_context_save_dictionaries (context, &error);
  g_assert_no_error (error);

  dictionaries = skk_context_get_dictionaries(context, &len);
  g_assert_cmpint (len, ==, 2);

  candidates = skk_dict_lookup (SKK_DICT (dictionaries[1]),
                                "ぐぐr",
                                TRUE,
                                &len);
  g_assert_cmpint (len, ==, 1);
  while (--len >= 0) {
    g_object_unref (candidates[len]);
  }
  g_free (candidates);


  g_object_unref (context);
}

buzztaiki avatar Nov 14 '21 15:11 buzztaiki