From e1353c9a9cdc96c0849d18c9d3650f3bcb13bcce Mon Sep 17 00:00:00 2001 From: Vsevolod Kukol Date: Mon, 17 Jul 2017 12:30:27 +0200 Subject: [Ide] Fix KeyBindingSet compare with parent Pt. 2 * fix parent selection for compare * skip unchanged and empty bindings in schemes (fixes bug #57111) --- .../MonoDevelop.Components.Commands/KeyBindingSet.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'main/src/core/MonoDevelop.Ide') 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..eaa9121cac 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,9 @@ namespace MonoDevelop.Components.Commands public bool Equals (KeyBindingSet other) { - if (parent != other && bindings.Count != other.bindings.Count) + if (other == null) + return false; + if (parent != null && parent != other && !parent.Equals (other.parent)) return false; foreach (KeyValuePair binding in bindings) { string accel; @@ -214,9 +216,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; } -- cgit v1.2.3