From 7e8b40a9894d756eb6611c92b0fae3bcb8009846 Mon Sep 17 00:00:00 2001 From: leemuar Date: Tue, 7 Jun 2022 06:18:00 +0300 Subject: [PATCH] Add mouse up and down scrolling to message log window (P by default) (#58124) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add mouse up and down scrolling to message log window (P by default) * Astyle * More astyle Co-authored-by: Тимур Кашафутдинов Co-authored-by: Zhilkin Serg Co-authored-by: David Seguin --- src/messages.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/messages.cpp b/src/messages.cpp index 99411d0c2772b..a6010d653a460 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -509,6 +509,8 @@ void Messages::dialog::init( ui_adaptor &ui ) ctxt.register_action( "RESET_FILTER" ); ctxt.register_action( "QUIT" ); ctxt.register_action( "HELP_KEYBINDINGS" ); + ctxt.register_action( "SCROLL_UP" ); + ctxt.register_action( "SCROLL_DOWN" ); // Calculate time string display width. The translated strings are expected to // be aligned, so we choose an arbitrary duration here to calculate the width. @@ -720,9 +722,10 @@ void Messages::dialog::input() } } else { const std::string &action = ctxt.handle_input(); - if( action == "DOWN" && offset + max_lines < folded_filtered.size() ) { + if( ( action == "DOWN" || action == "SCROLL_DOWN" ) && + offset + max_lines < folded_filtered.size() ) { ++offset; - } else if( action == "UP" && offset > 0 ) { + } else if( ( action == "UP" || action == "SCROLL_UP" ) && offset > 0 ) { --offset; } else if( action == "PAGE_DOWN" ) { if( offset + max_lines * 2 <= folded_filtered.size() ) {