Skip to content

Ariadne: autofocus, password fields, ImGui horizontal rows and grid ids, tvision refit, no scene chrome without a scene - #906

Merged
transfix merged 3 commits into
masterfrom
fix/ariadne-widget-gaps
Oct 30, 2026
Merged

transfix merged 3 commits into
masterfrom
fix/ariadne-widget-gaps

Conversation

@transfix

@transfix transfix commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Fixes six widget and backend gaps that nicotina M0 (cy-pca/nicotina) hit. Each was worked around in nicotina's documents. This PR is independent of #887 and #888.

The fixes

  • Unnamed grids get distinct ids.
    • What was wrong: a grid with no id: or label: went to the backend as "", so every unnamed type: group with a layout: became ImGui's ###grid.. The second one in a window shared the first one's table and drew its auto column one character wide.
    • The fix: the walk now names an unnamed grid by its position in the tree (~0_2_1). Backend state is keyed by that name, and so are tree.<id>.tracks / .columns. The name is a single state-path segment.
  • ImGui: horizontal rows without col_widths.
    • What was wrong: layout: {kind: horizontal} with no col_widths was a one-column table, so a button row stacked vertically in ImGui while FTXUI laid it out side by side.
    • The fix: such a row now flows. Each cell is a group, joined with SameLine. Rows with col_widths, borders or resizable stay tables.
  • tvision windows refit to their content.
    • What was wrong: the tvision host sized a window once, when it opened, so a status line that grew later was clipped. ARIADNE.md §5.8 says a window with no size: fits its content every frame.
    • The fix: a window the document did not size now refits on every walk, in each axis it did not size. Once the user resizes it with tvision's frame, it keeps their size.
  • autofocus: true (any widget).
    • What was wrong: a form opened with nothing focused.
    • The fix: the widget, or the first focusable widget inside it, takes focus when it appears. That means its first frame, and each time it comes back after a frame without it: its window reopened, visible_when true again, a new repeat: instance. It does not hold focus.
    • How it works: the new Backend::focus_next_widget() has a no-op default. FTXUI (and so tvision) focuses the next focusable leaf. ImGui calls SetKeyboardFocusHere().
  • password: true (on input_text).
    • What it does: masks the field. ImGui uses ImGuiInputTextFlags_Password, which also blocks copy and cut. The terminal backends show one • per character.
    • This is masking only. The value is still the bound state key's value; a document should clear the key once it has used it. Backend::input_text gains a masked argument.
  • arigl hides its scene chrome when a document has no scene.
    • What was wrong: arigl drew its grid, axes and bounds box (with Min/Max labels) behind a document with no scene:.
    • The fix: AppRuntime::load now calls a new SceneAdapter::no_scene() for such a document, and arigl's adapter hides the chrome. The next load restores the host's setting. A document with a scene: still controls the chrome itself (scene.chrome), and the Settings menu can still turn it on.

The loader and the embedded schema accept autofocus and password. docs/ARIADNE.md is updated in §4 and §5.8, the grid-sizes paragraph in §7.1, the golden-test gaps note, and a new §5.10 on forms.

Tests

  • ariadne_runtime_test, new tests:
    • UnnamedGridsInOneWindowGetDistinctIds: distinct ids, one path segment, stable from frame to frame, and a named grid keeps its id.
    • AutofocusTakesFocusWhenTheWidgetAppears: one request when the field appears, none while it stays, another after it is hidden and shown again.
    • PasswordFieldReachesTheBackendMasked.
    • EachLoadClearsTheLastScene now expects no_scene for a document without a scene.
  • ariadne_ftxui_test, new tests:
    • AutofocusFieldTakesTheFirstKeys: typing with no Tab edits the field.
    • PasswordFieldShowsAMask: the text is not on screen, the bullets are, and the state holds the text.
  • Native local run (Linux GCC Release, ImGui and tvision on): ctest Ariadne|ari, 593 tests (the regex also takes in some state_exec lock tests), all pass. Under -j16 the two LocksStress.LK18_RandomOperationsKeepInvariants stress tests ran past the 300 s timeout; alone they pass (337 s and about 350 s). This PR does not touch that code.
  • tvision refit, checked by hand under a pty with a document whose status line grows after a button press. The window grows to show the whole line; before this change it stayed clipped.
  • arigl with no scene: arigl snapshot of a widget-only document shows no grid, axes or box.
  • Not checked visually: the ImGui horizontal flow and the ImGui autofocus and password field. Native arigl snapshot captures the VTK view without the ImGui overlay. They compile, and the core side is covered by the runtime tests.

Follow-up

  • A host-held secret field, nicotina's L11 "better still": the host keeps the value, and a request option puts it in the body, so it never enters state (as capture_auth does for tokens).

…ImGui, tvision refit, no scene chrome without a scene

What nicotina M0 hit in the widgets and backends:

- An unnamed grid (no id:, no label:) gets an id from its place in the
  tree ("~0_2_1"), so two in one window no longer share one ImGui table
  ("###grid.") or one tree.<id> key.
- ImGui: a layout {kind: horizontal} row with no col_widths puts its
  cells side by side (a group per cell, SameLine) instead of a
  one-column table. col_widths, borders and resizable keep the table.
- tvision host: a window the document did not size refits its content
  on every walk, per axis, until the user resizes it (ARIADNE.md 5.8).
- autofocus: true on a widget gives it focus when it appears (first
  drawn, or back after a frame without it): Backend::focus_next_widget,
  FTXUI/tvision move their focus to the next focusable leaf, ImGui
  calls SetKeyboardFocusHere.
- password: true on an input_text masks it: ImGui's Password flag, a
  bullet per character in the terminal backends. Masking only; the
  value is still the bound state key's.
- arigl: a document without scene: hides the view's diagnostic chrome
  (grid, axes, bounds box); the next document's load restores the
  host's setting (SceneAdapter::no_scene).
@transfix
transfix enabled auto-merge (squash) October 30, 2026 08:33
@transfix
transfix disabled auto-merge October 30, 2026 08:33
@transfix
transfix enabled auto-merge (squash) October 30, 2026 08:34
The FTXUI test's "•" literal is encoded in MSVC's code page (the test
target has no /utf-8), so it never matched the screen's UTF-8 and
PasswordFieldShowsAMask failed on Windows. Spell U+2022 as its bytes,
as the other tests do, in the test and in the backend.
…widget-gaps

# Conflicts:
#	docs/ARIADNE.md
#	inc/cvc/ariadne/ftxui_backend.h
#	inc/cvc/gl/ariadne/ImGuiBackend.h
#	src/cvc/ariadne/ftxui_backend.cpp
#	src/cvcGL/ariadne/ImGuiBackend.cpp
@transfix
transfix merged commit 5d0a62f into master Oct 30, 2026
26 checks passed
@transfix
transfix deleted the fix/ariadne-widget-gaps branch October 30, 2026 19:27
transfix added a commit to cy-pca/nicotina that referenced this pull request Oct 31, 2026
input_text's password: true (transfix/libcvc#906, merged) draws a bullet per
character in both terminal backends and ImGui's password field in a window.
The value still passes through login.password while it is typed, and the
controller still clears it as soon as it is sent. An older host ignores the
key and shows the text.

Every suite now captures the screen with the password typed: it must show
bullets, and the secret scan makes sure the text never appears. A probe in
tests/lib.sh skips the check on an ari that doesn't mask.
transfix added a commit to cy-pca/nicotina that referenced this pull request Oct 31, 2026
autofocus: true (transfix/libcvc#906) on the sign-in form's Username and the
two-step Code field, each time the form opens, so a person types at once. The
layout groups lose their ids and the button rows their col_widths, which #906
made unnecessary (unnamed grids get distinct ids; ImGui flows a horizontal row).

The fixed 62-column width and the always-present status row stay, for the
tvision host: it refits a window that opens, but a window that closes and opens
again in the same run (the sign-in form after signing out) comes back at its
first size, so a new status line would be cut off.

The tmux key sequences drop the Tab that used to reach the first field; on a
host without #906, form_focus in tests/lib.sh sends it. A focused field draws
its cursor after the text, so the tests match a field by its start.
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