mirror of
https://github.com/openai/codex.git
synced 2026-12-06 01:10:58 +00:00
Avoid allocating per character when decorating hyperlinks (#38823)
Encode each character into a stack buffer before appending it to the decorated span, avoiding a temporary `String` allocation for every character. GitOrigin-RevId: 72ec1ad5363391dffee089f04073d827d8c459bf
This commit is contained in:
committed by
copyberry
parent
1ba9ce8910
commit
49db349ffd
@@ -461,7 +461,7 @@ pub(crate) fn decorate_spans(line: &HyperlinkLine) -> Vec<Span<'static>> {
|
||||
}
|
||||
active_link_index = selected_link_index;
|
||||
}
|
||||
push_styled_content(&mut out, &ch.to_string(), span.style);
|
||||
push_styled_content(&mut out, ch.encode_utf8(&mut [0; 4]), span.style);
|
||||
column += width;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user