fix(composer): badge a slash word only when it is a real command - #727
Open
Adam-Dalloul wants to merge 1 commit into
Open
fix(composer): badge a slash word only when it is a real command#727Adam-Dalloul wants to merge 1 commit into
Adam-Dalloul wants to merge 1 commit into
Conversation
A bare `/word` became a command badge on shape alone. The composer fills itself from text in several places -- a paste, a restored draft, a quick message, a reopened queued message, a to-do brief -- and every one of them ran the same heuristic: start of line or after a space, `/` or `$`, a letter, no trailing slash. `/notacommand`, `/etc`, `/nope` all passed, and the user had picked none of them from the menu. What came back was an atomic node: the word could no longer be edited in place, its `/` was gone from the label, and its text was rebuilt on send from the badge's id rather than kept -- which for an id the serializer has to escape (`/foo_`) is not even the same bytes. A badge now requires the token to be one the agent advertises right now, matched exactly: the tokens behind the `/` and `$` menus themselves, so what seeded text may become is precisely what the menu could have inserted. `/rev` is not `/review`, `/Review` is not `/review` (the CLI reads the name it advertised), and with no list yet -- the connection still coming up, or no agent behind the box at all -- nothing is badged. That direction is the safe one: text that stays text is still editable and still sends verbatim. Picking from the menu is untouched, trailing space included, as are badges already in the document; a list that lands mid-compose applies to the next paste and rewrites nothing already written. Reference links keep hydrating regardless -- a `file:`/`codeg:` destination was inserted deliberately and says so. The transcript keeps the heuristic on its own: a sent message is fixed text, and gating it on a list that comes and goes with the connection would re-badge history underneath the reader.
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.
Typing
/and a word made it a slash command: text the composer fills itself with (a paste, a restored draft, a quick message, a reopened queued message, a to-do brief) turned any/wordinto a command badge on shape alone, whether or not the agent had such a command and whether or not anyone picked it from the menu.A badge now needs the token to be one the agent advertises right now, matched exactly, drawn from the same lists behind the
/and$menus./revis not/review;/Reviewis not/review, since the CLI reads the name it advertised. With no list yet (connection still coming up, or no agent behind the box) nothing is badged, which is the safe direction.What a badge changes about the message: its text is rebuilt on send from the badge's id rather than carried through, so an id the serializer has to escape (
/foo_) goes out as/foo\_. Plain text goes out exactly as written, and stays editable in place instead of becoming one atomic node whose/is hidden.Unchanged: picking from the menu with Enter, Tab or a click, including the trailing space; badges already in the document, which a list arriving mid-compose never rewrites;
file:/codeg:reference links, which hydrate regardless because they were inserted deliberately; and the sent-message transcript, where the text is already fixed.