From 0660d420f3f132d757b8e0cbb6299e8e8390f13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Wed, 14 Jun 2023 20:05:03 +0300 Subject: [PATCH] Fix pagination in chvideomode(1). Pagination code deals with two indices for video modes, one relative to the start of video modes array and one relative to the start of current page. Previously when displaying the list of modes, the video mode array would be accessed using the one relative to the start of the current page, meaning that pages 2 and onwards displayed repeats of the video modes on page 1. This changes the the display code to use indices relative to the start of the video modes array when accessing the array. --- chvideomode/chvideomode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chvideomode/chvideomode.c b/chvideomode/chvideomode.c index 5e766a70..884f0add 100644 --- a/chvideomode/chvideomode.c +++ b/chvideomode/chvideomode.c @@ -278,12 +278,12 @@ static bool select_mode(struct dispmsg_crtc_mode* modes, printf("%s", color); printf("\e[2K"); printf(" [%-*zu] ", num_modes_display_length, index); - if ( modes[i].control & DISPMSG_CONTROL_VALID ) + if ( modes[index].control & DISPMSG_CONTROL_VALID ) printf("%ux%ux%u", - modes[i].view_xres, - modes[i].view_yres, - modes[i].fb_format); - else if ( modes[i].control & DISPMSG_CONTROL_OTHER_RESOLUTIONS ) + modes[index].view_xres, + modes[index].view_yres, + modes[index].fb_format); + else if ( modes[index].control & DISPMSG_CONTROL_OTHER_RESOLUTIONS ) printf("(enter a custom resolution)"); else printf("(unknown video device feature)");