╭ changed ──────────╮ │src/embed/script.js│ ╰───────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │66 return container ? { focused, container } : null; │ │67 } │ │68 │ │69 -// scroll one row while the focused widget continues past the viewport edge. │ │69 +// scroll a step while the focused widget continues past the viewport edge. │ │70 function scrollFocusedWidget(down) { │ │71 + const stepLines = 3; // see step_lines in widget.zig's scrollThroughRow for the terminal equivalent│ │72 const native = focusedNativeScroll(); │ │73 if (!native) return false; │ │74 const viewport = native.container.getBoundingClientRect(); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │76 const overflow = down ? edge.bottom - viewport.bottom : viewport.top - edge.top; │ │77 if (overflow <= 0.5) return false; │ │78 if (!cellHeight) measureCell(); │ │78 - native.container.scrollTop += (down ? 1 : -1) * Math.min(cellHeight, overflow); │ │79 + native.container.scrollTop += (down ? 1 : -1) * Math.min(stepLines * cellHeight, overflow);│ │80 return true; │ │81 } │ │82 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │281 // vertical is the priority axis. keep the viewport in place when it │ │282 // already overlaps a tall widget; otherwise reveal its nearest edge. │ │283 if (bottom - top > container.clientHeight) { │ │283 - container.scrollTop = Math.min(Math.max(container.scrollTop, top), bottom - container.clientHeight);│ │284 + if (bottom <= container.scrollTop) { │ │285 + container.scrollTop = bottom - container.clientHeight; │ │286 + } else if (top >= container.scrollTop + container.clientHeight) { │ │287 + container.scrollTop = top; │ │288 + } │ │289 } else if (top < container.scrollTop) { │ │290 container.scrollTop = top; │ │291 } else if (bottom > container.scrollTop + container.clientHeight) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯