Merge branch 'composetable/accept-long-replacements' into 'master'

gtkcomposetable: Accept long replacement strings

Closes #4273

See merge request GNOME/gtk!3983
This commit is contained in:
Matthias Clasen 2021-09-21 17:37:06 +00:00
commit d6d7299859
6 changed files with 23 additions and 9 deletions

View File

@ -936,8 +936,6 @@ parser_get_compose_table (GtkComposeParser *parser)
}
else
{
g_assert (strlen (value) < 20);
if (char_data->len > 0)
g_string_append_c (char_data, 0);
@ -1437,7 +1435,6 @@ gtk_compose_table_foreach (const GtkComposeTable *table,
int char_offset = encoded_value & ~(1 << 15);
g_assert (char_offset < table->n_chars);
value = &table->char_data[char_offset];
g_assert (strlen (value) < 20);
}
else
{

View File

@ -1 +1,2 @@
<Multi_key> <e> <m> <m> <e> <n> <t> <a> <l> <e> <r> : "🧀"
<Multi_key> <t> <m> <y> <k> : "the mooore you knooow 💫"

View File

@ -1,6 +1,7 @@
# n_sequences: 1
# n_sequences: 2
# max_seq_len: 11
# n_index_size: 1
# data_size: 23
# n_chars: 5
# data_size: 28
# n_chars: 32
<Uff20> <U74> <U6d> <U79> <U6b> : "the mooore you knooow 💫"
<Uff20> <U65> <U6d> <U6d> <U65> <U6e> <U74> <U61> <U6c> <U65> <U72> : "🧀" # U1f9c0

View File

@ -1,3 +1,4 @@
<Multi_key> <s> <e> <q> : "!"
<Multi_key> <s> <e> <q> <u> : "?"
<Multi_key> <z> <w> <i> <n> <e> <s> : "🥂"
<Multi_key> <l> <o> <n> <g> : "this is a long replacement string"

View File

@ -1,8 +1,9 @@
# n_sequences: 3
# n_sequences: 4
# max_seq_len: 7
# n_index_size: 1
# data_size: 24
# n_chars: 5
# data_size: 29
# n_chars: 39
<Uff20> <U73> <U65> <U71> : "!" # U21
<Uff20> <U6c> <U6f> <U6e> <U67> : "this is a long replacement string"
<Uff20> <U73> <U65> <U71> <U75> : "?" # U3f
<Uff20> <U7a> <U77> <U69> <U6e> <U65> <U73> : "🥂" # U1f942

View File

@ -229,6 +229,19 @@ compose_table_match (void)
g_assert_true (match);
g_assert_cmpstr (output->str, ==, "?");
g_string_set_size (output, 0);
buffer[0] = GDK_KEY_Multi_key;
buffer[1] = GDK_KEY_l;
buffer[2] = GDK_KEY_o;
buffer[3] = GDK_KEY_n;
buffer[4] = GDK_KEY_g;
ret = gtk_compose_table_check (table, buffer, 5, &finish, &match, output);
g_assert_true (ret);
g_assert_true (finish);
g_assert_true (match);
g_assert_cmpstr (output->str, ==, "this is a long replacement string");
g_string_free (output, TRUE);
g_free (file);
}