Skip to content

android: the keyboard keeps the text before the caret on reconnect - #1210

Merged
fizzy-publish[bot] merged 1 commit into
mainfrom
android/ime-keeps-prefix
Nov 11, 2026
Merged

fizzy-publish[bot] merged 1 commit into
mainfrom
android/ime-keeps-prefix

Conversation

@fizzy-publish

@fizzy-publish fizzy-publish Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

android: the keyboard keeps the text before the caret on reconnect

In plain words

On an Android phone, when fizzy changed a text box itself (cleared it, or you tapped to move the
caret), the keyboard started over as if the box were empty. Its suggestions and its backspace then
worked on the wrong text. Now the keyboard picks up from the text that is really before the caret.

What changes

  • When the keyboard connects again, fizzy now reads what the old connection held before the
    keyboard library replaces it, instead of after, when it is already gone.
  • The keyboard's debug trace is built only when it is switched on, and a backspace now logs both
    its press and its release.
// android/src/org/libsdl/app/FizzyEdit.java, onCreateInputConnection
String before = ic instanceof FizzyInputConnection ? ((FizzyInputConnection) ic).mCommittedText : null;
super.onCreateInputConnection(out); // fills out (and replaces ic)
FizzyInputConnection fic = new FizzyInputConnection(this);
seed(fic, before == null ? "" : before);

What you will notice

Type hello in a text box on an Android phone, tap after the o, and keep typing: the keyboard's
suggestions and corrections continue from hello instead of from nothing. Nothing changes on
desktop or the web.

How we know it works

The cause is read from SDL's own source: its keyboard connection replaces the old one first thing,
so fizzy's code, which looked at the old one afterwards, always found an empty one. The app builds;
the Android package build (which compiles this Java) and the check on a real phone are run after
this page, by the maintainer and QA: with the trace on, the line after reset("hello") must end in
-> "hello…", and a backspace logs sendKeyEvent(DEL down) and sendKeyEvent(DEL up).

How this serves fizzy

Platform: typing on an
Android phone behaves like typing anywhere else.

Part of fizzyedit/work#1181

Closes fizzyedit/work#1137
Closes fizzyedit/work#1133

For agents: technical summary

Goal

SDL 3.4.16's SDLDummyEdit.onCreateInputConnection starts with ic = new SDLInputConnection(this, true);.
FizzyEdit called super first, so ic was always SDL's plain connection, before was null and
the new connection was seeded with "". reset() seeded the old connection and then
restartInput made the keyboard ask again, landing here and dropping it.

What changed and why

  • FizzyEdit.onCreateInputConnection: read before from ic before calling super; comment says why.
  • FizzyInputConnection: log became tracing() (static, Log.isLoggable(TAG, VERBOSE)) and
    trace(call) (Log.v); each caller writes if (tracing()) trace(...), so no string is built
    with the trace off.
  • sendKeyEvent: the trace moved out of the ACTION_DOWN branch to just before return true,
    logging DEL down / DEL up. Edit logic unchanged; reset's Log.i unchanged.

Diff: 14 added, 10 deleted, one file.

How it was verified

scripts/zb build: passes. The apk gate (scripts/zb build apk -Dandroid-sdk=$ANDROID_HOME, the
only step that runs javac) was not run in the slot, per the job (no debug keystore); the PM/Ops
run it before approval. Phone trace (Spec 5) is QA after merge.

Not done / follow-ups

  • Signed APK build and the lab-phone trace (adb shell setprop log.tag.fizzy-ime VERBOSE).

Part of fizzyedit/work#1181

Signed-off-by: fizzy pop-os-claude-1 <slot+pop-os-claude-1@fizzy.invalid>
@fizzy-publish fizzy-publish Bot added kind:claude agent kind that wrote the PR (new workflow) area:android write lock: files of this area labels Nov 11, 2026
@fizzy-ops fizzy-ops Bot added the pm:review one assigned reviewer reviews label Nov 11, 2026
@fizzy-ops

fizzy-ops Bot commented Nov 11, 2026

Copy link
Copy Markdown

TRIAGE @b9e8e60a auto: mechanical rules met (fizzy-* app author, names work#1181, 24 non-test lines <= 400, no risky path). Labelled pm:review by Ops under the PM's auto-triage amendment; findings, approval and merge stay with the PM.

@fizzy-publish
fizzy-publish Bot enabled auto-merge November 11, 2026 16:09
@fizzy-pm

fizzy-pm Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Where this PR stands

Stage: Done: approved
Next: Waiting for the merge queue

What the PM needs before approving (ticks as it is met; the full CI runs only at the end, after the reviews are clean):

  • The body names its basis (Part of fizzyedit/work#N or a plan step)
  • Within the size limit: 24 of 800 lines outside tests and docs
  • The body shows which gates the author ran
  • No open findings at this commit
  • Every earlier finding was answered in a FIXES comment
  • Clean reviews at this commit from 1 kind: slot/codex (has 1)
  • Marked ready, which starts the full CI (the PM does this the moment the items above are met)
  • The full CI passes at this commit (CI is green)
  • The PM's final okay (pm-approval)

Reviews at the current commit (b9e8e60):

Reviewer Verdict Findings
slot/codex clean none

Updated 2026-11-11 17:15 UTC by the PM. This comment is edited in place.

@fizzy-pm fizzy-pm Bot added reviewer:linux-codex the PM assigned linux/codex to review this PR and removed pm:review one assigned reviewer reviews reviewer:linux-codex the PM assigned linux/codex to review this PR labels Nov 11, 2026
@fizzy-publish
fizzy-publish Bot added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 146a2f0 Nov 11, 2026
49 of 53 checks passed
@fizzy-publish
fizzy-publish Bot deleted the android/ime-keeps-prefix branch November 11, 2026 17:34

This branch was successfully deployed

1 active deployment
bridge — b9e8e60a Deployed Nov 11, 2026 by fizzy-publish[bot] via bridge #4849
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:android write lock: files of this area kind:claude agent kind that wrote the PR (new workflow)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants