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
@ -1181,12 +1181,20 @@ static gint
|
|||||||
cally_text_get_caret_offset (AtkText *text)
|
cally_text_get_caret_offset (AtkText *text)
|
||||||
{
|
{
|
||||||
ClutterActor *actor = NULL;
|
ClutterActor *actor = NULL;
|
||||||
|
ClutterTextBuffer *buffer;
|
||||||
|
int cursor_pos;
|
||||||
|
|
||||||
actor = CALLY_GET_CLUTTER_ACTOR (text);
|
actor = CALLY_GET_CLUTTER_ACTOR (text);
|
||||||
if (actor == NULL) /* State is defunct */
|
if (actor == NULL) /* State is defunct */
|
||||||
return -1;
|
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
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user