Skip to content

Commit

Permalink
display custom keybind with *, again
Browse files Browse the repository at this point in the history
  • Loading branch information
Brambor authored and katemonster33 committed Feb 23, 2024
1 parent dc97812 commit 62ea4cf
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/input_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ keybindings_ui::keybindings_ui( bool permit_execute_action,
legend.push_back( colorize( _( "Unbound keys" ), unbound_key ) );
legend.push_back( colorize( _( "Keybinding active only on this screen" ), local_key ) );
legend.push_back( colorize( _( "Keybinding active globally" ), global_key ) );
legend.push_back( colorize( _( "* User created" ), global_key ) );
if( permit_execute_action ) {
legend.push_back( string_format(
_( "Press %c to execute action\n" ),
Expand Down Expand Up @@ -632,6 +633,9 @@ void keybindings_ui::draw_controls()
bool overwrite_default;
const action_attributes &attributes = inp_mngr.get_action_attributes( action_id, ctxt->category,
&overwrite_default );
bool basic_overwrite_default;
const action_attributes &basic_attributes = inp_mngr.get_action_attributes( action_id,
ctxt->category, &basic_overwrite_default, true );

ImGui::TableNextColumn();
ImGui::Text( " " );
Expand All @@ -651,13 +655,13 @@ void keybindings_ui::draw_controls()
if( status == s_add_global && overwrite_default ) {
// We're trying to add a global, but this action has a local
// defined, so gray out the invlet.
key_text = colorize( string_format( "%c ", invlet ), c_dark_gray );
key_text = colorize( string_format( "%c", invlet ), c_dark_gray );
} else if( status == s_add || status == s_add_global || status == s_remove ) {
key_text = colorize( string_format( "%c ", invlet ), c_light_blue );
key_text = colorize( string_format( "%c", invlet ), c_light_blue );
} else if( status == s_execute ) {
key_text = colorize( string_format( "%c ", invlet ), c_white );
key_text = colorize( string_format( "%c", invlet ), c_white );
} else {
key_text = " ";
key_text = " ";
}
nc_color col;
if( attributes.input_events.empty() ) {
Expand All @@ -667,6 +671,13 @@ void keybindings_ui::draw_controls()
} else {
col = i == size_t( highlight_row_index ) ? h_global_key : global_key;
}
if( overwrite_default != basic_overwrite_default
|| attributes.input_events != basic_attributes.input_events
) {
key_text += "*";
} else {
key_text += " ";
}
key_text += string_format( "%s:", ctxt->get_action_name( action_id ) );
bool is_selected = false;
draw_colored_text( key_text, col, 0.0f, &is_selected );
Expand Down

0 comments on commit 62ea4cf

Please sign in to comment.