Browse Source

Bug fix: Ctrl+T opens the wrong type of tab

Source commit: ec4b6440d2cea714d2852af9f8f9fa2cf62c96df
Martin Prikryl 2 years ago
parent
commit
6b54d760e5

+ 1 - 1
source/forms/CustomScpExplorer.cpp

@@ -5145,7 +5145,7 @@ void __fastcall TCustomScpExplorerForm::NewSession(const UnicodeString & Session
   }
 }
 //---------------------------------------------------------------------------
-void TCustomScpExplorerForm::NewTab(TOperationSide)
+void TCustomScpExplorerForm::NewTab(TOperationSide, bool)
 {
   NewSession();
 }

+ 1 - 1
source/forms/CustomScpExplorer.h

@@ -791,7 +791,7 @@ public:
   virtual bool SupportedSession(TSessionData * SessionData) = 0;
 
   void __fastcall NewSession(const UnicodeString & SessionUrl = L"");
-  virtual void NewTab(TOperationSide Side = osCurrent);
+  virtual void NewTab(TOperationSide Side = osCurrent, bool AllowReverse = true);
   void __fastcall DuplicateTab();
   void __fastcall RenameTab();
   void __fastcall CloseTab();

+ 3 - 2
source/forms/NonVisual.cpp

@@ -518,7 +518,8 @@ void __fastcall TNonVisualDataModule::ExplorerActionsExecute(
   }
   ScpExplorer->BeforeAction();
 
-  unsigned int ShortCutFlag = FLAGMASK((Action->ActionComponent == NULL), cocShortCutHint);
+  bool ExecutedByShortcut = (Action->ActionComponent == NULL);
+  unsigned int ShortCutFlag = FLAGMASK(ExecutedByShortcut, cocShortCutHint);
 
   {
     TAutoNestingCounter Counter(FBusy);
@@ -751,7 +752,7 @@ void __fastcall TNonVisualDataModule::ExplorerActionsExecute(
     #undef COLVIEWPROPS
 
     // SESSION
-    EXE(NewTabAction, ScpExplorer->NewTab())
+    EXE(NewTabAction, ScpExplorer->NewTab(osCurrent, !ExecutedByShortcut))
     EXE(NewRemoteTabAction, ScpExplorer->NewTab(osRemote))
     EXE(NewLocalTabAction, ScpExplorer->NewTab(osLocal))
     EXE(DefaultToNewRemoteTabAction, WinConfiguration->DefaultToNewRemoteTab = !WinConfiguration->DefaultToNewRemoteTab)

+ 2 - 2
source/forms/ScpCommander.cpp

@@ -430,12 +430,12 @@ TManagedTerminal * TScpCommanderForm::GetReplacementForLastSession()
   return TTerminalManager::Instance()->NewLocalBrowser();
 }
 //---------------------------------------------------------------------------
-void TScpCommanderForm::NewTab(TOperationSide Side)
+void TScpCommanderForm::NewTab(TOperationSide Side, bool AllowReverse)
 {
   if (Side == osCurrent)
   {
     bool Remote = WinConfiguration->DefaultToNewRemoteTab;
-    if (IsKeyPressed(VK_CONTROL))
+    if (IsKeyPressed(VK_CONTROL) && AllowReverse)
     {
       Remote = !Remote;
     }

+ 1 - 1
source/forms/ScpCommander.h

@@ -674,7 +674,7 @@ public:
     ::TFileOperation Operation, TOperationSide Side, bool OnFocused, bool NoConfirmation, bool DragDrop, unsigned int Flags);
   virtual UnicodeString GetLocalBrowserSessionTitle(TManagedTerminal * Session);
   virtual TManagedTerminal * GetReplacementForLastSession();
-  virtual void NewTab(TOperationSide Side);
+  virtual void NewTab(TOperationSide Side, bool AllowReverse);
   virtual int GetNewTabActionImageIndex();
   virtual int GetNewTabTabImageIndex(TOperationSide Side);
   virtual UnicodeString __fastcall DefaultDownloadTargetDirectory();