diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2017-07-18 20:48:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-18 20:48:37 +0300 |
commit | a75ae28373eecd7067d9c45ffca18171004fa855 (patch) | |
tree | f5362260c6ef27d10cdd9c61b9032f23dfac30fa /main/src | |
parent | daa155f0e01a6e6ab5ef9d2301b935c93e0c70f6 (diff) | |
parent | 76066c9542152e1e8d41fcad672236e0d9c4eb7c (diff) |
Merge pull request #2782 from mono/fix57111-binding-scheme-parent-compare
[57111][Ide] Fix KeyBindingSet compare with parent Pt. 2
Diffstat (limited to 'main/src')
-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; } |