From a1d0342033460a13407deb27cac3ed5ad13ab47f Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 12 Apr 2026 14:33:27 +0200 Subject: Better spell check with cursor in the middle of a word (#1233) * Better spell check with cursor in the middle of a word Suggestions are based on the entire word and no longer the part of the word just before the cursor. Also, tapping a suggestion or the space bar autocorrect replaces the entire word. * Reduce the number of calls to refresh_current_word While the cursor moves, calls to refresh_current_word are now only done when the cursor exits the current word.--- srcs/juloo.keyboard2/EditorConfig.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'srcs/juloo.keyboard2/EditorConfig.java') diff --git a/srcs/juloo.keyboard2/EditorConfig.java b/srcs/juloo.keyboard2/EditorConfig.java index a198775..fa6a9dd 100644 --- a/srcs/juloo.keyboard2/EditorConfig.java +++ b/srcs/juloo.keyboard2/EditorConfig.java @@ -32,6 +32,7 @@ public final class EditorConfig /** CurrentlyTypedWord. */ public CharSequence initial_text_before_cursor = null; // Might be [null]. + public CharSequence initial_text_after_cursor = null; // Might be [null]. public int initial_sel_start; public int initial_sel_end; @@ -92,7 +93,10 @@ public final class EditorConfig caps_initially_updated = caps_should_update_state(info); /* CurrentlyTypedWord */ if (VERSION.SDK_INT >= 30) - initial_text_before_cursor = info.getInitialTextBeforeCursor(10, 0); + { + initial_text_before_cursor = info.getInitialTextBeforeCursor(20, 0); + initial_text_after_cursor = info.getInitialTextAfterCursor(20, 0); + } initial_sel_start = info.initialSelStart; initial_sel_end = info.initialSelEnd; /* Suggestions */ -- cgit v1.2.3