mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +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:
1 parent
1ba9ce8910
commit
49db349ffd
1 file changed
+1
-1
@@ -461,7 +461,7 @@ pub(crate) fn decorate_spans(line: &HyperlinkLine) -> Vec<Span<'static>> {
|
|||||||
}
|
}
|
||||||
active_link_index = selected_link_index;
|
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;
|
column += width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user