search results take you to a thing, they do not open it

Clicking a file result navigated to its folder AND opened a viewer pane in one
gesture. Search is how you find where something is; opening it is a separate
decision — so a search for a name you were merely locating left a pane you then
had to close.

  file       → its containing folder, with the row selected
  directory  → inside it, which is what opening a folder means

The file is selected rather than merely listed, so the thing you searched for is
picked out of whatever else is in that folder.

That makes clicking a FILE identical to Show location — one behaviour reached two
ways — so the menu stops offering it twice under two names. "Open folder" now
appears only on a directory result, which is the only kind that has somewhere to
go into; a file gets Show location alone. `ExternalLink` went with it, since
nothing was left importing it for.

`handleShowLocation` is unchanged and still reveals a DIRECTORY's parent, so the
two menu items on a folder are genuinely different: Open folder goes in, Show
location goes to where it sits.

tsgo clean, frontend builds, 817 pass / 7 fail unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-15 20:57:15 +00:00
co-authored by Claude Opus 5
parent a84eedd126
commit 4874c21dfd
2 changed files with 28 additions and 10 deletions
@@ -12,7 +12,7 @@ import {
MessageSquare,
Download,
Mic,
ExternalLink,
FolderOpen,
FolderSearch,
GitBranch,
Eye,
@@ -206,12 +206,16 @@ export const FileViewContainer = ({ fileBrowserManager }: FileViewContainerProps
path from the folder being browsed — reusing it would act on the wrong file. These
three take the path as given. */}
<ContextMenuContent className="z-[600]">
<ContextMenuItem onClick={() => handleSearchResultClick(entry)} className="cursor-pointer">
<ExternalLink className="mr-2 h-4 w-4" />
Open
</ContextMenuItem>
{/* The other question a search result raises. Clicking it opens it; this goes
to the folder it lives in and selects it there, leaving nothing open. */}
{/* Only a folder gets "Open", because only a folder has somewhere to go INTO.
For a file, opening and locating are now the same act — both land you in
its folder with it selected — so it is offered once, as Show location,
rather than twice under two names. */}
{isDir && (
<ContextMenuItem onClick={() => handleSearchResultClick(entry)} className="cursor-pointer">
<FolderOpen className="mr-2 h-4 w-4" />
Open folder
</ContextMenuItem>
)}
<ContextMenuItem onClick={() => handleShowLocation(entry)} className="cursor-pointer">
<FolderSearch className="mr-2 h-4 w-4" />
Show location
@@ -283,14 +283,28 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, urlPa
// ── Handlers ──
/**
* Clicking a search result takes you TO the thing, and does not open it.
*
* A file used to navigate to its folder and open a viewer pane in one gesture. Search is how you find
* where something is; opening it is a separate decision, and making one click do both meant a search
* for a name you were merely locating left a pane you then had to close.
*
* file → its containing folder, with the row selected
* directory → inside it, which is what opening a folder means
*
* The file case is deliberately identical to `handleShowLocation`. They are one behaviour reached two
* ways, so the menu offers it once — see the search menu in FileViewContainer.
*/
const handleSearchResultClick = (entry: DirEntry) => {
if (!entry.path) return;
if (entry.type === 'directory') {
setCurrentPath(entry.path);
setSelected(new Set());
} else {
const parentPath = entry.path.substring(0, entry.path.lastIndexOf('/')) || '/';
setCurrentPath(parentPath);
setViewerParams({ view: entry.path });
setCurrentPath(entry.path.substring(0, entry.path.lastIndexOf('/')) || '/');
// Selected, so the file you searched for is picked out of whatever else is in that folder.
setSelected(new Set([entry.name]));
}
setSearchQuery('');
};