Skip to content

Commit

Permalink
Fix DisableGlobalShortcuts breaking YAML editors
Browse files Browse the repository at this point in the history
- fixes #19
- fixes #21
  • Loading branch information
ArchLeaders committed May 30, 2023
1 parent 05dc45a commit fb379f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ExKingEditor/Generators/MenuFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private static ObservableCollection<Control> SetChildItems<T>(Dictionary<string,
};

_visualRoot?.KeyBindings.Add(keyBinding);
_visualRoot?.KeyBindingHeaders.Add(keyBinding, menu.Path);
_visualRoot?.KeyBindingHeaders.TryAdd(keyBinding.Gesture, menu.Path);
}

if (func.Name == "Recent") {
Expand Down
4 changes: 2 additions & 2 deletions src/ExKingEditor/Views/ShellView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class ShellView : Window
{
private List<KeyBinding> _keyBindings = new();

public Dictionary<KeyBinding, string> KeyBindingHeaders { get; } = new();
public Dictionary<KeyGesture, string> KeyBindingHeaders { get; } = new();
public static ObservableCollection<Control>? MainMenu { get; private set; }
public static int MenuOverflow { get; set; } = 0;

Expand Down Expand Up @@ -90,7 +90,7 @@ public void DisableGlobalShortcuts(params string[] targets)
for (int i = 0; i < KeyBindings.Count; i++) {
KeyBinding key = KeyBindings[i];
foreach (var target in targets) {
if (KeyBindingHeaders[key].StartsWith(target)) {
if (KeyBindingHeaders[key.Gesture].StartsWith(target)) {
_keyBindings.Add(key);
KeyBindings.RemoveAt(i);
}
Expand Down

0 comments on commit fb379f6

Please sign in to comment.