Skip to content

Commit

Permalink
UIMenu key fix (CleverRaven#68809)
Browse files Browse the repository at this point in the history
* ui key fix

* fix
  • Loading branch information
lispcoc authored and detahramet committed Nov 6, 2023
1 parent a5263c0 commit cd26a01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions data/raw/keybindings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
"name": "Pan down",
"bindings": [ { "input_method": "keyboard_any", "key": "DOWN" } ]
},
{
"type": "keybinding",
"id": "UILIST.LEFT",
"name": "Pan left",
"bindings": [ { "input_method": "keyboard_any", "key": "LEFT" } ]
},
{
"type": "keybinding",
"id": "UILIST.RIGHT",
"name": "Pan right",
"bindings": [ { "input_method": "keyboard_any", "key": "RIGHT" } ]
},
{
"type": "keybinding",
"id": "UILIST.FILTER",
Expand Down
8 changes: 4 additions & 4 deletions src/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ input_context uilist::create_main_input_context() const
ctxt.register_action( "SELECT" );
}
ctxt.register_action( "UILIST.FILTER" );
ctxt.register_action( "LEFT" );
ctxt.register_action( "RIGHT" );
ctxt.register_action( "UILIST.LEFT" );
ctxt.register_action( "UILIST.RIGHT" );
ctxt.register_action( "ANY_INPUT" );
ctxt.register_action( "HELP_KEYBINDINGS" );
uilist_scrollbar->set_draggable( ctxt );
Expand Down Expand Up @@ -1129,8 +1129,8 @@ void uilist::query( bool loop, int timeout )
recalc_start = true;
} else if( filtering && ret_act == "UILIST.FILTER" ) {
inputfilter();
} else if( !categories.empty() && ( ret_act == "LEFT" || ret_act == "RIGHT" ) ) {
current_category += ret_act == "LEFT" ? -1 : 1;
} else if( !categories.empty() && ( ret_act == "UILIST.LEFT" || ret_act == "UILIST.RIGHT" ) ) {
current_category += ret_act == "UILIST.LEFT" ? -1 : 1;
if( current_category < 0 ) {
current_category = categories.size() - 1;
} else if( current_category >= static_cast<int>( categories.size() ) ) {
Expand Down

0 comments on commit cd26a01

Please sign in to comment.