summaryrefslogtreecommitdiff
path: root/gtk/gtkimcontextwayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/gtkimcontextwayland.c')
-rw-r--r--gtk/gtkimcontextwayland.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index 2462f7201f..6c3b2b393a 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -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];