Merge branch 'michaelweghorn/a11y_dont_confuse_char_and_byte_count' into 'main'

a11y atspi: Don't use char count as byte count

Closes #6151

See merge request GNOME/gtk!6477
This commit is contained in:
Emmanuele Bassi 2023-10-12 13:40:40 +00:00
commit 71c7e61162
2 changed files with 8 additions and 3 deletions

View File

@ -715,7 +715,7 @@ emit_text_changed (GtkAtSpiContext *self,
"TextChanged",
g_variant_new ("(siiva{sv})",
kind, start, end,
g_variant_new_take_string (g_strndup (text, end)),
g_variant_new_string (text),
NULL),
NULL);
}

View File

@ -1614,7 +1614,10 @@ insert_text_cb (GtkEditable *editable,
return;
length = g_utf8_strlen (new_text, new_text_length);
changed->text_changed (changed->data, "insert", *position - length, length, new_text);
char *inserted_text = g_utf8_substring (new_text, 0, length);
changed->text_changed (changed->data, "insert", *position - length, length, inserted_text);
g_free (inserted_text);
}
static void
@ -1711,7 +1714,9 @@ insert_range_cb (GtkTextBuffer *buffer,
position = gtk_text_iter_get_offset (iter);
length = g_utf8_strlen (text, len);
changed->text_changed (changed->data, "insert", position - length, length, text);
char *inserted_text = g_utf8_substring (text, 0, length);
changed->text_changed (changed->data, "insert", position - length, length, inserted_text);
g_free (inserted_text);
update_cursor (buffer, changed);
}