╭ changed ──────────╮ │src/embed/script.js│ ╰───────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │291 } else if (bottom > container.scrollTop + container.clientHeight) { │ │292 container.scrollTop = bottom - container.clientHeight; │ │293 } │ │294 - // horizontal-only scrolls are rows of controls, so reveal either │ │295 - // edge. other scrolls reveal only the row's start; chasing varying │ │296 - // right edges while moving vertically would yank their view sideways. │ │297 - if (left < container.scrollLeft) { │ │298 - container.scrollLeft = left; │ │299 - } else if (container.dataset.scrollDirection === "horiz" && right > container.scrollLeft + container.clientWidth) {│ │300 - container.scrollLeft = right - container.clientWidth; │ │294 + // reveal a widget that fits the view's width. a wider one keeps the │ │295 + // horizontal position, which only arrow left/right changes. │ │296 + if (right - left <= container.clientWidth) { │ │297 + if (left < container.scrollLeft) { │ │298 + container.scrollLeft = left; │ │299 + } else if (right > container.scrollLeft + container.clientWidth) { │ │300 + container.scrollLeft = right - container.clientWidth; │ │301 + } │ │302 } │ │303 }, │ │304 }, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────────╮ │src/ui/widget.zig│ ╰─────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │191 // and otherwise shows that edge. │ │192 pub fn scrollToEnteredRow(scroll: *wgt.Scroll(Widget), rect: layout.IRect, down: bool) void { │ │193 const grid = scroll.grid orelse return; │ │194 + // a row wider than the view keeps the horizontal position │ │195 + const target: layout.IRect = if (rect.size.width > grid.size.width - scroll.bar_w) .{ .x = scroll.x, .y = rect.y, .size = .{ .width = 0, .height = rect.size.height } } else rect;│ │196 const h: isize = @intCast(grid.size.height - scroll.bar_h); │ │195 - if (@as(isize, @intCast(rect.size.height)) <= h) return scroll.scrollToRect(rect); │ │197 + if (@as(isize, @intCast(rect.size.height)) <= h) return scroll.scrollToRect(target); │ │198 const edge = if (down) rect.y else rectBottom(rect) - 1; │ │199 if (edge >= scroll.y and edge < scroll.y + h) return; │ │200 scroll.y = if (down) rect.y else rectBottom(rect) - h; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯