@devries-cameron20 / t3code-1 / commits / 6717d92cf3
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): Tab completes folder names in the add-project browser (#28243)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Michael Morahan committed Oct 31, 2026 at 20:48 UTC 6717d92cf30832a2bd83a6b94bfa2cdf7861095c
3 files changed +80
apps/web/src/components/CommandPalette.tsx
+25
@@ -32,6 +32,7 @@ import {
32 createBrowseNavigationCoordinator,
33 filterFilesystemBrowseEntries,
34 getFilesystemBrowsePath,
35 + getFilesystemBrowseTabCompletion,
36 } from "@t3tools/client-runtime/state/filesystem";
37 import {
38 isAtomCommandInterrupted,
@@ -2492,6 +2493,30 @@ function OpenCommandPaletteDialog(props: {
2493 }
2494
2495 if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;
2496 +
2497 + if (event.key === "Tab" && isBrowsing && !relativePathNeedsActiveProject) {
2498 + if (event.nativeEvent.isComposing || event.keyCode === 229) return;
2499 + (event as typeof event & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.();
2500 + event.preventDefault();
2501 + if (highlightedItemValue === "browse:up") {
2502 + void browseUp();
2503 + return;
2504 + }
2505 + const highlightedEntry = visibleBrowseEntries.find(
2506 + (entry) => `browse:${entry.fullPath}` === highlightedItemValue,
2507 + );
2508 + const completion = highlightedEntry
2509 + ? { name: highlightedEntry.name, isComplete: true }
2510 + : getFilesystemBrowseTabCompletion(visibleBrowseEntries, browsePath.filterQuery);
2511 + if (completion?.isComplete) {
2512 + void browseTo(completion.name);
2513 + } else if (completion && !pinnedCloneDirectoryName) {
2514 + setHighlightedItemValue(null);
2515 + setQuery(`${getBrowseDirectoryPath(query)}${completion.name}`);
2516 + }
2517 + return;
2518 + }
2519 +
2520 const firstItemValue = autoHighlightsFirstRow ? resultRows.itemValues[0] : undefined;
2521 if (
2522 event.key === "ArrowDown" &&
packages/client-runtime/src/state/filesystem.test.ts
+28
@@ -4,6 +4,7 @@ import { AuthFilesystemReadScope, AuthOrchestrationReadScope } from "@t3tools/co
4 import {
5 createBrowseNavigationCoordinator,
6 getFilesystemBrowsePath,
7 + getFilesystemBrowseTabCompletion,
8 resolveFilesystemReadAccess,
9 } from "./filesystem.ts";
10
@@ -79,6 +80,33 @@ describe("filesystem browse model", () => {
80 expect(getFilesystemBrowsePath("C:\\Users\\test", "MacIntel").isBrowsing).toBe(false);
81 expect(getFilesystemBrowsePath("~/projects/", "", false).isBrowsing).toBe(false);
82 });
83 +
84 + it("completes Tab like a shell", () => {
85 + const entry = (name: string) => ({ name, fullPath: `/Users/me/${name}` });
86 + expect(getFilesystemBrowseTabCompletion([entry("Creations")], "Creation")).toEqual({
87 + name: "Creations",
88 + isComplete: true,
89 + });
90 + expect(getFilesystemBrowseTabCompletion([entry("OpenSourced"), entry("OpenAI")], "op")).toEqual(
91 + { name: "Open", isComplete: false },
92 + );
93 + expect(getFilesystemBrowseTabCompletion([entry("Open"), entry("Opal")], "Op")).toBeNull();
94 + expect(getFilesystemBrowseTabCompletion([entry("openAI"), entry("OpenSource")], "o")).toEqual({
95 + name: "open",
96 + isComplete: false,
97 + });
98 + expect(getFilesystemBrowseTabCompletion([entry("😀one"), entry("😁two")], "")).toBeNull();
99 + expect(getFilesystemBrowseTabCompletion([entry("ΟΣα"), entry("οσβ")], "ο")).toBeNull();
100 + expect(getFilesystemBrowseTabCompletion([entry("İfoo"), entry("İfar")], "i\u0307")).toEqual({
101 + name: "İf",
102 + isComplete: false,
103 + });
104 + expect(getFilesystemBrowseTabCompletion([entry("😀one"), entry("😀other")], "😀")).toEqual({
105 + name: "😀o",
106 + isComplete: false,
107 + });
108 + expect(getFilesystemBrowseTabCompletion([], "x")).toBeNull();
109 + });
110 });
111
112 describe("browse navigation", () => {
packages/client-runtime/src/state/filesystem.ts
+27
@@ -87,6 +87,33 @@ export function filterFilesystemBrowseEntries(
87 return { visibleEntries, exactEntry };
88 }
89
90 +/** Shell-style Tab: a single match enters the directory, several extend to their common prefix. */
91 +export function getFilesystemBrowseTabCompletion(
92 + visibleEntries: ReadonlyArray<FilesystemBrowseEntry>,
93 + filterQuery: string,
94 +): { readonly name: string; readonly isComplete: boolean } | null {
95 + const [first, ...rest] = visibleEntries;
96 + if (first === undefined) return null;
97 + if (rest.length === 0) return { name: first.name, isComplete: true };
98 + let prefix = Array.from(first.name);
99 + for (const entry of rest) {
100 + const characters = Array.from(entry.name);
101 + let length = 0;
102 + while (
103 + length < prefix.length &&
104 + prefix[length]?.toLowerCase() === characters[length]?.toLowerCase()
105 + )
106 + length += 1;
107 + prefix = prefix.slice(0, length);
108 + }
109 + const name = prefix.join("");
110 + const lowerName = name.toLowerCase();
111 + return lowerName.length > filterQuery.toLowerCase().length &&
112 + visibleEntries.every((entry) => entry.name.toLowerCase().startsWith(lowerName))
113 + ? { name, isComplete: false }
114 + : null;
115 +}
116 +
117 export function createBrowseNavigationCoordinator() {
118 let generation = 0;
119