From 56e68866256d2c9417e9051fe0e18bc3c282efaf Mon Sep 17 00:00:00 2001 From: Wing <44917547+wingleeio@users.noreply.github.com> Date: Sat, 14 Nov 2026 17:06:34 -0700 Subject: [PATCH 1/2] Transcript: a scroll away from the end stays where it was taken Two ways the view was pulled back to the end after a person scrolled away from it: - A send's glide (the prompt rising to the view's top, or a steer's waiting up to 2 s for its prompt to land) went on to the end over a scroll taken meanwhile. A wheel now stops the glide where it is; the old reply keeps the room it held until it's out of view, so nothing shown moves. - A scroll begun within 300 ms of the view's size changing left the end held, and the next resize, however much later (the sidebar, a panel, the window), went back to it. Resting away from the end now lets it go when a person scrolled since the last resize. ui/tests/transcript_scroll_away.test.luau: both fail on main, pass here. The full UI suite passes (1405). Co-Authored-By: Claude Opus 5.5 --- apps/zgx/ui/ds/transcript.luau | 49 ++++++++++- .../ui/tests/transcript_scroll_away.test.luau | 84 +++++++++++++++++++ 2 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 apps/zgx/ui/tests/transcript_scroll_away.test.luau diff --git a/apps/zgx/ui/ds/transcript.luau b/apps/zgx/ui/ds/transcript.luau index 50071c13c..8606ca686 100644 --- a/apps/zgx/ui/ds/transcript.luau +++ b/apps/zgx/ui/ds/transcript.luau @@ -1146,6 +1146,10 @@ local function Transcript(props: Props): Node -- taken meanwhile stays where it went. local function rise(prompt: Message?) ui.after(16, function() + -- (Scrolled meanwhile: the view is the reader's, see `wheeled`.) + if glides ~= turn then + return + end local row_el = prompt and tops[prompt.id] and tops[prompt.id]:peek() local list_el = list:peek() if not row_el or not list_el or row_el.y == nil or list_el.y == nil then @@ -1158,6 +1162,9 @@ local function Transcript(props: Props): Node duration = motion.ms(GLIDE_MS), ease = "outQuad", onComplete = function() + if glides ~= turn then + return + end -- Landed: the old reply lets go of the room it held -- (above the view, so nothing seen moves), and the -- offset says where the list now rests, a real place @@ -1444,6 +1451,18 @@ local function Transcript(props: Props): Node -- (Taken somewhere of their own: a place still to come back to is -- let go.) waiting = nil + -- A send's glide under way (or its prompt still to land, a steer's): + -- the scroll is theirs, so the glide stops where it is rather than + -- pulling the view back to the end. The old reply keeps the room it + -- held until it's out of view (`rested`), so nothing shown moves. + if gliding:peek() then + glides += 1 + if glide then + glide:pause() + glide = nil + end + gliding:set(false) + end return nil end -- When focus last came to something in the list (Tab, ⇧Tab to a row's @@ -1452,6 +1471,8 @@ local function Transcript(props: Props): Node -- While the width is changing (and a moment after): the reading row -- puts the place back as its lines rewrap, the frame they do. local resizing_until = 0 + -- When the view's size last changed. + local resized_at = -math.huge local function find_reading() reading = nil local el = list:peek() @@ -1533,9 +1554,32 @@ local function Transcript(props: Props): Node local function rested() remember() find_reading() - if not at_end:peek() and ui.now() >= resizing_until then + -- Resting away from the end: let go of it once no change of size is + -- under way, or at once if a person scrolled since the last one (a + -- scroll begun just after a resize is theirs; held, the next resize, + -- however much later, would pull the view back to the end). + if not at_end:peek() and (ui.now() >= resizing_until or wheeled_at >= resized_at) then end_held = false end + -- A send's glide a scroll stopped (`wheeled`): the old reply's held + -- room goes once that reply is out of view, where it moves nothing. + local h = held:peek() + if h.id ~= "" and not gliding:peek() then + local r = rows[h.id] + local row_el = r and r.outer:peek() + local el = list:peek() + local away_from_view = not row_el + or not el + or row_el.y == nil + or row_el.height == nil + or el.y == nil + or el.height == nil + or (row_el.y :: number) + (row_el.height :: number) <= (el.y :: number) + or (row_el.y :: number) >= (el.y :: number) + (el.height :: number) + if away_from_view then + held:set { id = "", h = 0 } + end + end end local rest = ui.debounced(offset, 150, { every = true }) -- (A view just made: its place told once it has stood 150 ms.) @@ -1994,7 +2038,8 @@ local function Transcript(props: Props): Node ui.after(48, settle) end if changed then - resizing_until = ui.now() + 300 + resized_at = ui.now() + resizing_until = resized_at + 300 -- At the end: on it still, every frame of the change. if end_held and not gliding:peek() then -- (Asked of the list itself, which lands it as it lays diff --git a/apps/zgx/ui/tests/transcript_scroll_away.test.luau b/apps/zgx/ui/tests/transcript_scroll_away.test.luau new file mode 100644 index 000000000..a4dddd99a --- /dev/null +++ b/apps/zgx/ui/tests/transcript_scroll_away.test.luau @@ -0,0 +1,84 @@ +-- Scrolled away from the end, the view stays where the person took it: it +-- isn't pulled back to the end. (Nov 14: "scrolling gets stuck to the +-- bottom; scroll away and it scrolls you back down".) Two ways it was: +-- - a scroll during a send's glide (the prompt rising to the view's top, or +-- a steer's waiting to land): the glide went on to the end over it; +-- - a scroll begun within moments of the view's size changing: the end +-- stayed held, and the next resize, however much later (the sidebar, a +-- panel, the window), went back to it. +-- On chat_fixture's `long_chat` (ui/long_chat_fixture.luau). + +local function settle(app: any) + app:wait("#never-shown", { timeout_ms = 250 }) + app:frames(10) +end + +local function offset(app: any): number + return app:state("chat.transcript.offset") +end + +-- How far the view is from its end, measured by going there (which holds +-- the end again: only at the close of a test). +local function from_end(app: any): number + local at = offset(app) + app:scroll("#transcript", 1e6) + app:frames(4) + return offset(app) - at +end + +local function open(): any + local app = mount("chat_fixture.luau") + app:resize(960, 700) + app:frames(20) + app:command("long_chat_sent") + app:command("go_s7") + app:frames(30) + settle(app) + return app +end + +local function send(app: any) + app:type("role:textbox", "three and one sounds like the most optional option") + app:key("Enter") +end + +local function scroll_up(app: any) + for _ = 1, 10 do + app:wheel("#transcript", { dy = -40 }) + app:frames(1) + end +end + +test("scrolled up while a send glides, the view stays where it was taken", function() + local app = open() + send(app) + app:frames(3) + scroll_up(app) + settle(app) + settle(app) + expect(from_end(app) > 100).to_be(true) +end) + +test("scrolled up just after a resize, a later resize leaves the view where it was", function() + local app = open() + send(app) + app:frames(40) + settle(app) + for _ = 1, 60 do + app:command("long_chat_streams") + app:frames(2) + end + app:frames(10) + app:resize(940, 700) + app:frames(2) + scroll_up(app) + -- (It rests inside the resize's moment, then a while.) + settle(app) + app:wait("#never-shown", { timeout_ms = 800 }) + local at = offset(app) + app:resize(900, 700) + app:frames(10) + settle(app) + expect(math.abs(offset(app) - at) < 1).to_be(true) + expect(from_end(app) > 100).to_be(true) +end) From 55a5c392199ca0f7907c485b57b6a4252cc42e98 Mon Sep 17 00:00:00 2001 From: Wing <44917547+wingleeio@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:41:46 -0700 Subject: [PATCH 2/2] Zeron 0.3.7: Cloud chats switch accounts; a scroll away stays away 0.3.6 plus: - A Cloud chat's model menu offers Cloud's accounts again, to switch the provider account every Cloud machine uses (#1467). - The transcript no longer pulls you back to the end after you scroll away: not during a send's glide, nor at a resize after a scroll (#1450). Version 0.3.7. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 68 ++++++++++++++++++++++----------------------- Cargo.toml | 2 +- apps/zgx/Cargo.lock | 24 ++++++++-------- 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3e914104a..4d3ae0f14 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13347,7 +13347,7 @@ dependencies = [ [[package]] name = "zatex" -version = "0.3.6" +version = "0.3.7" dependencies = [ "tiny-skia", "ttf-parser", @@ -13598,7 +13598,7 @@ dependencies = [ [[package]] name = "zeron" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "clap", @@ -13623,7 +13623,7 @@ dependencies = [ [[package]] name = "zeron-audio" -version = "0.3.6" +version = "0.3.7" dependencies = [ "base64 0.22.1", "cpal 0.18.2", @@ -13635,7 +13635,7 @@ dependencies = [ [[package]] name = "zeron-cli" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "clap", @@ -13651,7 +13651,7 @@ dependencies = [ [[package]] name = "zeron-client" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "async-trait", @@ -13682,7 +13682,7 @@ dependencies = [ [[package]] name = "zeron-doc" -version = "0.3.6" +version = "0.3.7" dependencies = [ "chrono", "loro", @@ -13697,7 +13697,7 @@ dependencies = [ [[package]] name = "zeron-engine" -version = "0.3.6" +version = "0.3.7" dependencies = [ "alacritty_terminal", "anyhow", @@ -13757,7 +13757,7 @@ dependencies = [ [[package]] name = "zeron-harness" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "async-trait", @@ -13791,7 +13791,7 @@ dependencies = [ [[package]] name = "zeron-launch" -version = "0.3.6" +version = "0.3.7" dependencies = [ "libc", "tempfile", @@ -13800,14 +13800,14 @@ dependencies = [ [[package]] name = "zeron-markdown" -version = "0.3.6" +version = "0.3.7" dependencies = [ "pulldown-cmark", ] [[package]] name = "zeron-mcp" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "async-trait", @@ -13829,7 +13829,7 @@ dependencies = [ [[package]] name = "zeron-mobile" -version = "0.3.6" +version = "0.3.7" dependencies = [ "async-trait", "serde", @@ -13856,14 +13856,14 @@ dependencies = [ [[package]] name = "zeron-mobile-bindgen" -version = "0.3.6" +version = "0.3.7" dependencies = [ "uniffi", ] [[package]] name = "zeron-notify" -version = "0.3.6" +version = "0.3.7" dependencies = [ "objc", "sha2", @@ -13872,11 +13872,11 @@ dependencies = [ [[package]] name = "zeron-orb" -version = "0.3.6" +version = "0.3.7" [[package]] name = "zeron-plugin-guard" -version = "0.3.6" +version = "0.3.7" dependencies = [ "serde_json", "tempfile", @@ -13884,7 +13884,7 @@ dependencies = [ [[package]] name = "zeron-preview" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "async-trait", @@ -13914,11 +13914,11 @@ dependencies = [ [[package]] name = "zeron-preview-label" -version = "0.3.6" +version = "0.3.7" [[package]] name = "zeron-proto" -version = "0.3.6" +version = "0.3.7" dependencies = [ "chrono", "pulldown-cmark", @@ -13929,7 +13929,7 @@ dependencies = [ [[package]] name = "zeron-rpc" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "async-trait", @@ -13950,7 +13950,7 @@ dependencies = [ [[package]] name = "zeron-sync" -version = "0.3.6" +version = "0.3.7" dependencies = [ "base64 0.22.1", "block2 0.6.2", @@ -13976,7 +13976,7 @@ dependencies = [ [[package]] name = "zeron-syntax" -version = "0.3.6" +version = "0.3.7" dependencies = [ "thiserror 2.0.20", "tree-sitter", @@ -14011,14 +14011,14 @@ dependencies = [ [[package]] name = "zeron-term" -version = "0.3.6" +version = "0.3.7" dependencies = [ "alacritty_terminal", ] [[package]] name = "zeron-term-link" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "async-trait", @@ -14035,7 +14035,7 @@ dependencies = [ [[package]] name = "zeron-text" -version = "0.3.6" +version = "0.3.7" dependencies = [ "core-foundation 0.10.1", "core-graphics 0.24.0", @@ -14052,7 +14052,7 @@ dependencies = [ [[package]] name = "zeron-theme" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "clap", @@ -14067,7 +14067,7 @@ dependencies = [ [[package]] name = "zeron-ui" -version = "0.3.6" +version = "0.3.7" dependencies = [ "alacritty_terminal", "anyhow", @@ -14150,7 +14150,7 @@ dependencies = [ [[package]] name = "zeron-update" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "futures", @@ -14167,11 +14167,11 @@ dependencies = [ [[package]] name = "zeron-veil" -version = "0.3.6" +version = "0.3.7" [[package]] name = "zeron-visual" -version = "0.3.6" +version = "0.3.7" dependencies = [ "base64 0.22.1", "gltf", @@ -14183,7 +14183,7 @@ dependencies = [ [[package]] name = "zeron-visual-gpu" -version = "0.3.6" +version = "0.3.7" dependencies = [ "image", "pollster 0.4.0", @@ -14194,7 +14194,7 @@ dependencies = [ [[package]] name = "zeron-voice" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "cpal 0.17.3", @@ -14213,7 +14213,7 @@ dependencies = [ [[package]] name = "zeron-voice-media" -version = "0.3.6" +version = "0.3.7" dependencies = [ "async-trait", "semver", @@ -14228,7 +14228,7 @@ dependencies = [ [[package]] name = "zeron-voice-session" -version = "0.3.6" +version = "0.3.7" dependencies = [ "async-trait", "futures", diff --git a/Cargo.toml b/Cargo.toml index 82952d84d..7865ac29a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ members = [ ] [workspace.package] -version = "0.3.6" +version = "0.3.7" edition = "2024" license = "MIT" publish = false diff --git a/apps/zgx/Cargo.lock b/apps/zgx/Cargo.lock index 482ff60eb..d096e16e9 100644 --- a/apps/zgx/Cargo.lock +++ b/apps/zgx/Cargo.lock @@ -7067,7 +7067,7 @@ dependencies = [ [[package]] name = "zatex" -version = "0.3.6" +version = "0.3.7" dependencies = [ "ttf-parser", ] @@ -7233,7 +7233,7 @@ checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" [[package]] name = "zeron-cli" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "clap", @@ -7248,7 +7248,7 @@ dependencies = [ [[package]] name = "zeron-launch" -version = "0.3.6" +version = "0.3.7" dependencies = [ "libc", "windows-sys 0.61.2", @@ -7256,7 +7256,7 @@ dependencies = [ [[package]] name = "zeron-notify" -version = "0.3.6" +version = "0.3.7" dependencies = [ "objc", "sha2", @@ -7265,18 +7265,18 @@ dependencies = [ [[package]] name = "zeron-plugin-guard" -version = "0.3.6" +version = "0.3.7" dependencies = [ "serde_json", ] [[package]] name = "zeron-preview-label" -version = "0.3.6" +version = "0.3.7" [[package]] name = "zeron-proto" -version = "0.3.6" +version = "0.3.7" dependencies = [ "chrono", "pulldown-cmark 0.12.2", @@ -7287,7 +7287,7 @@ dependencies = [ [[package]] name = "zeron-theme" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "clap", @@ -7301,7 +7301,7 @@ dependencies = [ [[package]] name = "zeron-update" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "futures", @@ -7318,7 +7318,7 @@ dependencies = [ [[package]] name = "zeron-visual" -version = "0.3.6" +version = "0.3.7" dependencies = [ "base64 0.22.1", "gltf", @@ -7330,7 +7330,7 @@ dependencies = [ [[package]] name = "zeron-visual-gpu" -version = "0.3.6" +version = "0.3.7" dependencies = [ "pollster", "tracing", @@ -7340,7 +7340,7 @@ dependencies = [ [[package]] name = "zeron-voice" -version = "0.3.6" +version = "0.3.7" dependencies = [ "anyhow", "cpal",