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:
+11
-7
@@ -12,7 +12,7 @@ import {
|
|||||||
MessageSquare,
|
MessageSquare,
|
||||||
Download,
|
Download,
|
||||||
Mic,
|
Mic,
|
||||||
ExternalLink,
|
FolderOpen,
|
||||||
FolderSearch,
|
FolderSearch,
|
||||||
GitBranch,
|
GitBranch,
|
||||||
Eye,
|
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
|
path from the folder being browsed — reusing it would act on the wrong file. These
|
||||||
three take the path as given. */}
|
three take the path as given. */}
|
||||||
<ContextMenuContent className="z-[600]">
|
<ContextMenuContent className="z-[600]">
|
||||||
<ContextMenuItem onClick={() => handleSearchResultClick(entry)} className="cursor-pointer">
|
{/* Only a folder gets "Open", because only a folder has somewhere to go INTO.
|
||||||
<ExternalLink className="mr-2 h-4 w-4" />
|
For a file, opening and locating are now the same act — both land you in
|
||||||
Open
|
its folder with it selected — so it is offered once, as Show location,
|
||||||
</ContextMenuItem>
|
rather than twice under two names. */}
|
||||||
{/* The other question a search result raises. Clicking it opens it; this goes
|
{isDir && (
|
||||||
to the folder it lives in and selects it there, leaving nothing open. */}
|
<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">
|
<ContextMenuItem onClick={() => handleShowLocation(entry)} className="cursor-pointer">
|
||||||
<FolderSearch className="mr-2 h-4 w-4" />
|
<FolderSearch className="mr-2 h-4 w-4" />
|
||||||
Show location
|
Show location
|
||||||
|
|||||||
@@ -283,14 +283,28 @@ export const useFileBrowserApp = (basePath: string, rootOverride?: string, urlPa
|
|||||||
|
|
||||||
// ── Handlers ──
|
// ── 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) => {
|
const handleSearchResultClick = (entry: DirEntry) => {
|
||||||
if (!entry.path) return;
|
if (!entry.path) return;
|
||||||
if (entry.type === 'directory') {
|
if (entry.type === 'directory') {
|
||||||
setCurrentPath(entry.path);
|
setCurrentPath(entry.path);
|
||||||
|
setSelected(new Set());
|
||||||
} else {
|
} else {
|
||||||
const parentPath = entry.path.substring(0, entry.path.lastIndexOf('/')) || '/';
|
setCurrentPath(entry.path.substring(0, entry.path.lastIndexOf('/')) || '/');
|
||||||
setCurrentPath(parentPath);
|
// Selected, so the file you searched for is picked out of whatever else is in that folder.
|
||||||
setViewerParams({ view: entry.path });
|
setSelected(new Set([entry.name]));
|
||||||
}
|
}
|
||||||
setSearchQuery('');
|
setSearchQuery('');
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user