mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
## What changed - Add rendered HTML alongside the original Markdown when copying a whole response through the native clipboard, so rich-text destinations preserve headings, lists, tables, code, and other formatting. - Keep code-block, blockquote, transcript, terminal, and WSL clipboard copies as plain text. - Escape raw HTML, omit remote image sources, and render unsupported link destinations as visible text when producing clipboard HTML. ## Testing - Add coverage for rich formatting, local and unsafe links, inert images, fenced tables, copy selection formats, and clipboard fallbacks. GitOrigin-RevId: c6f5edd88b65f9e9b1ddc5618442868cf47ee560
47 lines
1.6 KiB
Rust
47 lines
1.6 KiB
Rust
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
use std::sync::Arc;
|
|
|
|
#[test]
|
|
fn inbound_fallback_records_only_variant_names() {
|
|
let directory = tempfile::tempdir().expect("temporary log directory");
|
|
let path = directory.path().join("session.jsonl");
|
|
let logger = SessionLogger::new();
|
|
logger.open(path.clone()).expect("open session log");
|
|
for event in [
|
|
AppEvent::CopySelection {
|
|
text: Arc::from("private plan without parentheses"),
|
|
label: "private label".to_string(),
|
|
format: crate::clipboard_copy::CopyFormat::Markdown,
|
|
},
|
|
AppEvent::CopySelection {
|
|
text: Arc::from("private code(with parentheses)"),
|
|
label: "private label".to_string(),
|
|
format: crate::clipboard_copy::CopyFormat::PlainText,
|
|
},
|
|
AppEvent::ConsolidateProposedPlan("private tuple payload".to_string()),
|
|
AppEvent::SettingsSelectionClosed,
|
|
] {
|
|
log_inbound_app_event_with(&logger, &event);
|
|
}
|
|
let records = std::fs::read_to_string(path)
|
|
.expect("read session log")
|
|
.lines()
|
|
.map(|line| {
|
|
let mut record: serde_json::Value = serde_json::from_str(line).expect("valid log JSON");
|
|
record.as_object_mut().expect("log object").remove("ts");
|
|
record
|
|
})
|
|
.collect::<Vec<_>>();
|
|
assert_eq!(
|
|
records,
|
|
[
|
|
"CopySelection",
|
|
"CopySelection",
|
|
"ConsolidateProposedPlan",
|
|
"SettingsSelectionClosed"
|
|
]
|
|
.map(|variant| json!({"dir": "to_tui", "kind": "app_event", "variant": variant}))
|
|
);
|
|
}
|