Skip to content

Commit

Permalink
Add mouse up and down scrolling to message log window (P by default) (#…
Browse files Browse the repository at this point in the history
…58124)

* Add mouse up and down scrolling to message log window (P by default)

* Astyle

* More astyle

Co-authored-by: Тимур Кашафутдинов <[email protected]>
Co-authored-by: Zhilkin Serg <[email protected]>
Co-authored-by: David Seguin <[email protected]>
  • Loading branch information
4 people authored Jun 7, 2022
1 parent 3d5c760 commit 7e8b40a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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() ) {
Expand Down

0 comments on commit 7e8b40a

Please sign in to comment.