Skip to content

Ariadne tvision: a reopened window fits what it shows then - #930

Merged
transfix merged 1 commit into
masterfrom
claude/tvision-reopen-refit
Oct 31, 2026
Merged

transfix merged 1 commit into
masterfrom
claude/tvision-reopen-refit

Conversation

@transfix

Copy link
Copy Markdown
Owner

On the tvision desktop, a window that closed and opened again in the same run came back at its first size and never refit, so rows it had gained while closed were cut off. nicotina hit it: after signing out, the sign-in window came back without its "Signed out." row (cy-pca/nicotina works around it with a fixed width and an always-present status row). First openings fit, and FTXUI and ImGui fit a reopened window too.

Cause (verified)

The tvision host reports every window's bounds on each walk (set_window_geometry), and FtxuiBackend recorded that size as the window's own (Win.sized). The record outlives the window, so on the reopen hosted_windows() handed the host the old size. The host took it as an authored size and turned fitting off. The same size was also persisted to tree.<id>.geometry, so a seed from it would have done the same.

Fix

  • FtxuiBackend::set_window_geometry(id, x, y, w, h, user_sized): the place is always kept. The size is kept only when the user chose it, and only that size persists, so a fitting window persists x,y,0,0. HostedWindow::user_sized tells the host on a reopen that the size is the user's.
  • tvision host: a window counts as user-sized only from tvision's own user paths: dragView (the frame's corner, or Ctrl-F5 then Shift and the arrows) and zoom. The old test, "the size differs from the last fit", also fired when tvision scaled every window on a terminal resize (TWindow's gfGrowRel), which turned fitting off for good.
  • Until the user resizes a window, the host sizes it on every walk, per axis: the document's size where it gave one, else the content's. It doesn't while a drag is in progress (sfDragging; tvision's drag loop runs the sync between moves). An authored size the user hasn't changed is re-applied too, so percent sizes follow the terminal, as in the FTXUI loop.
  • Ctrl-F5 is now bound to cmResize. ARIADNE.md already listed it among tvision's keys, but the host's status line never bound it.
  • A window's smallest size is the host's fit floor (16×4) instead of tvision's 16×6. Before, any locate (a refit, a drag, the desktop scaling) left a window with 1–2 rows of content two rows taller than that content.

The other backends were checked for consistency, not changed. ImGui gives a window with no size AlwaysAutoResize and ignores a persisted size for it. FTXUI's loop fits it every frame from its per-window record, which only a seed or a host marks sized. Cross-run persistence: none exists (§5.9: geometry "holds for the run and across a reload, but not across runs"). A reload of the same document keeps the backend's records, so a size the user chose holds through it. A new document still lays its windows out afresh.

Tests

  • AriadneFtxuiHosted.AReopenedWindowFitsWhatItShowsThen: a fitting window and a width-authored, auto-height one (nicotina's shape) close, gain a row, and reopen. Both are reported fitting, with the new content size, at their old place.
  • AriadneFtxuiHosted.AWindowTheUserResizedKeepsItsSizeWhenItOpensAgain.
  • ari_run_reopen_refit_ftxui / ari_run_reopen_refit_tvision (tmux, Linux, next to the JSON-feed ones from ci: tmux from cvcpkg on the Linux lanes, so the ari tmux tests run #901): src/ari/tests/reopen_refit_test.sh drives src/ari/tests/reopen_refit.ari with its keys. o signs out and i signs back in, and the reopened windows must show the rows they gained while closed. On tvision it then resizes "Sign in" with Ctrl-F5 / Shift-arrows, signs out and in, and the window must come back at that size.
  • Both kinds fail on the old behaviour (checked by putting back sized = true in set_window_geometry). The tmux test passes with gawk and with mawk.
  • Local (Linux, RelWithDebInfo, tvision on): ariadne_ftxui_test 76/76; ctest -R ari_run_ 4/4.
  • Checked by hand under tmux: a terminal shrink, then growing it back, leaves fitting windows exact; a window the user only moved keeps its place and still refits.

docs/ARIADNE.md §5.8 and §5.9 say how a reopened window is sized and what counts as the user's size on tvision; the tvision keys line spells out Ctrl-F5.

A window that closed and opened again in the same run came back at its first size on the tvision
desktop, so rows it gained while closed were cut off (nicotina's sign-in form after signing out
lost its "Signed out." row). FTXUI and ImGui fit it again.

Cause: the host reports every window's bounds on each walk, and FtxuiBackend::set_window_geometry
took the size as the window's own (Win.sized). That record outlives the window, so the reopen's
hosted_windows() handed the host the old size, which it took as authored and never refit; the
size was also persisted to tree.<id>.geometry.

- set_window_geometry takes user_sized: the place is always kept, the size only when the user
  chose it, and only that size persists. HostedWindow::user_sized tells the host on a reopen.
- The tvision host marks a window user-sized only from tvision's own user paths (dragView: the
  frame's corner and Ctrl-F5; zoom), not from "the size differs from the last fit", which also
  fired when tvision scaled the windows on a terminal resize. Until then it sizes the window on
  every walk from the document's size or the content, and not mid-drag (sfDragging).
- Ctrl-F5 is bound to cmResize, as ARIADNE.md already listed among tvision's keys.
- A window's smallest size is the host's fit floor (16 x 4), not tvision's 16 x 6, so a refit or a
  drag no longer leaves a small window two rows taller than its content.

Tests: AriadneFtxuiHosted.AReopenedWindowFitsWhatItShowsThen and
AWindowTheUserResizedKeepsItsSizeWhenItOpensAgain; ari_run_reopen_refit_ftxui / _tvision run
src/ari/tests/reopen_refit.ari in a tmux pane: its windows gain rows while closed and must show
them, and on tvision a window resized with Ctrl-F5 comes back at that size. Both fail on the old
behaviour. ARIADNE.md §5.8 / §5.9 say how a reopened window is sized.
@transfix
transfix merged commit 6d84dc7 into master Oct 31, 2026
31 of 32 checks passed
@transfix
transfix deleted the claude/tvision-reopen-refit branch October 31, 2026 17:42
transfix added a commit to cy-pca/nicotina that referenced this pull request Oct 31, 2026
)

* Sign-in windows fit what they show; no status row without a message

transfix/libcvc#930 (merged 6d84dc7d) makes the tvision host refit a window that closes and
opens again, so the workaround for it goes: the sign-in, two-step and starting windows lose
their fixed 496 px width, and the status line takes a row only when the controller has a
message. The profile keeps its 76 columns, which is its layout, not the workaround.

tests/run.sh's tvision sign-out step ("Signed out." in the reopened sign-in form) is the check
that the refit works without the workaround.

* tests: a host with open-url adds In browser to each card and the post

transfix/libcvc#916 (merged 19:31 UTC) gives ari open-url, so the documents show their In browser
button: on each feed card after Open, and on the post window in place of its URL. run.sh's
expectations were written for a host without it and failed six steps on libcvc master: the
card's counts row, the post's URL, and Load more, which Tab now reaches ten stops later.

run.sh asks the host (`ari check`, as for image.url and media.player) and expects either layout.

---------

Co-authored-by: tfx <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant