Skip to content

Commit

Permalink
Revert "Hide "Open in Terminal" context menu option appropriately (mi…
Browse files Browse the repository at this point in the history
…crosoft#13206)"

This reverts commit 93b5dff.
  • Loading branch information
DHowett committed Aug 16, 2022
1 parent 793e417 commit 2d00432
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
2 changes: 0 additions & 2 deletions .github/actions/spelling/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2179,8 +2179,6 @@ SETTITLE
setw
Setwindow
SETWINDOWINFO
SFGAO
SFGAOF
sfi
SFINAE
SFUI
Expand Down
23 changes: 4 additions & 19 deletions src/cascadia/ShellExtension/OpenTerminalHere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}

Expand Down

0 comments on commit 2d00432

Please sign in to comment.