diff --git a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java
index 6c221323e..4ac354a4d 100644
--- a/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java
+++ b/app/src/main/java/helium314/keyboard/latin/inputlogic/InputLogic.java
@@ -988,12 +988,21 @@ private void enterCombiningMode(final SettingsValues settingsValues, final boole
final int graceMs = baseGraceMs + Math.max(0, settingsValues.mCombiningTapExtraMs);
cancelCombiningTimerOnly();
mInCombiningMode = true;
+ // #14 "only auto-finish swiped words": still ENTER combining mode (so a following swipe
+ // can extend this word), but DON'T arm the auto-commit timer for a pure tap word — it
+ // stays open until the user commits. A tap-then-swipe still arms: the gesture re-enters
+ // here with fromTap=false and the fragment present, so it arms then.
+ final boolean armTimer = !(fromTap && settingsValues.mCombiningGraceOnlyAfterGesture
+ && !mCombiningWordHasGestureFragment && !mWordComposer.isBatchMode());
final long startTime = SystemClock.uptimeMillis();
- mPendingCombiningCommit = () -> onCombiningGraceExpired();
- mCombiningHandler.postDelayed(mPendingCombiningCommit, graceMs);
+ if (armTimer) {
+ mPendingCombiningCommit = () -> onCombiningGraceExpired();
+ mCombiningHandler.postDelayed(mPendingCombiningCommit, graceMs);
+ }
final MainKeyboardView kv = KeyboardSwitcher.getInstance().getMainKeyboardView();
if (kv != null) {
- final boolean showAutospaceIndicator = settingsValues.shouldInsertSpacesAutomatically()
+ final boolean showAutospaceIndicator = armTimer
+ && settingsValues.shouldInsertSpacesAutomatically()
&& settingsValues.mSpacingAndPunctuations.mCurrentLanguageHasSpaces
&& (!settingsValues.mCombiningAutospaceOnlyAfterGesture
|| mCombiningWordHasGestureFragment)
@@ -1309,6 +1318,12 @@ private void onCombiningGraceExpired() {
mBackspaceUnits.setCommitted(writtenChars, committedFragments);
}
// "keep_alternatives" — fall through, do nothing.
+ // #14 bug fix: this commit ran on the async grace timer, OFF the normal onCodeInput path
+ // that refreshes the shift state after a commit. Without this, the next word's auto-caps
+ // is stale — auto-caps gets dropped after a grace auto-commit and capitalization comes out
+ // erratic. Mirror the gesture-commit path's requestUpdatingShiftState.
+ KeyboardSwitcher.getInstance().requestUpdatingShiftState(
+ getCurrentAutoCapsState(sv), getCurrentRecapitalizeState());
}
/**
diff --git a/app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt b/app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt
index 0dd8647b9..c0e875464 100644
--- a/app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt
+++ b/app/src/main/java/helium314/keyboard/latin/settings/Defaults.kt
@@ -150,6 +150,7 @@ object Defaults {
const val PREF_COMBINING_TAP_EXTRA_MS = 250
const val PREF_COMBINING_AUTOSPACE_ONLY_AFTER_GESTURE = false
const val PREF_SPACING_DEFER_GRACE_SPACE = false
+ const val PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE = true // default on: tapped words shouldn't auto-finish
const val PREF_COMBINING_AUTOSPACE_SUGGESTIONS = "alternatives_then_next_word"
const val PREF_COMBINING_BACKSPACE_DELETES_GESTURE_WORD = true
const val PREF_COMBINING_BACKSPACE_DELETES_COMPOSING_TEXT = true
diff --git a/app/src/main/java/helium314/keyboard/latin/settings/Settings.java b/app/src/main/java/helium314/keyboard/latin/settings/Settings.java
index 75edd6b6c..cf89a5379 100644
--- a/app/src/main/java/helium314/keyboard/latin/settings/Settings.java
+++ b/app/src/main/java/helium314/keyboard/latin/settings/Settings.java
@@ -160,6 +160,9 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
// #23: route the two-thumb grace-mode auto-commit space through the deferred PHANTOM
// mechanism (like the default gesture path) instead of writing it eagerly. Experimental.
public static final String PREF_SPACING_DEFER_GRACE_SPACE = "spacing_defer_grace_space";
+ // #14: when on, the combining grace timer only auto-commits words that include a swipe —
+ // pure tap-typed words are never auto-finished by the timer. Experimental, default off.
+ public static final String PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE = "combining_grace_only_after_gesture";
// What the suggestion strip shows after the combining grace timer auto-commits a word.
// Values: "keep_alternatives" (1) | "next_word" (2, default) | "alternatives_then_next_word" (3).
public static final String PREF_COMBINING_AUTOSPACE_SUGGESTIONS = "combining_autospace_suggestions";
diff --git a/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java b/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java
index ae1e4e17f..95efd7756 100644
--- a/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java
+++ b/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java
@@ -138,6 +138,7 @@ public class SettingsValues {
public final int mCombiningTapExtraMs;
public final boolean mCombiningAutospaceOnlyAfterGesture;
public final boolean mSpacingDeferGraceSpace;
+ public final boolean mCombiningGraceOnlyAfterGesture;
// Raw string value: "keep_alternatives" | "next_word" | "alternatives_then_next_word"
public final String mCombiningAutospaceSuggestions;
public final boolean mCombiningBackspaceDeletesGestureWord;
@@ -386,6 +387,9 @@ public SettingsValues(final Context context, final SharedPreferences prefs, fina
mSpacingDeferGraceSpace = prefs.getBoolean(
Settings.PREF_SPACING_DEFER_GRACE_SPACE,
Defaults.PREF_SPACING_DEFER_GRACE_SPACE);
+ mCombiningGraceOnlyAfterGesture = prefs.getBoolean(
+ Settings.PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE,
+ Defaults.PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE);
mCombiningAutospaceSuggestions = prefs.getString(Settings.PREF_COMBINING_AUTOSPACE_SUGGESTIONS,
Defaults.PREF_COMBINING_AUTOSPACE_SUGGESTIONS);
final boolean nonNormalTwoThumbSpacing = mGestureManualSpacing || mCombiningGraceMs > 0;
diff --git a/app/src/main/java/helium314/keyboard/settings/screens/TwoThumbTypingScreen.kt b/app/src/main/java/helium314/keyboard/settings/screens/TwoThumbTypingScreen.kt
index 9469bddc4..e73389788 100644
--- a/app/src/main/java/helium314/keyboard/settings/screens/TwoThumbTypingScreen.kt
+++ b/app/src/main/java/helium314/keyboard/settings/screens/TwoThumbTypingScreen.kt
@@ -70,6 +70,7 @@ fun TwoThumbTypingScreen(
add(Settings.PREF_COMBINING_AUTOCORRECT_ON_AUTOSPACE)
add(Settings.PREF_COMBINING_AUTOSPACE_SUGGESTIONS)
add(Settings.PREF_SPACING_DEFER_GRACE_SPACE)
+ add(Settings.PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE)
}
if (nonNormalSpacing) {
add(Settings.PREF_MULTIPART_FULL_WORD_SUGGESTIONS)
@@ -152,6 +153,11 @@ fun createTwoThumbTypingSettings(context: Context) = listOf(
R.string.spacing_defer_grace_space_summary) {
SwitchPreference(it, Defaults.PREF_SPACING_DEFER_GRACE_SPACE)
},
+ Setting(context, Settings.PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE,
+ R.string.combining_grace_only_after_gesture,
+ R.string.combining_grace_only_after_gesture_summary) {
+ SwitchPreference(it, Defaults.PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE)
+ },
Setting(context, Settings.PREF_COMBINING_AUTOSPACE_SUGGESTIONS,
R.string.combining_autospace_suggestions, R.string.combining_autospace_suggestions_summary) { def ->
val items = listOf(
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9948cff76..82e563c1c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -294,11 +294,15 @@
Extra autospace delay after taps
Add this much extra time when the last input was a tapped letter, so tap-then-swipe combinations are easier to continue.
Only auto-space after swipes
- When enabled, tap-only words are committed without an automatic space. Words that include a swipe still auto-space.
+ Controls the automatic space only \u2014 not whether a word commits. When on, a tap-only word still commits but without an auto-space; swiped words still get one.
Defer grace space (experimental)
Route the two-thumb grace auto-commit space through the deferred mechanism (like the default swipe path) instead of writing it immediately. The space appears on your next input and stays backspace-reversible.
+
+ Only auto-finish swiped words
+
+ The pause timer auto-commits a word only when it includes a swipe. Words you tap out stay open until you press space or pick a suggestion, so tapped shortcuts and corrections won\'t fire early. On by default \u2014 this controls whether the word commits (the auto-space option above only controls the trailing space).
Backspace deletes last swipe
diff --git a/app/src/test/java/helium314/keyboard/settings/SettingsContainerTest.kt b/app/src/test/java/helium314/keyboard/settings/SettingsContainerTest.kt
index 24fb0054b..30451afb7 100644
--- a/app/src/test/java/helium314/keyboard/settings/SettingsContainerTest.kt
+++ b/app/src/test/java/helium314/keyboard/settings/SettingsContainerTest.kt
@@ -66,6 +66,12 @@ class SettingsContainerTest {
container[Settings.PREF_SPACING_DEFER_GRACE_SPACE]?.key)
}
+ @Test
+ fun combiningGraceOnlyAfterGestureSettingIsRegistered() {
+ assertEquals(Settings.PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE,
+ container[Settings.PREF_COMBINING_GRACE_ONLY_AFTER_GESTURE]?.key)
+ }
+
@Test
fun twoThumbLowLevelBackspaceSettingIsHiddenFromSearchRegistry() {
assertNull(container[Settings.PREF_COMBINING_BACKSPACE_DELETES_GESTURE_WORD])