Repository navigation
Ariadne: rich text, runs: on a text: with links (§5.20) - #1180
Merged
Merged
Conversation
A text: with runs: is a paragraph of plain, bold, italic and code runs and links, wrapped to the
width it has. A link runs on_link: (event.href / .text / .index / .link), or, in a list the
document writes itself, the run's own on_click:. Runs from a state path or an expression are
data: their on_click is never run, so text from the network can't carry a program. A click on a
link is the link's, not the text's own on_click: nor a clickable card's around it. nicotina's
posts need it for their mentions, hashtags and URLs (its roadmap L15).
- rich_text.h / rich_text.cpp: layout_rich_text, the one line breaker every backend uses (a
break at a space between words, a word glued across runs kept whole, a word wider than the line
cut, '\n', max_lines ending in an ellipsis), and parse_text_style.
- Backend::rich_text(runs, RichTextOptions) -> RichTextEvent; TextRun gains style and link;
Capabilities::rich_text, the token text.runs. The default draws the runs' text on one line.
- The core reads runs: from a written list, a state path (a list as state-set-tree writes one)
or an expression; emoji: works in each run (expand_emoji, shared with emit_text_runs); size: N
bounds the width, max_lines: and wrap: shape it; {i} reaches runs:, on_link: and the runs.
- ImGui (arigl, arigl-web): bold drawn twice, italic sheared, code on a FrameBg box, links in
TextLink's colour and underlined; each piece of a link an item (a tap, not a drag, activates
it), the first a keyboard-navigation stop; a link's tooltip, else its href, on hover.
- FTXUI and tvision (its hosted bodies): a node that lays out at the width its box gives (another
layout pass when the walk's guess differs), cells bold / italic / underlined, code on grey,
links cyan; each link a Tab stop (inverted, its tip on the tooltip / status line), Enter or
Space or a click on any of its cells activates it.
- docs/ARIADNE.md §5.20, and text.runs in §5.7's table.
Tests: ariadne_runtime_test AriadneRichTextLayout* (the breaker) and AriadneRichText* (the runs a
backend gets, on_link / on_click, data never running, the card's click, {i}, emoji, a backend
without it); ariadne_ftxui_test RichText* (wrapping and cell styles, Tab / Enter, a wrapped
link's cells, max_lines, the hosted path tvision draws); ariadne_host_test (a document requiring
text.runs, its links by key); cvcgl_imgui_rich_text (taps, a drag, Tab then Enter through ImGui's
own input); ari_rich_text (ari snapshot of src/ari/tests/rich_text.ari, run_snapshot.cmake).
…s cuts is no Tab stop Two things nicotina's posts found: - A state path's runs: an empty list, as state-set-tree writes one, is a "0" with no elements, which read as one run of text "0". A node with no elements now holds no runs (§5.20 says so). - In a terminal, a link in the lines max_lines cuts away is not drawn, so it is no Tab stop either (ImGui already submitted only the pieces it draws). Which links show is laid out at the width the paragraph had last frame, else the walk's guess. Tests: AriadneRichText.AnEmptyListInStateIsNoRuns, AriadneFtxui.RichTextALinkInTheLinesCutAwayIsNoStop.
… gets the paragraph's width A window with an auto width and a set height (size: [auto, h]) is fitted to its content only in ImGui's first fit frames, not every frame as a window with no size: is. A paragraph laid out at the room those frames give (GetContentRegionAvail, near nothing in a new window's hidden frame) left the window as narrow as that. It is laid out at the room to the view's edge then, as in an always-auto-resize window, so the window fits its longest line (size: N at most). §5.20 says so.
transfix
added a commit
to cy-pca/nicotina
that referenced
this pull request
Nov 13, 2026
…5) (#27) Where the host draws rich text (text.runs, transfix/libcvc#1180), a post's text is read from txwtf's content_html, as the emoji are (emoji-of): - <strong>/<b> bold, <em>/<i> italic, <code>/<pre> code, and </p>, <br> and an item end a line; - an <a>'s href a link: a mention is /user/NAME, a hashtag /tag/NAME, a URL itself; - a custom emoji its :name:, which the text's emoji: draws. A post without content_html (a reposted post's brief, a locked post) is its plain text, its @NAMEs, #tags and URLs linked as txwtf links them. A link is followed in the app where it leads somewhere the app shows (open-link, the new link command): a hashtag's posts, a person's profile (GET /user/by-username/{name}), a post or a profile by id on this instance. nicotina never opens a browser: any other link is copied (Copy link), or shown where the host has no clipboard. On a card: three lines of the card's width (70 columns), cut with an ellipsis. On a post opened whole: all of it, at the window's width; on its replies, two lines. In a terminal each link is a Tab stop, before the card's buttons. An older host keeps the plain lines, as before; nothing is required. Tests (tests/run.sh, tests/local.sh): - The stub renders content_html for every post as txwtf does (mentions, hashtags and URLs as links, <br> for a newline), answers GET /user/by-username/{name}, and post 306 has a mention and a URL. - ari snapshot: post 306 wrapped at the window's width; with text.runs, its mention and URL underlined (SGR 4) and the rest not. - tmux, with text.runs: the first card's #engines opens its posts, post 306's @ada opens her profile, and its URL is copied, not opened. - With text.runs, the Tab counts that pass a post's text count its links (the first card's two, the first page's five, a new post's #nicotina), and the tall feed's expectations follow its paragraphs and its ellipsis. Needs the libcvc release that carries transfix/libcvc#1180 for any of it to show; until then the packaged hosts keep the plain lines and the new checks skip.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
…k-upload Conflict in src/cvc/CMakeLists.txt, both kept: Ariadne's source list has this branch's files.cpp and file_picker.cpp and master's rich_text.cpp.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
The two conflicts were include lines. ariadne.cpp keeps this branch's requires.h and stream_intrinsics.h and adds #1180's rich_text.h. ariadne_runtime_test.cpp keeps stream/stream.h and adds rich_text.h. #1180's rich text reads its runs and fires on_link through the Runtime's existing reactive evaluation and handler queue, so it follows this branch's group routing as it is; its last-good runs are a per-Runtime map.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
- pycvc.ari (#1216): the Python Host moved there from pycvc_gl.ariadne, so set_plot and its plot helper move with it. pycvc_gl.ariadne is master's alias. - src/cvc/CMakeLists.txt: master's list (rich_text.cpp, #1180) plus chart_emit.cpp. - ariadne_ftxui_test: master's rich-text tests and the chart golden, both kept.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
…le-pick-upload Conflicts, each side kept: - ImGuiBackend.h: master's set_clipboard on the document's app, then this branch's pick_files and begin_frame. - net_intrinsics.cpp: master's net verbs on the app with its OpenUrlLimit, then this branch's http-upload provider. The upload follows #1203: perform() and http_starts_async() take the app, and the started upload's StartedRequest gets the app it starts on (its go() calls cvc::net::start(*app, ...)). Master's ariadne_runtime_test doesn't build: #1180's three rich-text cases call load_string with one argument, and #1203 made it take the app. They pass their test's app now.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
… app #1203 gives every cvc command its app as an argument, removes cvc_app() and makes cvc::ariadne::load_string take the app. It merged after #1168 and #1180, whose new code still used the old forms, so master does not build: - src/cvc-cli/main.cpp: cmd_trace (#1168) takes cvc::app & like the other commands and replays on it, not cvc_app(). - src/cvc/tests/ariadne_runtime_test.cpp: #1180's three AriadneRichText tests pass their app to load_string; each already makes one.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
…ted-gas #1197 is in master as its squash, so the conflicts were #1197's own lines against this branch's changes to them: this branch's are kept. Two compile breaks on master, fixed here as #1203 fixed its own callers: - ariadne_wasm_browser_test.cpp (#1197) called register_script_engine(engine) and unregister_script_engine("wasm"), which #1203 removed: the fixture registers nothing, as each test's AppRuntime calls use_script_engine. - ariadne_runtime_test.cpp (#1180) called load_string(yaml), which #1203 made load_string(app, yaml): the three calls pass the test's app.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
Master gained #1203 (this branch's base), #1192 (state_exec Stage S, several steps a pick) and ten others. Conflicts, both #1192's run code against this branch's registry work: - async_scheduler.cpp: the slice setters from #1192, set_cycle_registry from here (it also gives the evaluator the registry). The cycle check takes the registry in the evaluation context (the one given, else its evaluator's own) where #1192 fell back to the thread's own, which this branch removes; collect_cycles_if_due now takes a registry. A run's steps go through the same context as its first; step_run's drain check is check_not_in_kernel, as step_once's is. - state_exec_groups_test.cpp: OC01's caller-pumped case keeps #1192's one step a pick and this branch's watched group. The file's note on leaks no longer speaks of a thread's own registry. Semantic, not textual: - #1192's Slices tests: SL04's spin-step and SL08's heavy take call_args and reach their context through it (eval_deadline_check(a.context()), a.context()->data), as this branch's other natives do. - cvc-cli's trace command (#1168) takes its app, and #1180's three rich-text tests pass theirs to load_string. Both landed after #1203's last master merge and still used what #1203 removed, so master does not build at 7ead20e or 69c7091; #1225 makes the same change there. Checked on Windows (MSVC Release): full build; groups 28/28; Slices and run-budget tests 19/19; rich text and heap 10/10; the cycle collector and registry tests, pycvc_ariadne, CvcCliTest.TraceInfoAndVerifyReplayASession and state_exec_async_test_slice256, 20/20.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
#1203 (no singletons) moved the URI registry, the HTTP client and options provider, the HTTP cache's in-flight table, the net and OIDC hosts, the WebSocket table and open-url's clock onto each app. This branch had changed the same code for threads. The merge keeps both: - uri.h/uri.cpp: register_uri_handler and resolve take the app (#1203) and keep this branch's UriCancelled and UriLocalHandler; the http(s) handlers and the HTTP cache pass the request's cancel predicate through to the app's client. - net_intrinsics.cpp: the providers stay by kind with each call on the calling program's host (ictx.host) and its finisher. The requests, fetch and WebSocket verbs take the app, the app's WsTable and its OpenUrlLimit (both app slots, got once at registration). open-url stays in its host_proxied provider, on the app's OpenUrlLimit instead of a clock of the provider's own. - oidc_host.cpp: the refresh sends through the app's client with the asker's cancel predicate. - ariadne.cpp: the Runtime's owner id is counted per app (#1203); has_snapshot asks the app's widget registry. - allowlist.txt: master's (76 lines); the one line this branch removed is gone there too. This branch's tests move onto the per-app APIs: the removed NetIntrinsicsGuard, L4Guard and NetHostGuard go, set_http_client and send take the app, live_groups takes the app by reference, and the worker pump counts come from the pool's stats (pool_stats::worker_pumps) where the process-wide exec_pool_worker_pumps_total() was, in the tests, mt.ariadne_docs and the docs. Also fixed: #1180's three rich-text tests called load_string without the app #1203 added.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
… app (#1225) #1203 gives every cvc command its app as an argument, removes cvc_app() and makes cvc::ariadne::load_string take the app. It merged after #1168 and #1180, whose new code still used the old forms, so master does not build: - src/cvc-cli/main.cpp: cmd_trace (#1168) takes cvc::app & like the other commands and replays on it, not cvc_app(). - src/cvc/tests/ariadne_runtime_test.cpp: #1180's three AriadneRichText tests pass their app to load_string; each already makes one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
text:withruns:is a paragraph of plain, bold, italic andcoderuns and links, wrapped to the width it has, in every host: ImGui (arigl, the arigl-web page) and both terminal backends (FTXUI, and tvision through its hosted bodies). nicotina needs it for its posts' mentions, hashtags and URLs (its roadmap L15). Documented indocs/ARIADNE.md§5.20.A run is a string, or
{text, style: "bold italic" | code, href, on_click, tooltip}.href:is a link and runs the text'son_link:. In a list the document writes itself, a run's ownon_click:runs instead. Runs from a state path or an expression are data: theiron_clickis never run, so text that came from the network can't carry a program. A click on a link is the link's, not the text's ownon_click:nor a clickable card's around it (§5.19).cvc/ariadne/rich_text.h,layout_rich_text) for every backend. It breaks at a space between words and keeps a word glued across runs whole. A word wider than the line is cut,\nends a line, andmax_linesends the last line in….TextLink's colour, underlined. Each piece of a link is an item: a tap activates it, a drag doesn't (a finger scrolling a feed). The first piece is a keyboard-navigation stop. Hovering shows the link's tooltip, else its href.Backend::rich_text(runs, RichTextOptions) -> RichTextEvent;TextRungainsstyleandlink;Capabilities::rich_textand the capability tokentext.runs. A backend without it shows the runs' text on one line.ari snapshotofsrc/ari/tests/rich_text.ari(in arigl the same lines wrap the same way, with the links blue and underlined,runningbold,italicslanted andcode()on a tinted box):Tests
ariadne_runtime_test:AriadneRichTextLayout*(the breaker) andAriadneRichText*. These cover the runs and options a backend gets,on_link/on_click, data never running, a link's click not being the card's or the text's,{i}in a repeat,emoji:in runs, an empty list in state (no runs, not a run "0"), and a backend without it.ariadne_ftxui_test:RichText*. These cover wrapping in a window and the cells' SGR, Tab/Enter with the tooltip line, clicks on both lines of a wrapped link vs the card, andmax_lines, and a linkmax_linescuts away being no Tab stop. AAriadneFtxuiHostedcase covers the path tvision draws, checking cell attributes and keys and clicks fed to the window.ariadne_host_test: a document withrequires: [text.runs]loads inAppRuntime, draws wrapped, and its link answers Tab/Enter.cvcgl_imgui_rich_text: the paragraph wraps atsize:. Through ImGui's own input, a tap on a link runson_link(not the card's), a tap on plain text is the card's, a drag opens nothing, and Tab then Enter activates the link.ari_rich_text:ari snapshotofsrc/ari/tests/rich_text.ari, its lines checked bysrc/ari/tests/run_snapshot.cmake.Locally (Windows, MSVC, FTXUI on):
ariadne_runtime_test274/274,ariadne_ftxui_test96/96,ariadne_host_test57/57 before the host case was added (58 with it), pluscvcgl_imgui_rich_text,cvcgl_imgui_group_clickandari_rich_text. tvision isn't buildable on this box, so its hosted path is covered by the FTXUI hosted test here and by CI.Later commits on this branch, from wiring it into nicotina:
state-set-treeholds no runs.max_linescuts away is no Tab stop.size: [auto, h]) gets the paragraph's natural width.No version bump. cy-pca/nicotina#27 uses this; it needs the libcvc release that carries it.