From 3081af5190b370409d858dc33f6dae00f84f2fd6 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 24 Sep 2022 22:36:06 +0200 Subject: Improve the auto capitalisation - Detect when the input box is cleared - Avoid looking up keys on the keyboard every time the shift state needs to change. --- srcs/juloo.keyboard2/Autocapitalisation.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'srcs/juloo.keyboard2/Autocapitalisation.java') diff --git a/srcs/juloo.keyboard2/Autocapitalisation.java b/srcs/juloo.keyboard2/Autocapitalisation.java index 1a339e0..2493771 100644 --- a/srcs/juloo.keyboard2/Autocapitalisation.java +++ b/srcs/juloo.keyboard2/Autocapitalisation.java @@ -108,6 +108,13 @@ final class Autocapitalisation { if (new_cursor == _cursor) // Just typing return; + if (new_cursor == 0) + { + // Detect whether the input box has been cleared + CharSequence t = _ic.getTextAfterCursor(1, 0); + if (t != null && t.equals("")) + _should_update_caps_mode = true; + } _cursor = new_cursor; _should_enable_shift = false; callback(true); -- cgit v1.2.3