fix(scope): no new string allocation to count characters

This commit is contained in:
2026-04-05 15:58:40 +02:00
parent 0ef1f61613
commit 64652fc81d

View File

@@ -61,7 +61,11 @@ impl Scope {
/// Returns the visible length of the header segment
pub fn header_segment_len(&self) -> usize {
self.header_segment().chars().count()
if self.is_empty() {
0
} else {
self.0.chars().count() + 2
}
}
}