Skip to content

Commit

Permalink
Merge pull request #58145 from leemuar/scrollable-text-mouse-scrolling
Browse files Browse the repository at this point in the history
Add mouse scrolling to all scrollable_text() windows (help, NPC epilogue, faction epilogue, some NPC talk)
  • Loading branch information
ZhilkinSerg authored Jun 6, 2022
2 parents 7d3b282 + 1dd2a65 commit f3da0cb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ void scrollable_text( const std::function<catacurses::window()> &init_window,
ctxt.register_action( "CONFIRM" );
ctxt.register_action( "QUIT" );
ctxt.register_action( "HELP_KEYBINDINGS" );
// mouse
ctxt.register_action( "SCROLL_UP" );
ctxt.register_action( "SCROLL_DOWN" );

catacurses::window w;
int width = 0;
Expand Down Expand Up @@ -408,11 +411,11 @@ void scrollable_text( const std::function<catacurses::window()> &init_window,
ui_manager::redraw();

action = ctxt.handle_input();
if( action == "UP" ) {
if( action == "UP" || action == "SCROLL_UP" ) {
if( beg_line > 0 ) {
--beg_line;
}
} else if( action == "DOWN" ) {
} else if( action == "DOWN" || action == "SCROLL_DOWN" ) {
if( beg_line < max_beg_line ) {
++beg_line;
}
Expand Down

0 comments on commit f3da0cb

Please sign in to comment.