The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 14:45 UTC
fix(clients): the folder picker finds folders with accented names on macOS (#29617)
Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Alex Southwell committed
Nov 15, 2026 at 01:43 UTC
081a5d92bf1287f7bcf0f79a52e1c0b2b18e793e
4 files changed
+60
-3
apps/web/src/components/CommandPalette.logic.test.ts
+20
@@ -795,6 +795,26 @@ describe("filterPinnedBrowseEntries", () => {
795
visibleEntries: windowsEntries,
796
exactEntry: windowsEntries[0],
797
});
798
+ const decomposed = { name: "De\u0301veloppement", fullPath: "/Users/me/De\u0301veloppement" };
799
+ expect(
800
+ filterPinnedBrowseEntries({
801
+ browseEntries: [decomposed],
802
+ filterQuery: "D\u00e9veloppement",
803
+ pinnedDirectoryName: "repo",
804
+ caseSensitive: true,
805
+ }).exactEntry,
806
+ ).toBe(decomposed);
807
+ expect(
808
+ filterPinnedBrowseEntries({
809
+ browseEntries: [
810
+ { name: "\u212B", fullPath: "/home/me/\u212B" },
811
+ { name: "A\u030A", fullPath: "/home/me/A\u030A" },
812
+ ],
813
+ filterQuery: "\u00C5",
814
+ pinnedDirectoryName: "repo",
815
+ caseSensitive: true,
816
+ }).exactEntry,
817
+ ).toBeNull();
818
});
819
});
820
apps/web/src/components/CommandPalette.logic.ts
+6
-1
@@ -749,9 +749,14 @@ export function filterPinnedBrowseEntries(input: {
749
? ""
750
: input.filterQuery;
751
const { visibleEntries } = filterFilesystemBrowseEntries(input.browseEntries, visibleFilterQuery);
752
+ const normalizedFilterQuery = input.filterQuery.normalize("NFC");
753
+ const normalizedMatches = input.browseEntries.filter((entry) =>
754
+ namesMatch(entry.name.normalize("NFC"), normalizedFilterQuery),
755
+ );
756
const exactEntry =
757
input.filterQuery.length > 0
754
- ? (input.browseEntries.find((entry) => namesMatch(entry.name, input.filterQuery)) ?? null)
758
+ ? (input.browseEntries.find((entry) => namesMatch(entry.name, input.filterQuery)) ??
759
+ (normalizedMatches.length === 1 ? normalizedMatches[0] : null))
760
: null;
761
return { visibleEntries, exactEntry };
762
}
packages/client-runtime/src/state/filesystem.test.ts
+22
@@ -3,6 +3,7 @@ import { AuthFilesystemReadScope, AuthOrchestrationReadScope } from "@t3tools/co
3
4
import {
5
createBrowseNavigationCoordinator,
6
+ filterFilesystemBrowseEntries,
7
getFilesystemBrowsePath,
8
getFilesystemBrowseTabCompletion,
9
resolveFilesystemReadAccess,
@@ -107,6 +108,27 @@ describe("filesystem browse model", () => {
108
});
109
expect(getFilesystemBrowseTabCompletion([], "x")).toBeNull();
110
});
111
+
112
+ it("matches folder names stored decomposed, as macOS Finder names them", () => {
113
+ const entry = { name: "De\u0301veloppement", fullPath: "/Users/me/De\u0301veloppement" };
114
+ expect(filterFilesystemBrowseEntries([entry], "d\u00e9v")).toEqual({
115
+ visibleEntries: [entry],
116
+ exactEntry: null,
117
+ });
118
+ expect(filterFilesystemBrowseEntries([entry], "De").visibleEntries).toEqual([entry]);
119
+ expect(filterFilesystemBrowseEntries([entry], "D\u00e9veloppement").exactEntry).toBe(entry);
120
+ // Linux keeps both spellings as separate folders; the one typed exactly wins.
121
+ const composed = { name: "D\u00e9veloppement", fullPath: "/home/me/D\u00e9veloppement" };
122
+ expect(filterFilesystemBrowseEntries([entry, composed], "D\u00e9veloppement").exactEntry).toBe(
123
+ composed,
124
+ );
125
+ // Two spellings that both normalize to the query are ambiguous; neither is picked.
126
+ const angstroms = [
127
+ { name: "\u212B", fullPath: "/home/me/\u212B" },
128
+ { name: "A\u030A", fullPath: "/home/me/A\u030A" },
129
+ ];
130
+ expect(filterFilesystemBrowseEntries(angstroms, "\u00C5").exactEntry).toBeNull();
131
+ });
132
});
133
134
describe("browse navigation", () => {
packages/client-runtime/src/state/filesystem.ts
+12
-2
@@ -74,15 +74,25 @@ export function filterFilesystemBrowseEntries(
74
entries: ReadonlyArray<FilesystemBrowseEntry>,
75
query: string,
76
) {
77
+ // macOS Finder stores names decomposed (NFD), while typed text is composed (NFC).
78
+ const normalizedQuery = query.normalize("NFC");
79
const lowerQuery = query.toLowerCase();
80
+ const lowerNormalizedQuery = normalizedQuery.toLowerCase();
81
const showHidden = query.startsWith(".");
82
const visibleEntries = entries.filter(
83
(entry) =>
81
- entry.name.toLowerCase().startsWith(lowerQuery) &&
84
+ (entry.name.toLowerCase().startsWith(lowerQuery) ||
85
+ entry.name.normalize("NFC").toLowerCase().startsWith(lowerNormalizedQuery)) &&
86
(showHidden || !entry.name.startsWith(".")),
87
);
88
+ const normalizedMatches = visibleEntries.filter(
89
+ (entry) => entry.name.normalize("NFC") === normalizedQuery,
90
+ );
91
const exactEntry =
85
- query.length > 0 ? (visibleEntries.find((entry) => entry.name === query) ?? null) : null;
92
+ query.length > 0
93
+ ? (visibleEntries.find((entry) => entry.name === query) ??
94
+ (normalizedMatches.length === 1 ? normalizedMatches[0] : null))
95
+ : null;
96
97
return { visibleEntries, exactEntry };
98
}