summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-07-19 11:29:16 -0400
committerpommicket <pommicket@gmail.com>2023-07-19 19:03:22 -0400
commit88f894b49d75bc287a1a1ca1443ac918b49b0cab (patch)
treeddc8a0b423410c973099df84846d969a238c59f9 /buffer.c
parent8bd1df1736e2fa550f1a8d28c9ad2ab7818a23b6 (diff)
clean up valgrind suppressions a bit
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/buffer.c b/buffer.c
index 5cf1820..0dd397d 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2998,8 +2998,12 @@ void buffer_render(TextBuffer *buffer, Rect r) {
// line numbering
if (!buffer->is_line_buffer && settings->line_numbers) {
- // TODO: compute max digit width
- float line_number_width = ndigits_u64(buffer->nlines) * text_font_char_width(font, '8') + padding;
+ float max_digit_width = 0;
+ for (char32_t digit = '0'; digit <= '9'; ++digit) {
+ max_digit_width = maxf(max_digit_width, text_font_char_width(font, digit));
+ }
+
+ float line_number_width = ndigits_u64(buffer->nlines) * max_digit_width + padding;
TextRenderState text_state = text_render_state_default;
text_state.min_x = x1;