loosen up the requirements to show the File Browser in term context menu (#3232)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Docsite CI/CD / Build Docsite (push) Has been cancelled
Docsite CI/CD / Deploy to GitHub Pages (push) Has been cancelled
TestDriver.ai Build / Build for TestDriver.ai (push) Has been cancelled

This commit is contained in:
Mike Sawka 2026-04-17 14:05:00 -07:00 committed by GitHub
parent 4969ee19b8
commit 3e4fe8cf51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View file

@ -40,7 +40,7 @@ import { boundNumber, fireAndForget, stringToBase64 } from "@/util/util";
import * as jotai from "jotai";
import * as React from "react";
import { getBlockingCommand } from "./shellblocking";
import { computeTheme, DefaultTermTheme, trimTerminalSelection } from "./termutil";
import { computeTheme, DefaultTermTheme, isLikelyOnSameHost, trimTerminalSelection } from "./termutil";
import { TermWrap, WebGLSupported } from "./termwrap";
export class TermViewModel implements ViewModel {
@ -958,9 +958,9 @@ export class TermViewModel implements ViewModel {
});
fullMenu.push({ type: "separator" });
const shellIntegrationStatus = globalStore.get(this.termRef?.current?.shellIntegrationStatusAtom);
const lastCommand = globalStore.get(this.termRef?.current?.lastCommandAtom);
const cwd = blockData?.meta?.["cmd:cwd"];
const canShowFileBrowser = shellIntegrationStatus === "ready" && cwd != null;
const canShowFileBrowser = cwd != null && isLikelyOnSameHost(lastCommand);
if (canShowFileBrowser) {
fullMenu.push({

View file

@ -397,6 +397,14 @@ export function bufferLinesToText(buffer: TermTypes.IBuffer, startIndex: number,
return lines;
}
export function isLikelyOnSameHost(lastCommand: string): boolean {
if (lastCommand == null) {
return true;
}
const cmd = lastCommand.trimStart();
return !cmd.startsWith("ssh ");
}
export function quoteForPosixShell(filePath: string): string {
return "'" + filePath.replace(/'/g, "'\\''") + "'";
}