mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
## Why Native clipboard setup and writes can block, preventing the TUI from processing input or closing overlays while a copy is in progress. ## What changed - Route clipboard copies through one session worker that retains native clipboard ownership. Keep terminal escape output on the UI thread. - Show pending and busy status messages, reject additional copies without queuing them, and ask users to retry image paste after an active copy finishes. - Abandon setup after five seconds and prevent late delivery. Keep the worker busy until the blocked call returns, and bound shutdown waiting for clipboard handoff. - Match completions to their originating requests so stale results cannot clear newer selections or unexpectedly resume transcript following. Retain selections on automatic copies, failures, and unconfirmed delivery. ## Testing Add regression tests for blocked backends, overlay exit, copy and paste ordering, setup expiry, bounded shutdown, completion status messages, and preservation of replaced or moved selections. GitOrigin-RevId: 4ba1f8da258b9d0700b0edec9ac0ba699f536785
68 lines
2.7 KiB
Rust
68 lines
2.7 KiB
Rust
//! Destination and filename prompts for on-demand transcript exports.
|
|
|
|
use super::*;
|
|
use crate::app_event::TranscriptExportDestination;
|
|
use crate::bottom_pane::popup_consts::picker_hint_line_for_keymap;
|
|
|
|
impl ChatWidget {
|
|
pub(super) fn show_transcript_export_popup(&mut self) {
|
|
self.show_selection_view(SelectionViewParams {
|
|
header: Box::new(
|
|
Paragraph::new(vec![
|
|
Line::from("Export conversation".bold()),
|
|
Line::from("Save the complete conversation as Markdown".dim()),
|
|
])
|
|
.wrap(Wrap { trim: false }),
|
|
),
|
|
footer_hint: Some(picker_hint_line_for_keymap(&self.bottom_pane.list_keymap())),
|
|
items: vec![
|
|
SelectionItem {
|
|
name: "Copy to clipboard".to_string(),
|
|
description: Some("Copy the complete Markdown transcript".to_string()),
|
|
is_disabled: cfg!(target_os = "android"),
|
|
actions: vec![Box::new(|tx| {
|
|
tx.send(AppEvent::ExportTranscript {
|
|
destination: TranscriptExportDestination::Clipboard,
|
|
});
|
|
})],
|
|
dismiss_on_select: true,
|
|
..Default::default()
|
|
},
|
|
SelectionItem {
|
|
name: "Save to file".to_string(),
|
|
description: Some("Choose a Markdown filename".to_string()),
|
|
actions: vec![Box::new(|tx| {
|
|
tx.send(AppEvent::OpenTranscriptExportFilePrompt);
|
|
})],
|
|
dismiss_on_select: true,
|
|
..Default::default()
|
|
},
|
|
],
|
|
..SelectionViewParams::picker()
|
|
});
|
|
self.defer_input_until_settings_applied();
|
|
self.request_redraw();
|
|
}
|
|
|
|
pub(crate) fn show_transcript_export_file_prompt(&mut self) {
|
|
let tx = self.app_event_tx.clone();
|
|
let filename = self.thread_id().map_or_else(
|
|
|| "codex-session.md".to_string(),
|
|
|thread_id| format!("codex-session-{thread_id}.md"),
|
|
);
|
|
let view = CustomPromptView::new(
|
|
"Save conversation".to_string(),
|
|
"Type a filename and press Enter".to_string(),
|
|
filename,
|
|
/*context_label*/ None,
|
|
Box::new(move |filename| {
|
|
tx.send(AppEvent::ExportTranscript {
|
|
destination: TranscriptExportDestination::File(PathBuf::from(filename)),
|
|
});
|
|
}),
|
|
);
|
|
self.bottom_pane.show_text_prompt(view);
|
|
self.request_redraw();
|
|
}
|
|
}
|