diff --git a/src/lib/NodeArrayProperty.svelte b/src/lib/NodeArrayProperty.svelte index 7b03900c..004632ec 100644 --- a/src/lib/NodeArrayProperty.svelte +++ b/src/lib/NodeArrayProperty.svelte @@ -102,4 +102,23 @@ min-width: 24px; cursor: pointer; } + + /* Reserve room at the scroll edges so the browser's caret-follow scroll + (when typing at the end of an overflowing node) can't pin the caret + flush against the array's clip edge. Without this padding, scrollLeft + stops just short of `scrollWidth - clientWidth - EDGE_TOLERANCE_PX`, + leaving `edge_map.last` false; the trailing gap never gains + `.positioned`, and the user sees the caret at the edge with no gap to + click. The default is 2 × edge-gap (≈ enough for the gap plus a + click margin); override per-array via the custom properties. */ + :global([data-type="node_array"]) { + scroll-padding-inline: var( + --node-caret-scroll-padding-inline, + calc(var(--node-caret-edge-gap, 24px) * 2) + ); + scroll-padding-block: var( + --node-caret-scroll-padding-block, + calc(var(--node-caret-edge-gap, 24px) * 2) + ); + } \ No newline at end of file diff --git a/src/lib/NodeGapMarkers.svelte b/src/lib/NodeGapMarkers.svelte index 5c223fd1..427db67b 100644 --- a/src/lib/NodeGapMarkers.svelte +++ b/src/lib/NodeGapMarkers.svelte @@ -94,10 +94,14 @@ if (sorted[0] === 0 && edge_state?.first === true) { add_offset(0); } - // Mid gaps: between consecutive visible nodes. The gap at offset N - // sits between node N-1 and node N — emit when both are visible. - for (let i = 0; i < sorted.length - 1; i++) { - if (sorted[i + 1] === sorted[i] + 1) add_offset(sorted[i + 1]); + // Mid gaps: anchor to the previous node. Emit a marker whenever the + // prev flank is visible, even if next falls outside the overscan — + // mirrors the NodeGap gate in node_visibility.svelte.js. Wrap/grid + // layouts whose row height exceeds the overscan (e.g. tetris with + // tall cells) would otherwise lose every between-row marker even + // while the user can see and click the underlying NodeGap. + for (const i of sorted) { + if (i + 1 > 0 && i + 1 < count) add_offset(i + 1); } // Edge gap-after.last: same gate as gap-before but on the trailing edge. if (sorted[sorted.length - 1] === count - 1 && edge_state?.last === true) { diff --git a/src/lib/Svedit.svelte b/src/lib/Svedit.svelte index 0994f4a2..1d76035f 100644 --- a/src/lib/Svedit.svelte +++ b/src/lib/Svedit.svelte @@ -1,5 +1,5 @@