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.
This commit is contained in:
Juhani Krekelä 2023-06-14 20:05:03 +03:00
parent 1773d6a131
commit 0660d420f3
1 changed files with 5 additions and 5 deletions

View File

@ -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)");