Sfoglia il codice sorgente

Bug fix: Parent directory command was missing its keyboard shortcut in the menu

Source commit: 42528ba404f58a8835a8288e152aa8a6837269ab
Martin Prikryl 2 anni fa
parent
commit
93dc5a5cbd
2 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. 2 0
      source/forms/NonVisual.dfm
  2. 12 0
      source/packages/filemng/CustomDirView.pas

+ 2 - 0
source/forms/NonVisual.dfm

@@ -440,6 +440,7 @@ object NonVisualDataModule: TNonVisualDataModule
       HelpKeyword = 'task_navigate#special_commands'
       Hint = 'Parent directory|Go to parent directory'
       ImageIndex = 12
+      ShortCut = 8
     end
     object RemoteRootDirAction: TAction
       Tag = 12
@@ -695,6 +696,7 @@ object NonVisualDataModule: TNonVisualDataModule
       HelpKeyword = 'task_navigate#special_commands'
       Hint = 'Parent directory|Go to parent directory'
       ImageIndex = 12
+      ShortCut = 8
     end
     object LocalRootDirAction: TAction
       Tag = 8

+ 12 - 0
source/packages/filemng/CustomDirView.pas

@@ -189,6 +189,7 @@ type
     procedure CMRecreateWnd(var Message: TMessage); message CM_RECREATEWND;
     procedure CMDPIChanged(var Message: TMessage); message CM_DPICHANGED;
     procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
+    procedure CNKeyDown(var Message: TWMKeyDown); message CN_KEYDOWN;
 
     procedure DumbCustomDrawItem(Sender: TCustomListView; Item: TListItem;
       State: TCustomDrawState; var DefaultDraw: Boolean);
@@ -1534,6 +1535,17 @@ begin
   BusyOperation(ExecuteParentDirectory);
 end;
 
+procedure TCustomDirView.CNKeyDown(var Message: TWMKeyDown);
+begin
+  // Prevent Backspace being handled via "Parent directory" command in the context menu.
+  // We want it handled here in KeyDown
+  // (among other as the mechanism there makes sure it works differently while incrementally searching).
+  if Message.CharCode <> VK_BACK then
+  begin
+    inherited;
+  end;
+end;
+
 procedure TCustomDirView.KeyDown(var Key: Word; Shift: TShiftState);
 var
   AKey: Word;