Skip to content

Commit

Permalink
fix: recipe scroll command scrolls both component and item info, fix …
Browse files Browse the repository at this point in the history
…support for page up/down (#4802)

Co-authored-by: Alexey <[email protected]>
  • Loading branch information
chaosvolt and irwiss authored Jun 15, 2024
1 parent ec5ca98 commit 59e9801
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/crafting_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ const recipe *select_crafting_recipe( int &batch_size_out )
ctxt.register_action( "SCROLL_RECIPE_INFO_DOWN" );
ctxt.register_action( "PAGE_UP", to_translation( "Fast scroll up" ) );
ctxt.register_action( "PAGE_DOWN", to_translation( "Fast scroll down" ) );
ctxt.register_action( "SCROLL_ITEM_INFO_UP" );
ctxt.register_action( "SCROLL_ITEM_INFO_DOWN" );
ctxt.register_action( "PREV_TAB" );
ctxt.register_action( "NEXT_TAB" );
ctxt.register_action( "FILTER" );
Expand Down Expand Up @@ -753,22 +751,27 @@ const recipe *select_crafting_recipe( int &batch_size_out )
}

ui_manager::redraw();
const int scroll_recipe_info_lines = catacurses::getmaxy( w_iteminfo ) - 4;
const std::string action = ctxt.handle_input();
if( action == "SCROLL_RECIPE_INFO_UP" ) {
recipe_info_scroll -= dataLines;
item_info_scroll -= dataLines;
} else if( action == "SCROLL_RECIPE_INFO_DOWN" ) {
recipe_info_scroll += dataLines;
item_info_scroll += dataLines;
} else if( action == "PAGE_UP" ) {
recipe_info_scroll -= scroll_recipe_info_lines;
item_info_scroll -= scroll_recipe_info_lines;
} else if( action == "PAGE_DOWN" ) {
recipe_info_scroll += scroll_recipe_info_lines;
item_info_scroll += scroll_recipe_info_lines;
} else if( action == "LEFT" ) {
std::string start = subtab.cur();
do {
subtab.prev();
} while( subtab.cur() != start && shown_recipes.empty_category( tab.cur(),
subtab.cur() != "CSC_ALL" ? subtab.cur() : "" ) );
recalc = true;
} else if( action == "SCROLL_UP" ) {
item_info_scroll--;
} else if( action == "SCROLL_DOWN" ) {
item_info_scroll++;
} else if( action == "PREV_TAB" ) {
tab.prev();
// Default ALL
Expand Down

0 comments on commit 59e9801

Please sign in to comment.