The best way to control Claude Code, Codex and more from any computer or phone
fix(shared): find in thread matches a word typed with a curly apostrophe (#29759)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Alex Southwell committed
Nov 3, 2026 at 23:28 UTC
31564dece84fa99e2abde8a22ed346b675384565
2 files changed
+10
-2
packages/shared/src/threadSearch.test.ts
+5
@@ -12,3 +12,8 @@ it("matches both Greek sigma forms without changing source offsets", () => {
12
expect(findThreadSearchOccurrences("ΟΣ ος οσ", "ς")).toEqual([1, 4, 7]);
13
expect(findThreadSearchOccurrences("İ ΟΣ", "Σ")).toEqual([3]);
14
});
15
+
16
+it("matches straight and curly apostrophes without changing source offsets", () => {
17
+ expect(findThreadSearchOccurrences("don't don’t", "don’t")).toEqual([0, 6]);
18
+ expect(findThreadSearchOccurrences("İ don‘t", "don't")).toEqual([2]);
19
+});
packages/shared/src/threadSearch.ts
+5
-2
@@ -1,10 +1,13 @@
1
+// A typed straight apostrophe finds a curly one: iOS keyboards type "’".
2
+const foldCharacters = (text: string) => text.replace(/ς/g, "σ").replace(/[‘’]/g, "'");
3
+
4
function foldThreadSearchCase(text: string): string {
2
- const lowered = text.toLowerCase().replace(/ς/g, "σ");
5
+ const lowered = foldCharacters(text.toLowerCase());
6
if (lowered.length === text.length) return lowered;
7
8
let folded = "";
9
for (const character of text) {
7
- const loweredCharacter = character.toLowerCase().replace(/ς/g, "σ");
10
+ const loweredCharacter = foldCharacters(character.toLowerCase());
11
folded += loweredCharacter.length === character.length ? loweredCharacter : character;
12
}
13
return folded;