diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingSet.cs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingSet.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingSet.cs index e649670aa1..0e98831e68 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingSet.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingSet.cs @@ -100,7 +100,12 @@ namespace MonoDevelop.Components.Commands public bool Equals (KeyBindingSet other) { - if (parent != other && bindings.Count != other.bindings.Count) + // TODO: full IEquatable<KeyBindingSet> implementation + // the current solutions is just enough to detect whether a custom set equals a predefined one + // and is not a real equality check. See KeyBindingsPanel.SelectCurrentScheme(). + if (other == null) + return false; + if (parent != null && parent != other && !parent.Equals (other.parent)) return false; foreach (KeyValuePair<string, string> binding in bindings) { string accel; @@ -214,9 +219,21 @@ namespace MonoDevelop.Components.Commands case "binding": command = reader.GetAttribute (commandAttr); binding = reader.GetAttribute (shortcutAttr); + + if (string.IsNullOrEmpty (command)) + continue; + + if (!string.IsNullOrEmpty (binding)) + binding = KeyBindingManager.FixChordSeparators (binding); + + string pbind; + if (parent?.bindings != null && parent.bindings.TryGetValue (command, out pbind)) { + if (binding == pbind) + continue; + } else if (string.IsNullOrEmpty (binding)) + continue; - if (!string.IsNullOrEmpty (command)) - bindings.Add (command, KeyBindingManager.FixChordSeparators(binding)); + bindings.Add (command, binding); break; } |