From c3db1804933dfadcd55e48660f7ce51104498f82 Mon Sep 17 00:00:00 2001 From: Benjamin Carlsson Date: Thu, 20 Aug 2026 16:43:51 +0000 Subject: [PATCH] Skip postprocessing for short composer input (#39744) ## What changed Return the initial wrapping ranges directly when the composer input produces a single line and its byte length is less than the available width. This avoids the additional grapheme and word-boundary pass for input that cannot wrap. GitOrigin-RevId: 55d990a354fcc61e9a90d5796b4b39d16742cc50 --- codex-rs/tui/src/bottom_pane/textarea/wrapping.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codex-rs/tui/src/bottom_pane/textarea/wrapping.rs b/codex-rs/tui/src/bottom_pane/textarea/wrapping.rs index e125f8d68b..1250ba71bf 100644 --- a/codex-rs/tui/src/bottom_pane/textarea/wrapping.rs +++ b/codex-rs/tui/src/bottom_pane/textarea/wrapping.rs @@ -56,7 +56,7 @@ pub(super) fn wrapped_lines(text: &str, width: u16) -> Vec> { let width = usize::from(width); let options = Options::new(width).wrap_algorithm(textwrap::WrapAlgorithm::FirstFit); let wrapped_lines = crate::wrapping::wrap_ranges(text, &options); - if width == 0 { + if width == 0 || (wrapped_lines.len() == 1 && text.len() < width) { return wrapped_lines; }