Skip to content

fix(tui-v3): expand pasted placeholders before slash-command dispatch#586

Merged
lsdefine merged 1 commit into
lsdefine:mainfrom
nianyucatfish:fix/tui-v3-cmd-expand
Jun 9, 2026
Merged

fix(tui-v3): expand pasted placeholders before slash-command dispatch#586
lsdefine merged 1 commit into
lsdefine:mainfrom
nianyucatfish:fix/tui-v3-cmd-expand

Conversation

@nianyucatfish

Copy link
Copy Markdown
Contributor

Problem

In tui-v3, _on_enter's slash-command branch returned before the _expand() call further down ever ran. So a command argument kept the literal [Pasted text #N] / [File #N] / [Image #N] placeholder instead of the real content.

Concretely, pasting a multi-line block after a command — e.g. /morphling <pasted target> — reached the agent as the marker string [Pasted text #1 +N lines], not the pasted text. Plain (non-command) input was unaffected because it fell through to _expand().

Fix

Expand placeholders at the top of the command branch (mirroring the normal submit path), then clear the placeholder stores. No-op for commands without placeholders; self.hist still keeps the unexpanded raw input so ↑ history recall is unchanged.

Test

Verified _expand('/morphling [Pasted text #1 +4 lines]') resolves to the real multi-line content, and _cmd's split(None, 1) passes the full multi-line argument through intact.

Slash commands returned from _on_enter before _expand ran, so a command
argument carried the literal [Pasted text #N] / [File #N] / [Image #N]
placeholder instead of the real content — e.g. `/morphling <pasted
multi-line target>` reached the agent as the marker string, not the paste.

Expand placeholders at the top of the command branch (mirroring the normal
submit path) and clear the placeholder stores afterward. No-op for commands
without placeholders.

@lsdefine lsdefine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved via API.

@lsdefine lsdefine merged commit ba19018 into lsdefine:main Jun 9, 2026
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