Skip to content

Handle IME edit-panel actions (select all, copy, cut, paste) on Android - #491

Merged
Tryanks merged 1 commit into
mainfrom
fix/android-ime-context-menu-actions
Sep 21, 2026
Merged

Tryanks merged 1 commit into
mainfrom
fix/android-ime-context-menu-actions

Conversation

@Tryanks

@Tryanks Tryanks commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Problem

On Android, the select-all / paste / copy / cut buttons on the keyboard's edit panel did nothing in the input box. IMEs deliver those buttons through InputConnection.performContextMenuAction, and BaseInputConnection leaves that method as a no-op returning false.

Change

  • GpuiInputConnection implements performContextMenuAction for selectAll, copy, cut and paste against the shared Editable, and publishes the resulting state like any other IME edit. Paste goes through commitText, so the key-oriented (non-editable) path still reaches nativeCommitText.
  • Clipboard access goes through a small Clipboard seam; the activity wires it to the existing gpuiReadClipboard / gpuiWriteClipboard.
  • Instrumented test testImeEditPanelActionsEditTheDraftAndClipboard covers all four actions with a fake clipboard.

Verification

  • ./gradlew :app:compileDebugJavaWithJavac :app:compileDebugAndroidTestJavaWithJavac passes.
  • No device was attached, so the instrumented test and on-phone behaviour were not exercised in this run.

BaseInputConnection.performContextMenuAction is a no-op that returns false,
so the select-all / paste / copy / cut buttons on Android keyboards' edit
panels never reached the draft. Implement it on GpuiInputConnection against
the shared Editable and publish the resulting state like any other IME edit.
Clipboard access goes through a small seam so the instrumented test covers
paste without touching the system clipboard.
@Tryanks
Tryanks merged commit 65d510b into main Sep 21, 2026
7 checks passed
@Tryanks
Tryanks deleted the fix/android-ime-context-menu-actions branch September 21, 2026 01:39
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