diff --git a/modules/input/imwayland.c b/modules/input/imwayland.c index 8f697bec1b..12d18a0f64 100644 --- a/modules/input/imwayland.c +++ b/modules/input/imwayland.c @@ -322,7 +322,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];