diff --git a/src/magic.cpp b/src/magic.cpp index f727e3e07bf94..1d571de084c49 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -2848,7 +2848,7 @@ int known_magic::select_spell( Character &guy ) } reflesh_favorite( &spell_menu, known_spells ); - spell_menu.query(); + spell_menu.query( true, -1, true ); casting_ignore = static_cast( spell_menu.callback )->casting_ignore; diff --git a/src/ui.cpp b/src/ui.cpp index b901cde3aefd7..8b51c5e708c57 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -1029,7 +1029,7 @@ uilist::handle_mouse_result_t uilist::handle_mouse( const input_context &ctxt, * Handle input and update display * */ -void uilist::query( bool loop, int timeout ) +void uilist::query( bool loop, int timeout, bool allow_unfiltered_hotkeys ) { #if defined(__ANDROID__) bool auto_pos = w_x_setup.fun == nullptr && w_y_setup.fun == nullptr && @@ -1140,19 +1140,26 @@ void uilist::query( bool loop, int timeout ) } filterlist(); } else if( iter != keymap.end() ) { - const auto it = std::find( fentries.begin(), fentries.end(), iter->second ); - if( it != fentries.end() ) { - const bool enabled = entries[*it].enabled; - if( enabled || allow_disabled || hilight_disabled ) { - // Change the selection to display correctly when this function - // is called again. - fselected = std::distance( fentries.begin(), it ); - selected = *it; - if( enabled || allow_disabled ) { - ret = entries[selected].retval; - } - if( callback != nullptr ) { - callback->select( this ); + if( allow_unfiltered_hotkeys ) { + const bool enabled = entries[iter->second].enabled; + if( enabled || allow_disabled ) { + ret = entries[iter->second].retval; + } + } else { + const auto it = std::find( fentries.begin(), fentries.end(), iter->second ); + if( it != fentries.end() ) { + const bool enabled = entries[*it].enabled; + if( enabled || allow_disabled || hilight_disabled ) { + // Change the selection to display correctly when this function + // is called again. + fselected = std::distance( fentries.begin(), it ); + selected = *it; + if( enabled || allow_disabled ) { + ret = entries[selected].retval; + } + if( callback != nullptr ) { + callback->select( this ); + } } } } diff --git a/src/ui.h b/src/ui.h index ee77bdf282599..d05f2ae487b6e 100644 --- a/src/ui.h +++ b/src/ui.h @@ -287,7 +287,7 @@ class uilist // NOLINT(cata-xy) void reposition( ui_adaptor &ui ); void show( ui_adaptor &ui ); bool scrollby( int scrollby ); - void query( bool loop = true, int timeout = -1 ); + void query( bool loop = true, int timeout = -1, bool allow_unfiltered_hotkeys = false ); void filterlist(); // In add_entry/add_entry_desc/add_entry_col, int k only support letters // (a-z, A-Z) and digits (0-9), MENU_AUTOASSIGN, and 0 or ' ' (disable