Skip to content

Commit

Permalink
Position the cursor on the selected item in the item list
Browse files Browse the repository at this point in the history
  • Loading branch information
eltank committed Sep 7, 2021
1 parent 2f686d8 commit f23d447
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7118,11 +7118,11 @@ game::vmenu_ret game::list_items( const std::vector<map_item_stack> &item_list )
ui.on_redraw( [&]( const ui_adaptor & ) {
reset_item_list_state( w_items_border, iInfoHeight, sort_radius );

int iStartPos = 0;
if( ground_items.empty() ) {
wnoutrefresh( w_items_border );
mvwprintz( w_items, point( 2, 10 ), c_white, _( "You don't see any items around you!" ) );
} else {
int iStartPos = 0;
werase( w_items );
calcStartPos( iStartPos, iActive, iMaxRows, iItemNum );
int iNum = 0;
Expand Down Expand Up @@ -7226,6 +7226,8 @@ game::vmenu_ret game::list_items( const std::vector<map_item_stack> &item_list )
activeItem->vIG[page_num].it->color_in_inventory(),
activeItem->vIG[page_num].it->display_name() );
wprintw( w_item_info, " >" );
// move the cursor to the selected item (for screen readers)
wmove( w_items, point( 1, iActive - iStartPos ) );
}

wnoutrefresh( w_items );
Expand Down

0 comments on commit f23d447

Please sign in to comment.