cally: Use text length if caret is at the end of ClutterText
ClutterText uses -1 to express the caret being at the end of the text content. A11y expects this position to be equivalent to the number of characters in the text, fetch that if the position is at the end. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7459 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3643>
This commit is contained in:
parent
dd94f193cc
commit
3c217d2902
@ -1180,13 +1180,21 @@ cally_text_get_text_after_offset (AtkText *text,
|
||||
static gint
|
||||
cally_text_get_caret_offset (AtkText *text)
|
||||
{
|
||||
ClutterActor *actor = NULL;
|
||||
ClutterActor *actor = NULL;
|
||||
ClutterTextBuffer *buffer;
|
||||
int cursor_pos;
|
||||
|
||||
actor = CALLY_GET_CLUTTER_ACTOR (text);
|
||||
if (actor == NULL) /* State is defunct */
|
||||
return -1;
|
||||
|
||||
return clutter_text_get_cursor_position (CLUTTER_TEXT (actor));
|
||||
cursor_pos = clutter_text_get_cursor_position (CLUTTER_TEXT (actor));
|
||||
if (cursor_pos >= 0)
|
||||
return cursor_pos;
|
||||
|
||||
/* Cursor is at end */
|
||||
buffer = clutter_text_get_buffer (CLUTTER_TEXT (actor));
|
||||
return clutter_text_buffer_get_length (buffer);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user