fix(tui): truncate project picker paths (#39678)

This commit is contained in:
Kit Langton 2026-07-30 13:13:31 -04:00 committed by GitHub
commit ce7a7e4e23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 9 deletions

View file

@ -14,6 +14,11 @@ describe("truncateFilePath", () => {
expect(truncateFilePath(path, 19)).toBe("…/dialog-select.tsx")
})
test("uses remaining width for part of a long parent segment", () => {
const path = "/private/var/folders/run-17f048ec-dbb2-4b36-860c-98637bb51a8d/files"
expect(truncateFilePath(path, 40)).toBe("/…/run-17f048ec-dbb2-4b36-860c-98…/files")
})
test("preserves the extension when the basename must shrink", () => {
expect(truncateFilePath(path, 16)).toBe("…/dialog-se….tsx")
expect(truncateFilePath("dialog-select.tsx", 12)).toBe("dialog-….tsx")