fix(tui-v3): expand pasted placeholders before slash-command dispatch#586
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In tui-v3,
_on_enter's slash-command branchreturned 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.histstill 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'ssplit(None, 1)passes the full multi-line argument through intact.