@@ -135,7 +135,7 @@ public partial class SettingsWindow
135135
136136 private Controls mKeybindingEditControls ;
137137
138- private Button mKeybindingEditBtn ;
138+ private Button ? mKeybindingEditBtn ;
139139
140140 private readonly Button mKeybindingRestoreBtn ;
141141
@@ -663,52 +663,50 @@ private void OnKeyDown(Keys modifier, Keys key)
663663
664664 private void OnKeyUp ( Keys modifier , Keys key )
665665 {
666- if ( modifier == Keys . None && key == Keys . None )
666+ if ( mKeybindingEditBtn == null )
667667 {
668668 return ;
669669 }
670670
671- if ( mKeybindingEditBtn != null )
671+ if ( key != Keys . None && ! _keysDown . Remove ( key ) )
672672 {
673- if ( ! _keysDown . Remove ( key ) )
674- {
675- return ;
676- }
673+ return ;
674+ }
677675
678- mKeybindingEditControls . UpdateControl ( mKeybindingEditControl , mKeyEdit , modifier , key ) ;
679- mKeybindingEditBtn . Text = Strings . Keys . FormatKeyName ( modifier , key ) ;
676+ mKeybindingEditControls . UpdateControl ( mKeybindingEditControl , mKeyEdit , modifier , key ) ;
677+ mKeybindingEditBtn . Text = Strings . Keys . FormatKeyName ( modifier , key ) ;
680678
681- if ( key != Keys . None )
679+ if ( key != Keys . None )
680+ {
681+ foreach ( var control in mKeybindingEditControls . ControlMapping )
682682 {
683- foreach ( var control in mKeybindingEditControls . ControlMapping )
683+ if ( control . Key == mKeybindingEditControl )
684684 {
685- if ( control . Key == mKeybindingEditControl )
686- {
687- continue ;
688- }
685+ continue ;
686+ }
689687
690- var bindings = control . Value . Bindings ;
691- for ( var bindingIndex = 0 ; bindingIndex < bindings . Count ; bindingIndex ++ )
692- {
693- var binding = bindings [ bindingIndex ] ;
688+ var bindings = control . Value . Bindings ;
689+ for ( var bindingIndex = 0 ; bindingIndex < bindings . Count ; bindingIndex ++ )
690+ {
691+ var binding = bindings [ bindingIndex ] ;
694692
695- if ( binding . Modifier == modifier && binding . Key == key )
696- {
697- // Remove this mapping.
698- mKeybindingEditControls . UpdateControl ( control . Key , bindingIndex , Keys . None , Keys . None ) ;
693+ if ( binding . Modifier == modifier && binding . Key == key )
694+ {
695+ // Remove this mapping.
696+ mKeybindingEditControls . UpdateControl ( control . Key , bindingIndex , Keys . None , Keys . None ) ;
699697
700- // Update UI.
701- mKeybindingBtns [ control . Key ] [ bindingIndex ] . Text = Strings . Keys . keydict [ Enum . GetName ( typeof ( Keys ) , Keys . None ) . ToLower ( ) ] ;
702- }
698+ // Update UI.
699+ mKeybindingBtns [ control . Key ] [ bindingIndex ] . Text = Strings . Keys . keydict [ Enum . GetName ( typeof ( Keys ) , Keys . None ) . ToLower ( ) ] ;
703700 }
704701 }
705702 }
706703
707704 mKeybindingEditBtn . PlayHoverSound ( ) ;
708- mKeybindingEditBtn = null ;
709- _keysDown . Clear ( ) ;
710- Interface . GwenInput . HandleInput = true ;
711705 }
706+
707+ mKeybindingEditBtn = null ;
708+ _keysDown . Clear ( ) ;
709+ Interface . GwenInput . HandleInput = true ;
712710 }
713711
714712 // Methods.
0 commit comments