Skip to content

Conversation

@sayan-oai
Copy link

Add ctrl+g shortcut to enable opening current prompt in configured editor ($VISUAL or $EDITOR).

  • Prompt is updated with editor's content upon editor close.
  • Paste placeholders are automatically expanded when opening the external editor, and are not "recompressed" on close
    • They could be preserved in the editor, but it would be hard to prevent the user from modifying the placeholder text directly, which would drop the mapping to the pending_paste value
  • Image placeholders stay as-is
  • ctrl+g explanation added to shortcuts menu, snapshot tests updated
Screen.Recording.2025-12-04.at.12.41.42.PM.mov

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@sayan-oai
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Dec 4, 2025
@sayan-oai
Copy link
Author

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ 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".

@etraut-openai
Copy link
Collaborator

@sayan-oai, looks like there are a few lint (cargo clippy) errors to fix.

@sayan-oai sayan-oai marked this pull request as draft December 4, 2025 21:35
tracing::warn!("failed to restore terminal modes before editor: {err}");
}

let editor_result = editor::run_editor(&seed, &editor_cmd).await;
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does this look like if EDITOR="code --wait"?

Copy link
Author

Choose a reason for hiding this comment

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

I tested this, it opens a window as expected, and the text propagates back to the composer on save+close.

Copy link
Collaborator

Choose a reason for hiding this comment

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

what does the terminal window look like while the editor is running?

Copy link
Author

Choose a reason for hiding this comment

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

it looks "the same" (just as if you tabbed away from the terminal, so the cursor isn't blinking).

if you tab back into the terminal while the code window is open and add text to the prompt, that text is retained (the resulting text from the code window is prepended to the text you added). but this seems like an edge case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

hm... but didn't we disable all our terminal modes? we shouldn't be running the TUI at the same time as the editor is open, I think.

e.g. what happens if you end up in an odd state, e.g. an approval dialog is showing, or you're in transcript mode?

Copy link
Collaborator

Choose a reason for hiding this comment

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

also consider what happens if you open a terminal editor like vim while a turn is running.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think this should behave roughly the same as ^Z.

Copy link
Author

Choose a reason for hiding this comment

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

an approval dialog is showing

yeah, you can still open + use the editor while an approval dialog is showing, and the results will persist to the prompt editor, but you won't see that until you dismiss the dialog. I think we could easily block opening the external editor while a dialog is displayed.

or you're in transcript mode

the Ctrl+G shortcut is gated on there not being an overlay active, so you cannot open the external editor if transcript mode or another overlay is open.

what happens if you open a terminal editor like vim while a turn is running

this is allowed, and we block on the terminal editor closing, so new events (like SSE updates) are accumulated but not processed in the main loop. Once you exit the terminal editor, they're processed and the TUI updates.

If we switched to the Ctrl+Z approach, we wouldn't be able to open the external editor mid-turn, which could disappoint users who expect to be able to write their next prompt while inference runs for the previous one. FWIW, Claude Code allows launching the external editor while a turn is in progress.

I think we could go either way. Thoughts?

@sayan-oai sayan-oai marked this pull request as ready for review December 5, 2025 07:34
@sayan-oai
Copy link
Author

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Breezy!

ℹ️ 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".

@hasan-ozdemir
Copy link

Dear Participants; i have also implemented "ctrl+e:edit prompt in external editor" feature on windows since i was not aware of the improvement on this issue yet.
Now, it can open default notepad on windows.
Then how do i bring up my implementation in my topic branch so that you can check for the potential integration option into your solution if you like?
BTW: i have implemented it as a modular .JS extension along with an extension host on Rust TUI side.

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.

5 participants