diff options
author | pommicket <pommicket@gmail.com> | 2023-07-19 11:29:16 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-07-19 19:03:22 -0400 |
commit | 88f894b49d75bc287a1a1ca1443ac918b49b0cab (patch) | |
tree | ddc8a0b423410c973099df84846d969a238c59f9 /buffer.c | |
parent | 8bd1df1736e2fa550f1a8d28c9ad2ab7818a23b6 (diff) |
clean up valgrind suppressions a bit
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; |