feat: add support for /diff command (#1389)

Adds support for a `/diff` command comparable to the one available in
the TypeScript CLI.

<img width="1103" alt="Screenshot 2025-06-26 at 12 31 33 PM"
src="https://github.com/user-attachments/assets/5dc646ca-301f-41ff-92a7-595c68db64b6"
/>

While here, changed the `SlashCommand` enum so the declared variant
order is the order the commands appear in the popup menu. This way,
`/toggle-mouse-mode` is listed last, as it is the least likely to be
used.

Fixes https://github.com/openai/codex/issues/1253.
This commit is contained in:
Michael Bolin
2025-06-26 13:03:31 -07:00
committed by GitHub
parent a339a7bcce
commit fa0e17f83a
8 changed files with 190 additions and 24 deletions

View File

@@ -384,6 +384,11 @@ impl ChatWidget<'_> {
self.app_event_tx.send(AppEvent::Redraw);
}
pub(crate) fn add_diff_output(&mut self, diff_output: String) {
self.conversation_history.add_diff_output(diff_output);
self.request_redraw();
}
pub(crate) fn handle_scroll_delta(&mut self, scroll_delta: i32) {
// If the user is trying to scroll exactly one line, we let them, but
// otherwise we assume they are trying to scroll in larger increments.