Skip to content

fix: Preserve draft text when completing argument-taking slash commands#23950

Merged
canvrno-oai merged 6 commits into
mainfrom
canvrno/preserve_trailing_args_on_reverse_slash_command_entry
May 27, 2026
Merged

fix: Preserve draft text when completing argument-taking slash commands#23950
canvrno-oai merged 6 commits into
mainfrom
canvrno/preserve_trailing_args_on_reverse_slash_command_entry

Conversation

@canvrno-oai
Copy link
Copy Markdown
Contributor

@canvrno-oai canvrno-oai commented May 21, 2026

This adds slash command completion behavior for argument-taking commands, where text after the partially typed command becomes inline arguments instead of being discarded. This addresses the workflow of drafting text first, moving to the start, and completing a slash command around that existing draft. Before this change, this workflow would remove all user-input text aside from the slash command, which can be frustrating if the user had just typed out a long and well thought out goal.

  • Preserves the draft tail for inline-argument slash commands like /goal and /review when completing with Tab or Enter.
  • Keeps popup filtering focused on the command fragment under the cursor rather than the full draft text.
  • Leaves slash commands that do not support inline arguments unchanged, so completion still replaces the existing draft tail for those commands.
  • Adds focused TUI tests under slash input covering preserved arguments, cursor edge cases, and the negative case for a command without inline args.

Follow-up simplification and test relocation from #24683 folded into this PR.

@canvrno-oai canvrno-oai force-pushed the canvrno/preserve_trailing_args_on_reverse_slash_command_entry branch from 38c91af to f913903 Compare May 26, 2026 17:19
@canvrno-oai canvrno-oai force-pushed the canvrno/preserve_trailing_args_on_reverse_slash_command_entry branch from f913903 to 037a7c6 Compare May 26, 2026 17:59
@canvrno-oai
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@canvrno-oai canvrno-oai marked this pull request as ready for review May 26, 2026 19:55
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72f007ecd0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs
@canvrno-oai canvrno-oai changed the title Preserve draft text when completing argument-taking slash commands fix: Preserve draft text when completing argument-taking slash commands May 26, 2026
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

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

Some suggested changes that I made in a stacked PR:

  1. Simplify tests and move them out of chat_composer to keep that module from becoming obese again
  2. Generalize to support all slash commands that accept arguments

Otherwise looks good. I tested it locally.

etraut-openai and others added 2 commits May 27, 2026 10:21
## Summary
This stacks on #23950 to make draft-tail preservation reuse the existing
inline-argument slash command opt-in instead of maintaining a separate
command list.

It also moves the new completion tests out of the large chat composer
module and into slash_input.rs, where the behavior lives.
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40ee90c0ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs
Comment thread codex-rs/tui/src/bottom_pane/chat_composer/slash_input.rs
@canvrno-oai canvrno-oai merged commit 8fcf2ad into main May 27, 2026
37 of 39 checks passed
@canvrno-oai canvrno-oai deleted the canvrno/preserve_trailing_args_on_reverse_slash_command_entry branch May 27, 2026 18:05
@github-actions github-actions Bot locked and limited conversation to collaborators May 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants