Skip to content

Commit d676efa

Browse files
committed
Bugfix: hide Brief cursor while column widths load
Entering a new dir cleared `columnWidths`, so for one frame every column rendered at the `capPx` fallback (≈ full pane width), making the cursor stripe momentarily fill the entire pane. - Gate `is-under-cursor` on `columnWidths.length > 0` so no cursor stripe renders at the fallback width. - Skip the 50 ms coalesce on the first fetch (empty `columnWidths`) so the cursor-hidden gap is as short as possible; subsequent re-fetches still coalesce.
1 parent 5025b39 commit d676efa

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

apps/desktop/src/lib/file-explorer/views/BriefList.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,13 @@
358358
function fetchColumnWidths() {
359359
if (!listingId || itemsPerColumn <= 0) return
360360
cancelPendingFetch()
361+
// First fetch (no widths yet, for example after entering a new dir) fires
362+
// immediately so the cursor-hidden gap is as short as possible. Subsequent
363+
// re-fetches keep the 50 ms coalesce to absorb resize bursts.
364+
if (columnWidths.length === 0) {
365+
void doFetchColumnWidths(false)
366+
return
367+
}
361368
pendingFetchTimer = setTimeout(() => {
362369
pendingFetchTimer = null
363370
void doFetchColumnWidths(false)
@@ -787,7 +794,7 @@
787794
<div
788795
id={`file-${String(globalIndex)}`}
789796
class="file-entry"
790-
class:is-under-cursor={globalIndex === cursorIndex}
797+
class:is-under-cursor={globalIndex === cursorIndex && columnWidths.length > 0}
791798
class:is-selected={selectedIndices.has(globalIndex)}
792799
class:is-striped={stripedRows && globalIndex % 2 === 1}
793800
class:is-restricted={fileIsRestricted}

apps/desktop/src/lib/file-explorer/views/CLAUDE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ array (`$derived`) drives all virtual-scroll math: `totalSize` is the final pref
9393
binary-searches `prefixSums` for the visible range, and `getScrollToPositionVariable` looks up exact column edges.
9494
Scrollbar size and cursor visibility now agree with what's actually rendered. `transition: width 300ms ease` still
9595
animates width changes within a directory; nav resets snap via the `skipTransition` 2-rAF trick. While widths are in
96-
flight (first paint, after `FontMetricsNotReady`), every column renders at `capPx` as a fallback.
96+
flight (first paint, after `FontMetricsNotReady`), every column renders at `capPx` as a fallback, and the cursor
97+
highlight is suppressed until `columnWidths.length > 0` so the user doesn't see a full-pane-wide cursor stripe for a
98+
frame. The initial fetch after a dir change skips the 50 ms coalesce so that gap is as short as possible; re-fetches
99+
during resize keep the coalesce.
97100

98101
**Decision**: A single `$effect` keeps the cursor in view, depending on `cursorIndex`, `containerWidth`,
99102
`containerHeight`, and `columnWidths.length` **Why**: With exact prefix-sum math, every input that could move the

0 commit comments

Comments
 (0)