Skip to content

ariadne(tui): tvision backend — native desktop chrome around hosted FTXUI content - #711

Merged
transfix merged 1 commit into
masterfrom
feat/ariadne-tvision-backend
Oct 19, 2026
Merged

transfix merged 1 commit into
masterfrom
feat/ariadne-tvision-backend

Conversation

@transfix

Copy link
Copy Markdown
Owner

The tvision terminal backend (roadmap §16.5 row 5), the native-desktop counterpart of the FTXUI backend. Stacked on #709, which is itself stacked on #708. This PR's own change is the top commit.

Design: native chrome, shared content

Turbo Vision owns the terminal and draws the chrome natively:

  • movable, resizable, overlapping windows with close and zoom boxes;
  • a pull-down menu bar and a status line;
  • its own keys: F10, F6, Alt-X, Ctrl-F5.

The window contents come from the FTXUI backend, through a new hosted mode in FtxuiBackend (Options::hosted). So both terminal backends share one widget engine, focus model and set of commit rules, and there is no second widget implementation to keep in sync. FTXUI is only a layout engine here; it never touches the terminal.

What hosted mode does:

  • It draws no window frames and no menu bar. Each window's body is kept per walk and laid out on demand at the host's size: render_window(id, w, h) returns TermRows (glyph + SGR colour + styles).
  • The menu bar becomes a model (hosted_menus) whose items the host activates (activate_menu_item).
    • Hosted menus join the walk from the second frame. Otherwise a menu toggle bound to a window's tree.<id>.open (as in terminal_tour.ari) would seed that key closed before the window could seed it open. That's the first-frame order ImGui/FTXUI have, since there a menu first runs when the user opens it.
  • Input arrives per window in that window's own cells (feed_window). Tab and arrow focus moves stay inside the window, and a combo's list opens inside it.
  • The host reports window bounds (set_window_geometry, persisted to tree.<id>.geometry) and the screen size, and asks for closes (close_window).

TvisionBackend subclasses FtxuiBackend in that mode. Each sync runs one walk and reconciles tvision with it:

  • TWindows are created at the document's placement, retitled, and destroyed when the document stops drawing them. Destruction always waits until the event that caused it has finished.
  • The menu bar is rebuilt when its model changes, but never while it is executing.
  • A background view holds widgets that sit outside any window.

Content views blit the hosted cells. FTXUI lays out at truecolor for the run and tvision quantizes to the terminal. tvision's mouse drag loop and key events are fed back to the backend. Windows get ofFirstClick, so the click that raises a window also reaches the widget under it. Ctrl-C / Ctrl-\ and OS signals follow the same on_signal: routing as the FTXUI loop.

Build and packaging

  • CVC_ARIADNE_TVISION (default ON) is the feature flag the roadmap keeps for tvision's Borland-derived licensing. The backend builds when tvision + ncursesw + FTXUI are found, in shared builds only.
  • tvision is a static, position-independent archive with no CMake package, so it is found by path. It is linked BUILD-only, so no absolute path reaches the exported targets.
  • CI installs tvision alongside the other optional Ariadne deps, so the real path is compiled there.
  • ari run --backend tvision runs it. When TERMINFO_DIRS is unset, ari points ncurses at the prefix's bundled share/terminfo.

Verification

  • ariadne_ftxui_test 40/40, including:
    • 6 new hosted-mode tests: bodies plus menu model, per-window input with scoped focus, menu activation, host close and placement, combo lists inside the window, and the menu-toggle seeding order;
    • a TvisionBackend sanity test.
  • ctest -R Ariadne 376/376; full build green.
  • Real terminal (tmux, --backend tvision):
    • the tour renders in native windows and both the menu bar and the status line appear;
    • a first click on an inactive window toggles the checkbox under it;
    • Tab and Enter work inside a window;
    • dragging a window by its title moves it, with native z-order;
    • the close box closes a window (tree.<id>.open);
    • F10 menus toggle the Status window;
    • File › Quit by mouse, Alt-X, and the tour's ask-then-quit Ctrl-C all exit 0.

Known limits

  • tvision's keyboard menu navigation is its own: F10 then Down opens the dropdown. In my test a second Down did not move off the first item; mouse selection works.
  • snapshot and check always lay out with FTXUI, since tvision needs a terminal.
  • The libcvc cvcpkg recipe does not declare tvision yet, so the published SDK carries the stub until it does.

@transfix
transfix force-pushed the feat/ariadne-tui-followups branch from 622b2ff to 48a4e3a Compare October 19, 2026 05:09
@transfix
transfix force-pushed the feat/ariadne-tvision-backend branch from d004cfd to 98e2372 Compare October 19, 2026 05:09
@transfix
transfix force-pushed the feat/ariadne-tui-followups branch from 48a4e3a to d77c663 Compare October 19, 2026 06:15
@transfix
transfix force-pushed the feat/ariadne-tvision-backend branch from 98e2372 to 74b1bc9 Compare October 19, 2026 06:15
@transfix
transfix force-pushed the feat/ariadne-tui-followups branch from d77c663 to f34f9fd Compare October 19, 2026 06:29
@transfix
transfix force-pushed the feat/ariadne-tvision-backend branch from 74b1bc9 to b553c5f Compare October 19, 2026 06:29
…TXUI content

cvc::ariadne::TvisionBackend (roadmap §16.5 row 5): Turbo Vision owns the
terminal and draws movable, resizable, overlapping windows with close / zoom
boxes, a pull-down menu bar and a status line. The window contents are the FTXUI
backend's, through a new hosted mode in FtxuiBackend (Options::hosted):

- no window frames or menu bar are drawn; each window's body is kept per walk
  and laid out on demand at the host's size (render_window -> TermRows of
  glyph + SGR colours + styles);
- the menu bar becomes a model (hosted_menus) whose items the host activates
  (activate_menu_item); hosted menus join the walk from the second frame so a
  menu toggle cannot seed a window's tree.<id>.open closed before the window
  seeds it open;
- input arrives per window in its own cells (feed_window); focus moves stay
  inside that window; combo lists open inside it;
- the host reports window bounds (set_window_geometry, persisted to
  tree.<id>.geometry), closes windows (close_window) and the screen size.

TvisionBackend subclasses FtxuiBackend in that mode: each sync runs a walk and
reconciles tvision with it (TWindows created at the document's placement,
retitled, destroyed when the document stops drawing them; the menu bar rebuilt
when its model changes, never while it is executing; a background view for
widgets outside windows). Content views blit the hosted cells (tvision
quantizes colours; FTXUI lays out at truecolor for the run) and feed tvision's
mouse (drag loop) and keys back. Ctrl-C / Ctrl-\ and OS signals follow the same
on_signal routing as the FTXUI loop.

Built behind CVC_ARIADNE_TVISION when tvision + ncursesw + FTXUI are found
(shared builds; linked BUILD-only so no path reaches the exported targets).
`ari run --backend tvision`; ari points ncurses at the prefix's bundled
terminfo when TERMINFO_DIRS is unset. CI installs tvision with the other
optional Ariadne deps.
@transfix
transfix changed the base branch from feat/ariadne-tui-followups to master October 19, 2026 16:05
@transfix
transfix force-pushed the feat/ariadne-tvision-backend branch from b553c5f to fa2e152 Compare October 19, 2026 16:05
@transfix
transfix merged commit 0a41daf into master Oct 19, 2026
14 of 18 checks passed
@transfix
transfix deleted the feat/ariadne-tvision-backend branch October 29, 2026 20:52
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