diff --git a/src/inventory_ui.cpp b/src/inventory_ui.cpp index 26e7d068ea9f9..6efabfa21ca55 100644 --- a/src/inventory_ui.cpp +++ b/src/inventory_ui.cpp @@ -1703,6 +1703,10 @@ void inventory_selector::refresh_window() { cata_assert( w_inv ); + if( get_option( "INVENTORY_HIGHLIGHT" ) != "disable" ) { + highlight(); + } + werase( w_inv ); draw_frame( w_inv ); @@ -2120,9 +2124,6 @@ item_location inventory_pick_selector::execute() { shared_ptr_fast ui = create_or_get_ui_adaptor(); while( true ) { - if( get_option( "INVENTORY_HIGHLIGHT" ) != "disable" ) { - highlight(); - } ui_manager::redraw(); const inventory_input input = get_input(); @@ -2466,9 +2467,6 @@ drop_locations inventory_drop_selector::execute() int count = 0; while( true ) { - if( get_option( "INVENTORY_HIGHLIGHT" ) != "disable" ) { - highlight(); - } ui_manager::redraw(); const inventory_input input = get_input(); diff --git a/src/ui_manager.h b/src/ui_manager.h index 2389bb762a774..71a2fd0ca8094 100644 --- a/src/ui_manager.h +++ b/src/ui_manager.h @@ -98,7 +98,13 @@ namespace ui_manager { // rect is the pixel dimensions in tiles or console cell dimensions in curses void invalidate( const rectangle &rect, bool reenable_uis_below ); -// invalidate the top window and redraw all invalidated windows +/* + * Invalidate the top window and redraw all invalidated windows. + * Note that `ui_manager` may redraw multiple times when the game window is + * resized or the system requests a redraw during input calls, so any drawing + * code and other code that generates non-persistent UI info should be called + * inside the redraw callbacks of `ui_adaptor`, instead of being called directly. + */ void redraw(); // redraw all invalidated windows without invalidating the top window void redraw_invalidated();