Merge branch 'wip/carlosg/fix-surrounding-text-master' into 'master'

imwayland: Clamp the surrounding string end correctly

Closes #2565

See merge request GNOME/gtk!1621
This commit is contained in:
Carlos Garnacho 2020-04-03 18:37:44 +00:00
commit 9a2f7338df

View File

@ -323,7 +323,7 @@ notify_surrounding_text (GtkIMContextWayland *context)
mid = MIN (context->surrounding.cursor_idx,
context->surrounding.anchor_idx) + (cursor_len / 2);
a = MAX (0, mid - (MAX_LEN / 2));
b = MIN (MAX_LEN, mid + (MAX_LEN / 2));
b = MIN (len, mid + (MAX_LEN / 2));
start = &context->surrounding.text[a];
end = &context->surrounding.text[b];