From b433bbaf2c8f60938f64b9f1584a446102118ba9 Mon Sep 17 00:00:00 2001 From: Apaczer <94932128+Apaczer@users.noreply.github.com> Date: Fri, 26 Apr 2024 20:55:02 +0200 Subject: [PATCH 4/7] show curr and total page count in "Enter page" view reduce page_count display by 1, because curr_page init value is 0 --- sdlbook.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdlbook.c b/sdlbook.c index 584f02d..f11cc30 100644 --- a/sdlbook.c +++ b/sdlbook.c @@ -61,7 +61,7 @@ static unsigned *image_data; static void update_title(void) { char buf[64]; snprintf(buf, sizeof buf, "SDLBook [%d/%d] (%d%%) %s", - curr_page, page_count, config_data.scale, filename); + curr_page, page_count-1, config_data.scale, filename); ezsdl_set_title(buf); } @@ -918,7 +918,9 @@ int main(int argc, char **argv) { { char buf[32]; buf[0] = 0; - input_loop("Enter page No.: (use number/arrow keys)", buf, INPUT_LOOP_NUMERIC); + char page_number[100]; + sprintf(page_number, "Enter page %i/%i: (use number/arrows)", curr_page, page_count-1); + input_loop(page_number, buf, INPUT_LOOP_NUMERIC); if(*buf) need_redraw = set_page(atoi(buf)); else need_redraw = 1; } -- 2.34.1