Minor optimization of line number length logic (#26845)
Michael Sloan
created
In `layout_excerpt_gutter`, compute max line number length once instead
of for every row
In `max_line_number_width`, use ilog10 instead of converting to floats
and back
Release Notes:
- N/A
@@ -4096,6 +4096,7 @@ impl MultiBufferSnapshot {
}
pub fn widest_line_number(&self) -> u32 {
+ // widest_line_number is 0-based, so 1 is added to get the displayed line number.
self.excerpts.summary().widest_line_number + 1
}