Skip to content

Commit 53d784d

Browse files
committed
Do not default bind two hotkeys to the same key combination.
1 parent 7a92ce7 commit 53d784d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/BizHawk.Client.Common/config/Binding.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
using System.Collections.Generic;
2+
#if DEBUG
3+
using System.Diagnostics;
4+
#endif
25
using System.Linq;
36

47
namespace BizHawk.Client.Common
@@ -132,7 +135,7 @@ void Bind(string tabGroup, string displayName, string defaultBinding = "", strin
132135
Bind("TAStudio", "Delete Branch", "Alt+Delete");
133136
Bind("TAStudio", "Show Cursor");
134137
Bind("TAStudio", "Toggle Follow Cursor", "Shift+F");
135-
Bind("TAStudio", "Toggle Auto-Restore", "Shift+R");
138+
Bind("TAStudio", "Toggle Auto-Restore", "Alt+R");
136139
Bind("TAStudio", "Seek To Green Arrow", "R");
137140
Bind("TAStudio", "Toggle Turbo Seek", "Shift+S");
138141
Bind("TAStudio", "Undo", "Ctrl+Z"); // TODO: these are getting not unique enough
@@ -198,6 +201,15 @@ void Bind(string tabGroup, string displayName, string defaultBinding = "", strin
198201

199202
AllHotkeys = dict;
200203
Groupings = dict.Values.Select(static info => info.TabGroup).Distinct().ToList();
204+
205+
#if DEBUG
206+
var bindings = dict.Values
207+
.Where(static info => !info.DisplayName.StartsWith("RA ") && !string.IsNullOrEmpty(info.DefaultBinding))
208+
.Select(static info => info.DefaultBinding);
209+
#pragma warning disable MA0031 // Optimize Enumerable.Count() usage
210+
Debug.Assert(bindings.Count() == bindings.Distinct().Count(), "Do not default bind multiple hotkeys to the same button combination.");
211+
#pragma warning restore MA0031 // Optimize Enumerable.Count() usage
212+
#endif
201213
}
202214

203215
public static void ResolveWithDefaults(IDictionary<string, string> dict)

0 commit comments

Comments
 (0)