Skip to content

palette: a title with a dotted capital İ no longer throws or shifts its underlines - #267

Open
connorburgess wants to merge 3 commits into
spacesheep-dev:mainfrom
connorburgess:fix/palette-dotted-capital-i
Open

connorburgess wants to merge 3 commits into
spacesheep-dev:mainfrom
connorburgess:fix/palette-dotted-capital-i

Conversation

@connorburgess

@connorburgess connorburgess commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Updated against v0.8.18 / main d16a2c01 on 2026-12-05. Current validation and refresh details.

What

If a session title, machine, repo, branch or file name contains a dotted capital İ (U+0130, as in "İstanbul" or "İzmir"), the command palette now underlines the characters that actually matched. Before this change the underlines were shifted one character to the right, and when the last match fell on the final character the matcher threw during render and took the page down. The same fix applies to the other pickers that use fuzzy(): Move under, Move to folder, the Files drawer and palette file search.

Why

fuzzy() in web/src/lib/fuzzy.ts lowercases the query and the text with toLowerCase(), then uses indexes into the lowercased string as indexes into the original text (isWordStart(text, i) and the returned positions). İ is the only character whose default lowercase is longer than itself: it becomes "i" plus U+0307, which is two UTF-16 units where the text has one. I checked every code point with Node 22, and U+0130 is the only one. So every index after an İ is one too far:

  • fuzzy("pay", "İstanbul payments") returned [10, 11, 12], which underlines "aym".
  • fuzzy("s", "İstanbul payments") and fuzzyFields("ments", ["Claude", "İzmir deployments"]) threw TypeError: Cannot read properties of undefined (reading 'toLowerCase'), because isWordStart(text, text.length) passes undefined to isUpper. web/src has no error boundary.

The fix is one line: every İ is replaced by a plain "i" before the string is lowercased, in both the query and the text. The lowercased string then has the same length as the original, so its indexes line up with the original. Strings with no İ are lowercased exactly as before, and replacing İ first does not change how the rest of the string is lowercased. A word-final Σ still becomes ς, the Kelvin sign still matches k, and there is still no case folding (ss does not match ß).

One other function also maps indexes from a transformed string back to the original: fold() in web/src/search/inPage.ts. It handles İ correctly, because NFD followed by stripping combining marks turns it into a plain i of the same length, so this PR leaves it alone.

An entry is now included under Unreleased in CHANGELOG.md. Other open PRs also add release notes; those entries may need combining as the PRs land.

Original proof (before the v0.8.18 refresh)

New web/src/lib/fuzzy.test.ts, 7 tests. Against the unmodified web/src/lib/fuzzy.ts from origin/main 1a475e8, 5 of them fail:

 FAIL  web/src/lib/fuzzy.test.ts > fuzzy > underlines the right characters after a dotted capital İ
AssertionError: expected [ 10, 11, 12 ] to deeply equal [ 9, 10, 11 ]
 FAIL  ... > does not throw on a match at the end of a text with a dotted capital İ
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
 ❯ isUpper web/src/lib/fuzzy.ts:23:40
 ❯ isWordStart web/src/lib/fuzzy.ts:32:27
 FAIL  ... > matches a dotted capital İ as an i, in the text and in the query
AssertionError: expected [ +0, 2, 3 ] to deeply equal [ +0, 1, 2 ]
 FAIL  ... > still lowers a word-final sigma in a text with a dotted capital İ
AssertionError: expected [ 7, 8, 9, 10 ] to deeply equal [ 6, 7, 8, 9 ]
 FAIL  ... fuzzyFields > does not throw on a field with a dotted capital İ and underlines the right characters
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
      Tests  5 failed | 2 passed (7)

With this branch:

$ npx vitest run web/src/lib/fuzzy.test.ts
 Test Files  1 passed (1)
      Tests  7 passed (7)

The two tests that pass on main show that a plain match is unchanged, and that the Kelvin sign, the final sigma and ß behave as before for text with no İ.

Other checks on this branch (macOS, Node 22):

  • npm run typecheck: passes (both tsconfigs).
  • npm run lint: exit 0. It reports 135 warnings and 1 info, all in files this PR does not change; npx biome check on the two changed files reports nothing.
  • npm test: Test Files 1 failed | 248 passed (249), Tests 1 failed | 3373 passed | 2 skipped (3376). The one failure is server/control/remote.parity.test.ts, TestTimeoutError: Test timed out in 15000ms at line 343, during the full run. Run on its own, that file passes 11/11 on this branch and on unmodified origin/main, and this PR touches nothing it imports.
  • npm run build: passes (✓ built; Vite reports its usual chunk-size and dynamic-import warnings).

Not run: npm run test:e2e (Playwright). This changes a pure function under web/src/lib and does not change any layout, so there is no screenshot. Windows: not run, because I had no Windows VM available; the change does not depend on the platform.

Checklist

  • Every commit is signed off (git commit -s): the DCO is the only paperwork.
  • npm run typecheck && npm run lint && npm test pass; npm run test:e2e for a UI change. The one npm test failure is the parity timeout above. e2e was not run (no layout change).
  • New source files start with // SPDX-License-Identifier: Apache-2.0.
  • No secret, real address, hostname or home path in code, fixtures or screenshots (screenshots come from --demo).
  • A change to shared/* names the wire-contract change in the description. This PR does not change shared/*.
  • A line under Unreleased in CHANGELOG.md.

…ts underlines

Symptom: typing in the command palette when a session title, machine,
branch or file name holds "İ" (U+0130) underlined the wrong characters
("pay" in "İstanbul payments" underlined "aym"), and a match on the last
character threw "Cannot read properties of undefined (reading
'toLowerCase')" during render, taking the page down.

Cause: fuzzy() lowered the query and the text with toLowerCase() and used
indexes into the lowered string against the original text. "İ" lowercases
to "i" plus a combining dot, two UTF-16 units where the text has one, so
every index after it ran one past the text, up to text.length.

Fix: lower both strings with every İ first replaced by a plain "i", so
they keep their length and an index into the lowered text is an
index into the text. A string without an İ is lowered exactly as before.

Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
@connorburgess

Copy link
Copy Markdown
Contributor Author

The dotted capital İ palette matching fix still applies to SessionPipe GUI v0.8.18. Merged current main (d16a2c01) into this branch; the refreshed head is 2b43327d. The affected files have not changed upstream, and the original change is preserved.

Added the previously deferred Unreleased changelog entry.

Validation on this head, macOS / Node 22.23.2:

  • npm run typecheck, npm run lint, and npm run build passed. Lint has the same 135 warnings and one informational diagnostic as current main, with no errors.
  • npx vitest run --maxWorkers=2 web/src/lib/fuzzy.test.ts: 7 tests passed.

GitHub CI run 47453786344 for head 2b43327d passed: typecheck · lint · unit · build, all three desktop e2e shards, e2e (phone · duo), e2e (control channel), and the aggregate typecheck · lint · unit · build · e2e gate.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant