Skip to content

macos: send all insertText commits as key events - #13817

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
sghng:dictation-commit-key-events
Aug 15, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
sghng:dictation-commit-key-events

Conversation

@sghng

@sghng sghng commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Partially addresses #13796. Extends #13222.

Previously, insertText commits without marked text were delivered via
sendText, which applies paste semantics and wraps the text in bracketed
paste when the program enables it. macOS dictation and other input
methods often commit without marked text, so programs treated dictated
text as a paste: opencode collapsed it into a "[Pasted ~N lines]" chip
and Neovim applied paste-mode handling.

insertText is only invoked by input methods (IME, dictation, emoji
picker, character viewer); real paste operations use a separate path.
Every non-empty commit is now sent as a key event — the same path
already used for preedit commits since #13222 — so input method text
always arrives as typed input.

Typing is unaffected (the accumulator path returns earlier) and Cmd+V
pastes are unaffected. committedPreeditTextAction is renamed to
committedTextAction since it no longer only handles preedit commits.

Testing:

  • 311 macOS unit tests pass.
  • Manually verified on macOS 26: dictation into Opencode and Neovim
    arrives inline with no paste handling; emoji picker inserts inline;
    Chinese IME composition unchanged; dictation in Neovim normal mode now
    behaves as keystrokes, matching Terminal.app.

Notes:

  • Dictated "new line" now matches Terminal.app behavior (no newline
    with typed-text semantics). The previous behavior came from the paste
    path preserving the newline; a follow-up could deliver it as an
    Enter keypress if desired.

AI usage: drafted with OMO + OpenCode + DeepSeek V4 Pro assistance;
reviewed, edited, and manually tested by the author.

Previously, insertText commits without marked text were delivered via
sendText, which applies paste semantics and wraps the text in bracketed
paste when the program enables it. macOS dictation and other input
methods often commit without marked text, so programs treated dictated
text as a paste and applied paste-specific handling.

insertText is only invoked by input methods (IME, dictation, emoji
picker, character viewer); real paste operations use a separate path.
Send every non-empty commit through the key event path so programs
interpret input method text as typed input. Typing is unaffected (the
accumulator path returns earlier) and Cmd+V pastes are unaffected.

The helper is renamed from committedPreeditTextAction to
committedTextAction since it no longer only handles preedit commits.
@sghng
sghng requested a review from a team as a code owner August 14, 2026 15:38
@ghostty-bot ghostty-bot Bot added the os/macos label Aug 14, 2026

@bo2themax bo2themax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me.

@mitchellh
mitchellh merged commit 9009122 into ghostty-org:main Aug 15, 2026
101 checks passed
@github-actions github-actions Bot added this to the 1.4.0 milestone Aug 15, 2026
@sghng
sghng deleted the dictation-commit-key-events branch August 15, 2026 21:51
mitchellh added a commit that referenced this pull request Aug 24, 2026
Discussion #13979

Dropped paths and text once again honor bracketed paste mode. IME,
dictation, emoji picker, and character viewer commits remain typed
input.

sendText calls ghostty_surface_text, which applies the clipboard paste
pipeline and bracketed paste framing when enabled. Separating the paths
at the drag-and-drop caller preserves the input-method behavior
introduced by #13817.
pull Bot pushed a commit to cianfox/ghostty that referenced this pull request Aug 24, 2026
Discussion ghostty-org#13979

Dropped paths and text once again honor bracketed paste mode.
IME, dictation, emoji picker, and character viewer commits remain typed input.

sendText calls ghostty_surface_text, which applies the clipboard paste
pipeline and bracketed paste framing when enabled. Separating the
paths at the drag-and-drop caller preserves the input-method behavior
introduced by ghostty-org#13817.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants