From f082fcdebc4f129cd262ee4a0a6b83d91fde72bb Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 16 Aug 2025 18:48:00 +0200 Subject: Track the currently typed word The `CurrentlyTypedWord` class tracks the word that is being typed. It's implemented on the same model as Autocapitalisation and avoid expensive IPC calls when possible. The `Suggestions` class is where the suggestion lookup should go. It currently just echoes the current word. --- srcs/juloo.keyboard2/EditorConfig.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'srcs/juloo.keyboard2/EditorConfig.java') diff --git a/srcs/juloo.keyboard2/EditorConfig.java b/srcs/juloo.keyboard2/EditorConfig.java index d9f1ae9..bdfab3c 100644 --- a/srcs/juloo.keyboard2/EditorConfig.java +++ b/srcs/juloo.keyboard2/EditorConfig.java @@ -26,6 +26,11 @@ public final class EditorConfig // Whether caps state should be updated right away. public boolean caps_initially_updated = false; + /** CurrentlyTypedWord. */ + public CharSequence initial_text_before_cursor = null; + public int initial_sel_start; + public int initial_sel_end; + public EditorConfig() {} public void refresh(EditorInfo info, Resources res) @@ -66,6 +71,10 @@ public final class EditorConfig caps_mode = info.inputType & TextUtils.CAP_MODE_SENTENCES; caps_initially_enabled = (info.initialCapsMode != 0); caps_initially_updated = caps_should_update_state(info); + /* CurrentlyTypedWord */ + initial_text_before_cursor = info.getInitialTextBeforeCursor(10, 0); + initial_sel_start = info.initialSelStart; + initial_sel_end = info.initialSelEnd; } String actionLabel_of_imeAction(int action, Resources res) -- cgit v1.2.3