From 6b4bbb5e944028c5dc8fbc1184e5f72c956e9a0a Mon Sep 17 00:00:00 2001 From: Marcus Minhorst Date: Mon, 15 Sep 2025 18:46:23 -0400 Subject: [PATCH] Page[up/down] now page full pages instead of rows Also simplified scrollwheel code --- src/common/console/c_console.cpp | 58 ++++++++++---------------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/src/common/console/c_console.cpp b/src/common/console/c_console.cpp index dcdb6796b..303662a68 100644 --- a/src/common/console/c_console.cpp +++ b/src/common/console/c_console.cpp @@ -814,54 +814,32 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer) break; case GK_PGUP: - if (ev->data3 & (GKM_SHIFT|GKM_CTRL)) + if (ev->subtype == EV_GUI_WheelUp) + { // Scroll console buffer up + if (ev->data3 & (GKM_SHIFT|GKM_CTRL)) RowAdjust += 1; + else RowAdjust += 3; + + if (RowAdjust > total_lines) RowAdjust = total_lines; + } + else { // Scroll console buffer up one page RowAdjust += page_height; - if (RowAdjust > top_row) - { - RowAdjust = top_row; - } - } - else if (RowAdjust < total_lines) - { // Scroll console buffer up - if (ev->subtype == EV_GUI_WheelUp) - { - RowAdjust += 3; - } - else - { - RowAdjust++; - } - if (RowAdjust > total_lines) - { - RowAdjust = total_lines; - } + + if (RowAdjust > top_row) RowAdjust = top_row; // intentionally different than scroll behavior } break; case GK_PGDN: - if (ev->data3 & (GKM_SHIFT|GKM_CTRL)) - { // Scroll console buffer down one page - if (RowAdjust < page_height) - { - RowAdjust = 0; - } - else - { - RowAdjust -= page_height; - } - } - else if (RowAdjust > 0) + if (ev->subtype == EV_GUI_WheelDown) { // Scroll console buffer down - if (ev->subtype == EV_GUI_WheelDown) - { - RowAdjust = max (0, RowAdjust - 3); - } - else - { - RowAdjust--; - } + if (ev->data3 & (GKM_SHIFT|GKM_CTRL)) RowAdjust -= 1; + else RowAdjust -= 3; } + else + { // Scroll console buffer down one page + RowAdjust -= page_height; + } + if (RowAdjust < 0) RowAdjust = 0; break; case GK_HOME: