Repository navigation
fix: prevent auto-caps errors with unavailable text cache - #664
Conversation
When the keyboard connects to a new or transient input field, the text cache may be temporarily unavailable. Previously, this caused the caps mode to default to CAP_MODE_OFF, breaking auto-capitalization in fast switching or autofill scenarios. This commit updates `RichInputConnection.getCursorCapsMode` to use `EditorInfo.initialCapsMode` as a fallback when `getTextBeforeCursor` or `reloadTextCache` fails, properly inheriting the app's requested capitalization. Also fixes a batch edit nesting error log spam and ensures that caps mode is explicitly reset for transient `TYPE_NULL` focus events to prevent stale state leaking across apps.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Fixes an issue where auto-capitalization fails due to a race condition / unavailable text cache during rapid app switching, Autofill insertions, or transient fields. Fallback caps mode logic was updated to rely on EditorInfo correctly.
💡 What
RichInputConnection.getCursorCapsModeto correctly useEditorInfo.initialCapsModeas the fallback when the text cache is not immediately available.LatinIME.onStartInputViewInternalto properly reset the Caps State toCAP_MODE_OFFfor transientTYPE_NULLinput fields.Log.eon closing Batch edits when the nest level is already 0.🔍 Verification
Ran
gradlew :app:testStandardDebugUnitTest --tests "*RichInputConnection*"and observed no crashes or side effects. Verified the fallback properly evaluatesei?.initialCapsMode.📦 Impact
Users will no longer experience incorrect lowercase-by-default behavior immediately after focusing a text field when the input connection text cache is lagging. Reduces aggressive bug-report-like logging in Logcat during generic text operations.
PR created automatically by Jules for task 5380252126256777111 started by @LeanBitLab