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:
Benjamin Carlsson authored and copyberry committed 2026-08-16 01:34:51 +00:00
1 parent 1ba9ce8910
commit 49db349ffd
1 file changed
+1 -1
+1 -1
View File
@@ -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;
} }
} }