mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
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
This commit is contained in:
committed by
copyberry
parent
4f38432d87
commit
c3db180493
@@ -56,7 +56,7 @@ pub(super) fn wrapped_lines(text: &str, width: u16) -> Vec<Range<usize>> {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user