Skip to content

fix(agent): preserve IME composition on Enter - #116

Open
LIU-JUNYANG wants to merge 1 commit into
Solsynth:masterfrom
LIU-JUNYANG:codex/fix-agent-ime-enter
Open

LIU-JUNYANG wants to merge 1 commit into
Solsynth:masterfrom
LIU-JUNYANG:codex/fix-agent-ime-enter

Conversation

@LIU-JUNYANG

@LIU-JUNYANG LIU-JUNYANG commented Nov 4, 2026 •

Copy link
Copy Markdown

Summary

  • Leave Enter and Shift+Enter unhandled by the agent composer's keyboard shortcut while the text controller has an active, non-collapsed IME composing range.
  • Preserve ordinary Enter-to-send and Shift+Enter-to-insert-a-newline after composition ends.
  • Add widget regressions for composing Enter, composing Shift+Enter, Enter after committing the text, and a collapsed composing range.

Problem

A user reported that typing English with a Chinese input method on macOS and pressing Return to confirm the text also sends the message. The report is from 3.0.0+49; the same keyboard handler is present on current master (3.0.0+50).

AgentComposer._handleKeyEvent previously treated every Enter key-down without Shift as a submit, without checking the text controller's composing state. The new check runs before either submitting or inserting a newline, so the composer does not consume Enter while composition is active.

Validation

  • The new composing-Enter regression failed before the fix: expected zero submissions, observed one.
  • dart format --output=none --set-exit-if-changed lib/agent/agent_composer.dart test/agent_composer_test.dart: passed.
  • flutter test --no-pub test/agent_composer_test.dart: 17 passed.
  • flutter test --no-pub --reporter expanded: 1,077 passed, 1 skipped, exit 0.
  • flutter analyze --no-pub: exit 1 with three existing deprecated_member_use info diagnostics in lib/data/local/app_database.g.dart:15723 and lib/servers/maidcafe_push.dart:300,345; none in the changed files.
  • git diff --check: passed.

The widget tests simulate IME composing state and keyboard events. The patched application has not been manually tested with a native macOS Chinese input method, so native IME event ordering and the original GUI reproduction still need confirmation. This change is limited to the composer's keyboard handler; it does not change the text-input action callback.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

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.

2 participants