Repository navigation
palette: a title with a dotted capital İ no longer throws or shifts its underlines - #267
Open
connorburgess wants to merge 3 commits into
Open
connorburgess wants to merge 3 commits into
connorburgess wants to merge 3 commits into
Conversation
…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>
Contributor
Author
|
The dotted capital İ palette matching fix still applies to SessionPipe GUI v0.8.18. Merged current Added the previously deferred Unreleased changelog entry. Validation on this head, macOS / Node 22.23.2:
GitHub CI run 47453786344 for head |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated against v0.8.18 / main
d16a2c01on 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()inweb/src/lib/fuzzy.tslowercases the query and the text withtoLowerCase(), then uses indexes into the lowercased string as indexes into the original text (isWordStart(text, i)and the returnedpositions). İ 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")andfuzzyFields("ments", ["Claude", "İzmir deployments"])threwTypeError: Cannot read properties of undefined (reading 'toLowerCase'), becauseisWordStart(text, text.length)passesundefinedtoisUpper.web/srchas 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 matchesk, and there is still no case folding (ssdoes not matchß).One other function also maps indexes from a transformed string back to the original:
fold()inweb/src/search/inPage.ts. It handles İ correctly, because NFD followed by stripping combining marks turns it into a plainiof 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 unmodifiedweb/src/lib/fuzzy.tsfrom origin/main 1a475e8, 5 of them fail:With this branch:
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 checkon 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 isserver/control/remote.parity.test.ts,TestTimeoutError: Test timed out in 15000msat 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 underweb/src/liband 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
git commit -s): the DCO is the only paperwork.npm run typecheck && npm run lint && npm testpass;npm run test:e2efor a UI change. The onenpm testfailure is the parity timeout above. e2e was not run (no layout change).// SPDX-License-Identifier: Apache-2.0.--demo).shared/*names the wire-contract change in the description. This PR does not changeshared/*.CHANGELOG.md.