From ef18875863d4029786ac9751bfe08c7637c7249d Mon Sep 17 00:00:00 2001 From: konect-V <66421869+konect-V@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:23:28 +0200 Subject: [PATCH] Update line count with text-reader --- sources/core/apps/text-reader/source/core/core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sources/core/apps/text-reader/source/core/core.c b/sources/core/apps/text-reader/source/core/core.c index eeda744e7..5501cd649 100644 --- a/sources/core/apps/text-reader/source/core/core.c +++ b/sources/core/apps/text-reader/source/core/core.c @@ -459,13 +459,19 @@ kframebuffer_t* load_buffer(){ { char* line_count_str = NULL; - assert(asprintf(&line_count_str, "%04d", col_count + 1) >= 0); + if(col_count + 1 < 10000){ + assert(asprintf(&line_count_str, "%04d", col_count + 1) >= 0); + }else{ + assert(asprintf(&line_count_str, "++++") >= 0); + } uint32_t line_count_x = 0; - while(*line_count_str){ + char* line_count_char_inc = line_count_str; + while(*line_count_char_inc){ line_count_x += FONT_WIDTH; - bitmap_setchar(framebuffer, line_count_x, cy_pos, *line_count_str, TEXT_COLOR); - line_count_str++; + bitmap_setchar(framebuffer, line_count_x, cy_pos, *line_count_char_inc, TEXT_COLOR); + line_count_char_inc++; } + free(line_count_str); } while(*c){