[gtk/wip/carlosg/fix-surrounding-text-again] imwayland: Clamp the surrounding string end correctly
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/carlosg/fix-surrounding-text-again] imwayland: Clamp the surrounding string end correctly
- Date: Fri, 3 Apr 2020 10:57:39 +0000 (UTC)
commit 5c628f15e5fd3362ce66c62299d041c6ae1d000b
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Apr 3 12:44:37 2020 +0200
imwayland: Clamp the surrounding string end correctly
In the paths where len > MAX_LEN and cursor/anchor are separated by
at least MAX_LEN from text edges, we were clamping the right end of
the surrounding string at MAX_LEN. Oops.
This end anchor may go as far as the string length, although just
up to len - MAX_LEN in real terms (due to the condition above that
caches cursor/anchor positions being near enough the text end).
modules/input/imwayland.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
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];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]