Skip to content

feat(input): add optional per-field Literal typing mode - #574

Closed
AsafMah wants to merge 1 commit into
LeanBitLab:mainfrom
AsafMah:asafmah-upstream-literal-typing
Closed

AsafMah wants to merge 1 commit into
LeanBitLab:mainfrom
AsafMah:asafmah-upstream-literal-typing

Conversation

@AsafMah

@AsafMah AsafMah commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Add an optional Literal typing action for URLs, code, and other text that should stay as typed. Enable the action in Settings → Toolbar → Toolbar keys or Pinned toolbar keys; it is not forced into existing enabled layouts. Tap once to enable it for the current field, and again to restore normal typing. Custom layouts can use {"label":"literal"} or keycode -10078 (TOGGLE_LITERAL_MODE).

The state belongs to the active LatinIME/editor session, not saved preferences. New fields, input finish, and service destruction reset it; hiding the keyboard and identifiable same-editor restarts retain it. Ambiguous zero-ID restarts reset conservatively.

Behavior

  • Suppress automatic capitalization (including Force), correction (including per-app force-enable), predictions/application completions, automatic spacing and double-space periods, text expansions, dictionary learning, and word-glide typing.
  • Preserve explicitly typed case/manual Shift, script composition such as Hangul, editing actions, paste, emoji insertion, and the editor's Enter action. This does not globally disable editing gestures.
  • Finish pending composition as typed on toggle, without correction or cursor movement; clear pending automatic-spacing state and reject stale worker/UI suggestion results, including on → off races.
  • Keep toolbar and pinned activation in sync without a preference event; the existing auto-correction action reflects the effective setting. Stored typing preferences and learned history are not changed or deleted; in particular, personalized dictionaries are not disabled to suppress learning.

This is an explicit optional mode, not automatic URL/code detection or a general fix for unknown capitalization/contraction behavior. No changes to RichInputConnection, contraction ranking, GIF/media support, platform dependencies, or minSDK.

Validation

On JDK 21 with the existing Android SDK, the focused :app:testStandardDebugUnitTest run passed: 107 passed, 1 existing ignored Hangul test. Scope: all 100 InputLogic tests (99 passed), both new Literal JSON/numeric/popup parser cases, the existing toolbar-popup parser case, and 5 settings tests. The Literal cases exercise actual owner lifecycle/reset/destroy, settings reload and per-app forced correction, composing text/cursor preservation, Hangul, explicit case/paste/emoji/TLD text, toolbar+pinned click dispatch/activation, learning suppression, and queued/running stale-result rejection.

A broader run also executed all ParserTest cases: 8 existing layout-asset lookup failures (NoSuchElementException in LayoutUtils.getContent). All eight were reproduced with the same method names and messages on an untouched detached checkout of base b718d832c41ba01e1cce613f14e6209c279e9d17 (46 parser tests at base; 48 with this feature). No tests, baselines, or production asset behavior were relaxed to hide them. No APK build, native-glide library execution, or phone/device testing is claimed.

Port scope

One independent commit on upstream b718d832c41ba01e1cce613f14e6209c279e9d17, adapted from source feature 998dbcb56591dc1b0cc2f8ebb828c816dade186a. All added/removed production lines match that immutable feature exactly. Port-only adjustments: omit the fork-only row-swipe test; add its missing expansion-test setup helper/import using existing upstream APIs; add two focused Literal parser tests and usage/keycode documentation. No other fork commits or sibling PRs are required.

Keep composition and explicit editing while suppressing automatic assistance, expansion, learning and stale suggestion delivery. Share optional toolbar, pinned and JSON controls without changing stored preferences.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@AsafMah AsafMah closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant