mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
Keep fitting URLs intact in fullscreen Markdown transcripts (#60416)
## Why URLs in fullscreen Markdown transcripts could split across rows even when the full URL would fit on its own row. ## What changed Mark non-code Markdown lines containing URL-like text with the `UrlAware` wrap policy so transcript layout preserves fitting URLs on a single row. ## Testing Add a regression snapshot showing a documentation URL moving intact to the next row after introductory text. Update the conversation snapshot and copy-on-select test dimensions for the changed wrapping. GitOrigin-RevId: 4812c83483cff412406a71ae6745977c5384c7da
This commit is contained in:
@@ -186,7 +186,7 @@ fn copy_on_select_preserves_link_activation_and_ignores_empty_drags() {
|
||||
copy_on_select: true,
|
||||
..Default::default()
|
||||
};
|
||||
render(&mut view, &cells, /*width*/ 30, /*height*/ 1);
|
||||
render(&mut view, &cells, /*width*/ 30, /*height*/ 2);
|
||||
let down = mouse(MouseEventKind::Down(MouseButton::Left), /*column*/ 2);
|
||||
assert!(matches!(
|
||||
view.handle_mouse(down, &cells),
|
||||
|
||||
@@ -298,6 +298,29 @@ fn narrow_wrapping_keeps_joined_emoji_whole() {
|
||||
assert_eq!(buffer[(0, 0)].symbol(), "👩💻");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fullscreen_markdown_keeps_a_fitting_url_on_one_row() {
|
||||
use crate::history_cell::AgentMarkdownCell;
|
||||
use crate::history_cell::HistoryCell;
|
||||
let cell = AgentMarkdownCell::new(
|
||||
"See the documentation at https://example.com/docs/reference.".into(),
|
||||
std::path::Path::new("."),
|
||||
);
|
||||
let layout = TextLayout::new(
|
||||
cell.retained_hyperlink_lines(/*width*/ 44, /*detailed*/ false),
|
||||
/*width*/ 44,
|
||||
);
|
||||
let rows = layout
|
||||
.rows
|
||||
.iter()
|
||||
.map(|row| row.line.line.to_string())
|
||||
.collect::<Vec<_>>();
|
||||
insta::assert_snapshot!(rows.join("\n"), @"
|
||||
• See the documentation at
|
||||
https://example.com/docs/reference.
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn source_backed_markdown_copy_preserves_code_indentation() {
|
||||
use crate::history_cell::AgentMarkdownCell;
|
||||
|
||||
Reference in New Issue
Block a user