From 139d1c56913046d519efdc9f8dd9520368b68385 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 3 May 2026 17:09:43 +0200 Subject: Fix crash when the cursor moves past an emoji (#1264) The cursor might move in the middle of a surrogate pair.--- srcs/juloo.keyboard2/CurrentlyTypedWord.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/srcs/juloo.keyboard2/CurrentlyTypedWord.java b/srcs/juloo.keyboard2/CurrentlyTypedWord.java index 674a90d..2852fa8 100644 --- a/srcs/juloo.keyboard2/CurrentlyTypedWord.java +++ b/srcs/juloo.keyboard2/CurrentlyTypedWord.java @@ -127,7 +127,9 @@ public final class CurrentlyTypedWord int c = Character.codePointAt(s, i); i += Character.charCount(c); _cursor++; - if (!Character.isLetter(c)) + // [i >= end] might happen when the cursor is in the middle of a + // surrogate pair + if (!Character.isLetter(c) && i < end) insert_start = i; } if (insert_start > 0) -- cgit v1.2.3