Skip to content

Fix dupchar#114

Open
nindanaoto wants to merge 4 commits intoconnectbot:mainfrom
nindanaoto:fix_dupchar
Open

Fix dupchar#114
nindanaoto wants to merge 4 commits intoconnectbot:mainfrom
nindanaoto:fix_dupchar

Conversation

@nindanaoto
Copy link
Contributor

Fix on-screen keyboards duplicating every character (connectbot/connectbot#1955)

  • super.commitText() internally calls finishComposingText(), which cleared composingText before the backspace guard in commitText() could execute — causing composed text to be sent twice
  • Save composingText before calling super.commitText() so the backspace guard correctly removes the previously composed text

Test plan

  • testCommitAfterComposingDoesNotDuplicate
  • testMultiCharComposingCommitDoesNotDuplicate
  • testDirectCommitWithoutComposing

nindanaoto and others added 3 commits March 22, 2026 00:29
Tests verify that the compose→commit IME flow does not produce
duplicate characters on the terminal screen (issue connectbot/connectbot#1955).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
super.commitText() internally calls finishComposingText(), which
cleared composingText before the backspace guard could execute.
This caused composed text to be sent during setComposingText() and
then sent again by commitText() without erasing the first copy.

Save composingText before calling super.commitText() so the
backspace guard correctly removes the previously composed text.

Fixes connectbot/connectbot#1955

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The tests created a TerminalEmulator with a no-op onKeyboardInput
callback, so dispatched characters were never echoed back to the
terminal display, resulting in blank screen output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of looping keyboard output back into writeInput (which
doesn't handle BS/DEL correctly since VT100 cursor-back doesn't
erase characters), capture the onKeyboardInput bytes and compute
the effective text by applying BS/DEL as erasure operations.

Also set isComposeModeActive=true so BaseInputConnection uses
fullEditor mode (no duplicate key event dispatch from commitText).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nindanaoto
Copy link
Contributor Author

Now CI is passing.

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