From 4975e700f132bd05badd27c4d1e1b4f545c3c1e0 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 15 Oct 2024 04:07:05 +0200 Subject: [PATCH] added support for page up/down keys for scrollable info text --- src/screens.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/screens.c b/src/screens.c index 1896122b..7205e0a2 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4320,7 +4320,29 @@ void HandleInfoScreen_Generic(int mx, int my, int dx, int dy, int button) else if ((dy < 0 && wrapped_text->line_visible_first > 0) || (dy > 0 && wrapped_text->line_visible_last < wrapped_text->num_lines - 1)) { - start_pos += SIGN(dy); + if (ABS(dy) == SCROLL_PAGE) + { + if (dy < 0) + { + int old_line_visible_first = wrapped_text->line_visible_first; + + while (wrapped_text->line_visible_first > 0 && + wrapped_text->line_visible_last > old_line_visible_first) + InitWrappedText(0, 0, wrapped_text, --start_pos); + } + else + { + int old_line_visible_last = wrapped_text->line_visible_last; + + while (wrapped_text->line_visible_last < wrapped_text->num_lines - 1 && + wrapped_text->line_visible_first < old_line_visible_last) + InitWrappedText(0, 0, wrapped_text, ++start_pos); + } + } + else + { + start_pos += SIGN(dy); + } DrawInfoScreen_GenericText(wrapped_text, wrapped_tmi, start_pos); } -- 2.34.1