abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
authorJules Aguillon2026-05-03 17:09:43 +0200
committerGitHub2026-05-03 17:09:43 +0200
commit139d1c56913046d519efdc9f8dd9520368b68385 (patch)
treeb2bbe13be5b908c09f341ca9070443a6b347123a /srcs
parent20a4916ff605e8f97e437457ea3b8dce510cfce0 (diff)
downloadunexpected-keyboard-139d1c56913046d519efdc9f8dd9520368b68385.tar.gz
unexpected-keyboard-139d1c56913046d519efdc9f8dd9520368b68385.zip
Fix crash when the cursor moves past an emoji (#1264)
The cursor might move in the middle of a surrogate pair.
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/CurrentlyTypedWord.java4
1 files changed, 3 insertions, 1 deletions
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)