Repository navigation
ariadne: a context menu on text in every backend: Cut, Copy, Paste, Select all (§5.28) - #1476
Merged
Merged
Conversation
…elect all (§5.28) A right-click on text opens a context menu in every host, with nothing in the document asking for it. So does a long press on a touch screen, and Shift+F10 or the Menu key in a terminal. - A field (input_text, message_input): Cut, Copy, Paste and Select all, on the selection or, with none, the whole text. A password field has no Cut or Copy. - A text, a bound value (its value), a rich text: Copy, and Select text..., which shows the text in a read-only field to copy a part of it. - A text_view: Copy line (the line under the pointer, a chat message), Copy all. - A notification, in the bell's menu or the Notifications window: Copy, of the whole message. The core hands it over with Backend::next_item_copy. ImGui natively uses the system clipboard, and edits through the field's callback, so ImGui's undo has the menu's Cut and Paste. In the browser Paste is navigator.clipboard.readText(), and the text goes in when it answers. The clipboard calls run inside the pointer release over the menu item (cvc::gl::clipboard::arm), as Safari requires. A refused read leaves the field focused for Ctrl+V, whose paste event works as before. FTXUI copies with OSC 52 and pastes with an OSC 52 read, answered by xterm with allowWindowOps, foot, kitty, iTerm2 and the ari.html page; a silent terminal gets a hint to use its own paste. Its fields gain a selection (Shift with the arrows, Home, End). tvision uses TClipboard for both. Tests: cvcgl_imgui_context_menu; ariadne_ftxui_test (five cases); ariadne_term_graphics_test's Osc52ReadsAndItsAnswer; ariadne_runtime_test's ANotificationsEntryCopiesItsWholeMessage; and arigl_web_clipboard.mjs in headless Chrome, added to ci.yml's arigl-web job.
…a refused read told apart The clipboard API wants a focused document, which a headless tab is not unless DevTools emulates it. The probes go in near the window's left edge, so they are over a short text too. Ctrl+V sends Control first. The refused-read step puts another text on the clipboard than its paste event carries. When the package has ari.html, the same document there: Shift+F10 on the field, then Paste, read with OSC 52 and answered by the page.
transfix
enabled auto-merge (squash)
November 23, 2026 06:47
…ontext-menu # Conflicts: # src/cvcGL/ariadne/ImGuiBackend.cpp
transfix
added a commit
that referenced
this pull request
Nov 24, 2026
Conflict in ci.yml's arigl-web gate: master's #1476 runs it when the clipboard changes, SH2 when how a viewport widget's view draws changes. Both kept.
This was referenced Nov 24, 2026
transfix
added a commit
that referenced
this pull request
Nov 25, 2026
…' after #1452, Cmd+Z in the context-menu test The ci/full run of the first commit (45375289474) passed the six new macOS goldens on all four lanes and left two failures: - cvcgl_ari_golden: volren_views (#1498), 882 px beyond +-40. Its four lanes' frames are byte-identical, the same picture with box edges and the volren's shading a pixel apart. Committed as volren_views.macos.png. - cvcgl_imgui_context_menu (#1476): "ImGui's undo takes the paste back". The test pressed ImGuiMod_Ctrl+Z. With ConfigMacOSXBehaviors (on Apple), io.AddKeyEvent swaps Cmd and Ctrl, so that arrives as Super and InputText doesn't undo. The test now presses ImGuiMod_Super there, the key a Mac's Cmd arrives as, which ImGui turns into its shortcut key. Checked against ImGui 1.92.9 with a standalone InputText: with macOS behaviours Ctrl+Z leaves 'abc' and Super+Z undoes to 'ab', and the reverse without them. Master since then has #1452, which re-captured volume_grid, _quad and _contours for its Segmentation tab and added volume_grid_segment (366 px on macOS). Their .macos.png are the v4.0.8 tag run's (45478904899) frames, byte-identical across the four lanes, and the same pictures as the llvmpipe goldens.
transfix
added a commit
that referenced
this pull request
Nov 25, 2026
…ext_menu:) Master's #1476 gave every backend a built-in context menu on text (Cut, Copy, Paste, Select text..., ARIADNE.md 5.28) and 5.29 a picture's Save. SH8's context_menu: now joins that menu instead of running beside it: - One request opens one menu. Over a widget with entries of its own (a field, a text, a picture) those come first, then under a rule the items of the innermost context_menu: around it; over anything else inside one, its items alone; with none around, #1476's menu as is. - ImGui: the document's areas live in #1476's ContextMenus. A menu a text or field opens remembers the innermost area, which appends its items to the same popup; elsewhere the area opens one through the same open()/begin() (its long press, Escape, one claim a frame). - FTXUI: #1476's ctx menu holds the leaf's entries and keeps the area's items as rows after them; one Shift+F10 / Menu path, one right-click path. The duplicate key decoding is gone (master had it). - tvision: Options::host_draws_context_menu; hosted_context_menu() and pick_context_entry() let the bridge show the menu with popupMenu at its place, so a short window no longer cuts it off. That was the failing ari_run_context_menu_tvision: a two-row window drew the menu as an empty frame. - The section is ARIADNE.md 5.30; 5.28 points to it. The closed schema (ari.v1.schema.json, from #1464) learns context_menu on the document, groups, panels, windows, overlays, custom widgets and include sites, and kBuiltinBlocks lists it. - Picks: pick_props takes master's node map (id and node, for a node's own on_pick:); CustomEdit keeps both events and context_pick. The ImGui test for SH8 is cvcgl_imgui_document_menu (master's cvcgl_imgui_context_menu keeps its name); FTXUI gains AFieldInACardOffersItsOwnEntriesThenTheCards and AHostedContextMenuIsAModelForTheHost; the context_menu golden now shows the text's Copy and Select text... above the card's items.
transfix
added a commit
that referenced
this pull request
Nov 25, 2026
…t, ci/full for new goldens (#1526) * cvcgl_ari_golden: macOS goldens for the six mesh and volume documents added since 11-20 contour_tiler, skeleton, molecule_skeleton, volume_grid, volume_grid_quad and volume_grid_contours were added between 2026-11-20 and 11-23 with llvmpipe goldens only. Pull requests skip the macOS package lanes, so none of them was compared under the Apple Software Renderer before it merged. Since then all four macOS package lanes have failed cvcgl_ari_golden on master and on the v4.0.3 to v4.0.6 tags: 1,066 to 4,889 px beyond +-40, with the same counts in every run. The macOS frames are the same pictures. Edges of lines, translucent surfaces and nearest-sampled texels land a pixel apart, as on orthoslicer. On volume_grid_quad the Probe tab's Min/Max is also one float32 ulp off on the arm64 runner. The four lanes' frames are byte-identical, so the v4.0.6 tag run's (45246162146) are committed as <name>.macos.png, as docs/ARIADNE.md describes. ARIADNE.md now says to run a new golden through ci/full/** before it merges. * macOS: volren_views and volume_grid_segment goldens, the volume grids' after #1452, Cmd+Z in the context-menu test The ci/full run of the first commit (45375289474) passed the six new macOS goldens on all four lanes and left two failures: - cvcgl_ari_golden: volren_views (#1498), 882 px beyond +-40. Its four lanes' frames are byte-identical, the same picture with box edges and the volren's shading a pixel apart. Committed as volren_views.macos.png. - cvcgl_imgui_context_menu (#1476): "ImGui's undo takes the paste back". The test pressed ImGuiMod_Ctrl+Z. With ConfigMacOSXBehaviors (on Apple), io.AddKeyEvent swaps Cmd and Ctrl, so that arrives as Super and InputText doesn't undo. The test now presses ImGuiMod_Super there, the key a Mac's Cmd arrives as, which ImGui turns into its shortcut key. Checked against ImGui 1.92.9 with a standalone InputText: with macOS behaviours Ctrl+Z leaves 'abc' and Super+Z undoes to 'ab', and the reverse without them. Master since then has #1452, which re-captured volume_grid, _quad and _contours for its Segmentation tab and added volume_grid_segment (366 px on macOS). Their .macos.png are the v4.0.8 tag run's (45478904899) frames, byte-identical across the four lanes, and the same pictures as the llvmpipe goldens.
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.
Joe asked for this while testing cyprty: highlight or right-click notification messages and other strings, and get a copy, cut and paste menu (pasting into text fields) in place of the browser's own right-click. He later added that it must work in the native hosts and the terminal backends too.
So text in every Ariadne host now has a context menu, with nothing in the document asking for it. A right-click opens it. So does a long press on a touch screen (half a second, the finger still), and Shift+F10 or the Menu key in a terminal. New section docs/ARIADNE.md §5.28; §5.15, §5.24 and §10.7 point to it.
input_text:,message_input:text:(a bound value copies its value), a rich texttext_view:(the chat log, a console)Per host
arigl, cvcGL): the system clipboard, as Ctrl+C and Ctrl+V already use it. The menu edits through the field's own InputText callback, so ImGui's undo takes back a Cut or a Paste.navigator.clipboard.writeText.navigator.clipboard.readText(), which answers later; the text goes into the field when it does. Chrome asks once for the permission. Firefox and Safari show their own Paste button.cvc::gl::clipboard::arm), and a page listener makes the call in the pointer release over it.pasteevent.ari):ESC ] 52 ; c ; ? ESC \), answered by xterm with allowWindowOps, foot, kitty and iTerm2. FTXUI 7.0.3 hands the answer over as a special event; I checked that under a pty.readText(), and keeps the browser's menu off the terminal while the program has the mouse.TClipboardfor both. A Paste arrives as a paste of keys. The bell's menu is tvision's own menu, so copy a notification from the Notifications window there.Tests
cvcgl_imgui_context_menu(new, no GL, ImGui's own clipboard). It covers a field's Copy, Select all + Cut, Paste with and without a selection, and ImGui's undo of a Paste. It also covers password fields, a message field's multi-line paste, text and value Copy, the Select text window, a text view's Copy line and Copy all, the bell's entry and the Notifications line, and a touch long press whose lifting finger picks nothing.ariadne_ftxui_test:ARightClickOnATextOffersCopy,AFieldsMenuCutsCopiesAndPastes(including Shift+F10),ATextViewsMenuCopiesALineOrAll,ANotificationsEntryCopiesItsWholeMessage,APasteWithNoTerminalToAskSaysHowToPaste(hosted).ariadne_term_graphics_test'sOsc52ReadsAndItsAnswer;ariadne_runtime_test'sANotificationsEntryCopiesItsWholeMessage.src/arigl/web/test/arigl_web_clipboard.mjs(new): arigl-web in headless Chrome with the clipboard granted, driven through the page's own mouse and keys.src/cvcGL/Clipboard.cppandImGuiBackend.cpp.Run locally (Linux, RelWithDebInfo), all passing:
cvcgl_imgui_context_menu,cvcgl_imgui_chat_widgets, all 119 ofariadne_ftxui_test,ariadne_term_graphics_testand the runtime's notification tests.arigl_web_clipboard.mjsalso passes in headless Chrome 152 (SwiftShader), twice, against a single-threaded arigl-web built by the recipe's script. Its deps came fresh from the catalog: this box's older wasm prefixes predate #1409's wasm exceptions and no longer link.Not checked: Firefox and Safari's own Paste prompts (headless Chrome only), a real touch screen's long press (simulated in the ImGui test), and a real terminal answering the OSC 52 read (FTXUI's parsing of the answer was checked under a pty).
Formatting: clang-format 18.1.8 on the changed lines. The JavaScript inside
EM_JSsits betweenclang-format offandon, asweb_audio.cppdoes.