mirror of
https://github.com/microsoft/terminal.git
synced 2026-02-08 05:37:27 +00:00
Revert "Hide "Open in Terminal" context menu option appropriately (#13206)"
This reverts commit 93b5dff5f8.
This commit is contained in:
2
.github/actions/spelling/expect/expect.txt
vendored
2
.github/actions/spelling/expect/expect.txt
vendored
@@ -2179,8 +2179,6 @@ SETTITLE
|
||||
setw
|
||||
Setwindow
|
||||
SETWINDOWINFO
|
||||
SFGAO
|
||||
SFGAOF
|
||||
sfi
|
||||
SFINAE
|
||||
SFUI
|
||||
|
||||
@@ -97,7 +97,7 @@ HRESULT OpenTerminalHere::GetTitle(IShellItemArray* /*psiItemArray*/,
|
||||
return SHStrDup(resource.data(), ppszName);
|
||||
}
|
||||
|
||||
HRESULT OpenTerminalHere::GetState(IShellItemArray* psiItemArray,
|
||||
HRESULT OpenTerminalHere::GetState(IShellItemArray* /*psiItemArray*/,
|
||||
BOOL /*fOkToBeSlow*/,
|
||||
EXPCMDSTATE* pCmdState)
|
||||
{
|
||||
@@ -106,25 +106,10 @@ HRESULT OpenTerminalHere::GetState(IShellItemArray* psiItemArray,
|
||||
// E_PENDING and this object will be called back on a background thread with
|
||||
// fOkToBeSlow == TRUE
|
||||
|
||||
// We however don't need to bother with any of that.
|
||||
|
||||
// If no item was selected when the context menu was opened and Explorer
|
||||
// is not at a valid path (e.g. This PC or Quick Access), we should hide
|
||||
// the verb from the context menu.
|
||||
if (psiItemArray == nullptr)
|
||||
{
|
||||
const auto path = this->_GetPathFromExplorer();
|
||||
*pCmdState = path.empty() ? ECS_HIDDEN : ECS_ENABLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
winrt::com_ptr<IShellItem> psi;
|
||||
psiItemArray->GetItemAt(0, psi.put());
|
||||
SFGAOF attributes;
|
||||
const bool isFileSystemItem = (psi->GetAttributes(SFGAO_FILESYSTEM, &attributes) == S_OK);
|
||||
*pCmdState = isFileSystemItem ? ECS_ENABLED : ECS_HIDDEN;
|
||||
}
|
||||
// We however don't need to bother with any of that, so we'll just return
|
||||
// ECS_ENABLED.
|
||||
|
||||
*pCmdState = ECS_ENABLED;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user