on master help sign in
Don't calculate symbol width twice
ac81b47Blaž Hrastnik
helix-tui/src/buffer.rs+3−2
@@ -535,9 +535,10 @@ impl Buffer {
535 updates.push((x, y, &next_buffer[i]));
535 updates.push((x, y, &next_buffer[i]));
536 }
536 }
537
537
538− to_skip = current.symbol.width().saturating_sub(1);
538+ let current_width = current.symbol.width();
539+ to_skip = current_width.saturating_sub(1);
539
540
540− let affected_width = std::cmp::max(current.symbol.width(), previous.symbol.width());
541+ let affected_width = std::cmp::max(current_width, previous.symbol.width());
541 invalidated = std::cmp::max(affected_width, invalidated).saturating_sub(1);
542 invalidated = std::cmp::max(affected_width, invalidated).saturating_sub(1);
542 }
543 }
543 updates
544 updates