mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Normalize CRLF line endings in pasted text (#38704)
## Why Replacing every carriage return with a line feed turns each CRLF pair into two line breaks when text is pasted into the TUI composer. ## What changed Normalize CRLF pairs before converting remaining bare carriage returns, so each pasted line ending becomes a single line feed while existing line feeds remain unchanged. ## Testing Add a regression test covering mixed CRLF, bare CR, and LF line endings. GitOrigin-RevId: 86c66d2a52fae52c9ae58c2f24a49eed685b60be
This commit is contained in:
1 parent
e5470f1bce
commit
3685a61dad
2 files changed
+27
-3
No files matched your search
@@ -153,6 +153,29 @@ fn test_absolute_path(path: &str) -> AbsolutePathBuf {
|
||||
AbsolutePathBuf::try_from(PathBuf::from(path)).expect("absolute test path")
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn pasted_text_normalizes_mixed_line_endings_at_app_boundary() -> Result<()> {
|
||||
let mut app = make_test_app().await;
|
||||
let mut app_server = start_config_write_test_app_server(&app).await?;
|
||||
let mut tui = crate::tui::test_support::make_test_tui()?;
|
||||
|
||||
app.handle_tui_event(
|
||||
&mut tui,
|
||||
&mut app_server,
|
||||
TuiEvent::Paste("line1\r\nline2\rline3\nline4".to_string()),
|
||||
)
|
||||
.await?;
|
||||
|
||||
assert_snapshot!(app.chat_widget.composer_text_with_pending(), @r"
|
||||
line1
|
||||
line2
|
||||
line3
|
||||
line4
|
||||
");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn chat_widget_frame_reuses_active_cell_height_across_frame_passes() {
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in new issue
Block a user