Research: how do battle-proven terminals make grid text clickable, and which is the right reference for DropTerm?
Date: 2026-12-05 Question: DropTerm should support "clickable" text in the terminal grid — hover a link, see it underlined, click it, something happens (open URL, copy, context menu). iTerm2 was the owner's named example. What are the two mechanisms (OSC 8 semantic hyperlinks vs regex URL detection), how do iTerm2, VTE, WezTerm, kitty, Alacritty and Windows Terminal implement them (storage, hover, click routing, wrapping), what does the Rust/GPUI ecosystem already have, and which of these is the reference implementation DropTerm should copy?
TL;DR
Copy WezTerm's model, with Zed's resolver as the GPUI-native worked
example: OSC 8 first through the carried parser DropTerm already has, regex
detection as fallback over the match list DropTerm already computes, hover =
underline + pointer cursor driven off one active_hyperlink_id, click =
left press-and-release on the same cell opening through the open crate
DropTerm already vendors. The decisive fact is that the reference design
is not a port but a completion: DropTerm's carried alacritty_terminal
already parses OSC 8 into per-cell hyperlink attributes
(carried/alacritty-terminal/src/term/cell.rs:153), DropTerm's engine
already underlines cells matching an active_hyperlink_id at render time
(dropterm/src/core/terminal/engine.rs:4646-4667) — and that field is
never set to Some by anything — and DropTerm already scans the visible
grid for URL regex matches on every update and throws the result away
(engine.rs:4194-4200). Every surveyed terminal converges on the same
architecture (per-cell small index or Arc'ed pointer into a pooled
id/URI table; hover underline + pointer cursor; click opens with either no
modifier (WezTerm, kitty, Alacritty) or Ctrl (GNOME Terminal, Windows
Terminal, Zed) and selection always wins over the link), so the choice is
about default interaction policy, not architecture. iTerm2 is the UX north
star (semantic history: click a path, open it at a line number, run a
configured command) and stays in the record for that, but its Objective-C/AppKit
code is not a porting reference for a Rust/GPUI grid. Rejected: reusing
wezterm's crates (DropTerm already carries the same parser lineage), GPUI's
InteractiveText for the grid (it is a styled-text-run primitive; the grid
is canvas cells), and plain-click-without-selection-precedence (kitty and
WezTerm both special-case press-on-link so a drag starting on a link
selects instead of opening).
What DropTerm has today
- OSC 8 arrives today, end to end, into the cells. The carried
vtecopy parses OSC 8 (carried/vte/src/ansi.rs:1438-1464: theb"8" if params.len() > 2OSC arm buildsHyperlink { id, uri }and callshandler.set_hyperlink(...); theHandlertrait method sits atansi.rs:742). The carriedalacritty_terminalcopy stores it:Term::set_hyperlink(carried/alacritty-terminal/src/term/mod.rs:2041) writes into the cursor template, and printed cells carryCellExtra { zerowidth, underline_color, image, hyperlink }(carried/.../term/cell.rs:149-153), with the hyperlink itself anArc<HyperlinkInner>of{ id, uri }(cell.rs:44-98) that auto-generates an id suffixed_alacrittywhen the emitter omits one (cell.rs:85-96).Cell::set_hyperlink/Cell::hyperlink()are the per-cell read/write seam (cell.rs:230-251). This is the sameCellExtraspill-over seam the images record shipped through (terminal-images.md, 2026-11-05). - The render hook exists and awaits a producer.
Terminal::active_hyperlink_id: Option<String>(dropterm/src/core/terminal/engine.rs:847) is initializedNone(engine.rs:2010) and read inupdate()'s cell walk (engine.rs:4087, read at:4646-4667): cells whosecell.hyperlink().idequals the active id gainFlags::UNDERLINE, including the wide-char-spacer neighbor cell check (engine.rs:4651-4663). No code anywhere assigns itSome; grep acrossdropterm/srcfinds only the declaration, the init, and the read. The hover producer and the click consumer are the missing halves. - URL regex detection runs every update and its results are unused.
The engine compiles alacritty's default URL regex verbatim
(
engine.rs:302-308, the regex copied from alacritty'sui_config.rs:36-39), andupdate()collectsvisible_regex_match_iter(&term, &mut self.url_regex_match…)runs through the fork'sHintPostProcessorintoregex_matches(engine.rs:4194-4200; the processor atengine.rs:4882-4988). Grep finds no consumer ofregex_matchesor ofactive_regex_match: Option<Match>(engine.rs:846, init:2009, read:4641-4645) outside the engine itself. The detection half of feature is pre-built and idle. - The mouse surface is already wired per-button, per-move, per-release.
The terminal frame routes
on_mouse_downfor Left/Middle/Right,on_mouse_move,on_mouse_upfor all three pluson_mouse_up_out,on_scroll, andon_key_downinto the pane (dropterm/src/terminal/view.rs:2095-2201).on_press(view.rs:1690) handles mouse-reporting ownership first (a reporting child owns the press unless Shift overrides it; a right press in reporting mode is swallowed so it never opens the context menu over the child's bytes,view.rs:1711-1728), then converts window to pane coordinates and grid cells (view.rs:1738-1740,selection::cell_atatview.rs:1829-1834,viewport_to_pointatengine.rs:4725).on_motion(view.rs:1791-1816) today only serves the reporting gesture and drag selection; an unpressed move is free real estate for hover. - Open-URL plumbing exists. The
opencrate 5.3.2 is a dependency (dropterm/Cargo.toml:148) and already opens paths/folders system-side with one warn on refusal (dropterm/src/settings.rs:2408-2419, the images panel'ssystem_open_landedatdropterm/src/app_shell.rs:3776, per the images-panel record). - The context menu routes through actions, and right-click is already
mode-gated. The menu model (
dropterm/src/core/context_menu.rs:1-19) opens on right-click in default mode only (in mouse-reporting mode the right press reaches the child), and every row is an existingperform_actionverb, so Copy Link Address / Open Link rows are new model entries, not new plumbing. - Docs carry no hyperlink key. Grepping
docs/docs/*.mdfor hyperlink finds only research records;every_config_key_is_documentedwill demand a docs row for whatever config lands.
Findings
1. The two mechanisms, from the spec
Primary source: the OSC 8 gist (egmontkob, fetched 2026-12-05).
- Semantic hyperlinks (OSC 8):
OSC 8 ; params ; URI STopens,OSC 8 ; ; STcloses. Params are colon-separatedkey=value; onlyidis defined. Hyperlinks are "like another cell attribute (like color/bold)": every cell painted after the sequence belongs to the link until it closes. Same URI and same non-emptyidgroup into one link across line breaks (that is the wrapping answer: the emitter or the terminal supplies a stable id, and the terminal underlines "cells with the same URI and the same nonempty id" together on hover). Without an id, terminals improvise: VTE mints a fresh implicit id per sequence, iTerm2 groups adjacent same-URI cells. - Defaults the spec asks for: underline on hover mirroring
auto-detected URLs; opening via "a deliberate action like Ctrl+click or
a right-click menu", not plain clicks; per-scheme openness is each
terminal's call;
file://requires a hostname,localhost/empty are local, a foreign hostname must be refused. Caps: VTE and iTerm2 limit URIs to 2083 bytes, VTE capsidat 250 bytes. No feature-detection query exists; hyperlinks are a convenience, never the only route. - Heuristic detection: every surveyed terminal also regexes the
screen. The knobs: WezTerm
hyperlink_rules(regex to URL templates, defaults below), kittydetect_urls(default yes) +open_url_with+url_mappings, Alacrittyhints(one default URL regex,hyperlinks: truefolds OSC 8 cells into the same hint match), Windows Terminalexperimental.detectURLs(default true), GNOME Terminalterminal-screen.ccregexes over VTE'smatch_checkAPI, iTerm2 cmd-click resolution plus "Open Selection as URL" with scheme guessing.
2. Storage: every terminal is a pool plus a per-cell small reference
| Terminal | Per cell | Pool/table | Caps and GC |
|---|---|---|---|
| WezTerm | CellAttributes.fat.hyperlink: Option<Arc<Hyperlink>> (spills rare attrs into a heap FatAttributes) | none needed; the Arc is the table | none found |
| Alacritty | CellExtra.hyperlink: Option<Arc<Hyperlink>> | none needed | auto id <n>_alacritty for id-less sequences |
| VTE | attr.hyperlink_idx: guint32 on the cell attr | Ring's GPtrArray *m_hyperlinks of GString* [1..=VTE_HYPERLINK_COUNT_MAX] holding id;uri strings; index 0 = none | VTE_HYPERLINK_URI_LENGTH_MAX / VTE_HYPERLINK_ID_LENGTH_MAX; hover pins an idx "even if the cell is scrolled out" |
| kitty | integer hyperlink_id (0 = none) | HyperLinkPool { array of "id:url" strings, map key->id, adds_since_last_gc } | MAX_KEY_LEN 2048, MAX_ID_LEN 256; GC at HYPERLINK_MAX_NUMBER - 1 or 8192 adds; overflow drops the link with a log line |
| Windows Terminal | TextAttribute._hyperlinkId: uint16_t (0 = none) | TextBuffer._hyperlinkMap (+ _hyperlinkCustomIdMap for explicitly-assigned ids) | _PruneHyperlinks() sweeps ids not referenced by any row |
| iTerm2 | legacy_screen_char_t.urlCode: unsigned short — "an index into the URL store" | the URL store (id to URI) | not pinned (Unverified) |
Two designs, one shape: either the cell carries an integer index into a
string pool the terminal owns and garbage-collects (VTE, kitty, WT,
iTerm2), or it carries an Arc'd pointer to an owned {id, uri} pair
(WezTerm, Alacritty). DropTerm's carried alacritty_terminal is the
second design, already in tree; no storage work remains. The pool designs
exist because C wants small fixed cell structs; Rust's Option<Arc<…>>
inside the existing CellExtra spill-over buys the same memory shape for
free.
3. Hover: mouse move, hit-test, underline, pointer
- WezTerm (
wezterm-gui/src/termwindow/mouseevent.rs@a8bf87e): on move it runspane.apply_hyperlinks(stable_row..stable_row + 1, &self.config.hyperlink_rules)(the regex rules are applied to the grid as implicit hyperlinks, so detection and storage converge into the same cell attribute), then aFindCurrentLinkhelper readscell.attrs().hyperlink().cloned()for the pointed cell. A new link under the cursor means "invalidate and repaint", and the window takesCursorIcon::Pointer. No underline is drawn by the mouse code (hover styling rides the render pass). - Alacritty (
alacritty/src/input/mod.rs@e6b67c3):cursor_state()buildshint.should_highlight(point, hyperlink.as_ref())— theHintMatchknows about the OSC 8 hyperlink under the point — and stores the hovered hint indisplay().highlighted_hint; movement setshint_highlight_dirtyandset_mouse_cursor(Pointer)over hints. The defaultHintsconfig hashyperlinks: trueon the default URL hint andHintMouse { enabled: true, mods: default }, so OSC 8 links and regex URLs highlight identically, with no modifier. - kitty (
kitty/mouse.c@3295c7c):handle_move_eventcallsdetect_urlwhenOPT(detect_urls);screen_detect_urlmerges both sources intoscreen->current_hyperlink_under_mouse {id, x, y, has_detected_url}where a positive id is an OSC 8 hyperlink andhid < 0marks a regex-detected URL. The pointer becomes a hand, andlink_hover_cleared_by_outputclears the hover when new output arrives. Highlight only happens when the current modifiers match a mouse mapping that mentions links (kitty.conf option docs). - VTE (
src/vte.cc@2969788): hover state ism_hyperlink_hover_idx/m_hyperlink_hover_uri(owned by the Ring), updated byhyperlink_hilite_update()from motion; VTE exposesget_hyperlink_at_position(nullptr whenm_allow_hyperlinkis off or no cell link) and emitshyperlink-hover-uri-changedwith a bbox. The widget consumer does the rest. - Zed (
crates/terminal/src/terminal.rs@0b8d056): hover is throttled —schedule_find_hyperlinkonly re-runs after 5 px of travel or 100 ms (FIND_HYPERLINK_THROTTLE_PX/FIND_HYPERLINK_THROTTLE) — and resolves throughfind_from_terminal_pointintolast_content.last_hovered_word. The visual hover (underline inlink_text_hovercolor, pointing-hand cursor, URL tooltip) only engages while the secondary modifier (Cmd/Ctrl) is held (crates/terminal_view/src/terminal_element.rs: the prepaint checkswindow.modifiers().secondary(cx)before styling). - Windows Terminal (
ControlInteractivity.cpp@74da6b6): hover is_core->SetHoveredCell(...); the core resolves the URI and the control layer underlines and shows it. Docs: detectURLs "will cause URLs to underline on hover and be clickable by pressing Ctrl". - iTerm2 (
sources/TerminalView/PTYTextView.h@987644c): the text view's delegate gets- (BOOL)textViewShowHoverURL:(NSString *)url anchor:(VT100GridWindowedRange)anchor;and aremoveUnderline("underline indicating clickable URL"). The factory doc notes the OSC 8 lookupurlActionForHypertextLinkAtCoordis "cheap enough to run on every mouse move" because it "only reads cell attributes".
4. Click: who opens, with which button and modifiers
- WezTerm (default mouse assignments, docs
config/mouse.html, fetched 2026-12-05): Single Left Up with NONE or SHIFT isCompleteSelectionOrOpenLinkAtMouseCursor— a plain release opens the hyperlink under the cursor unless a selection just completed. The strongerOpenLinkAtMouseCursoris not bound by default; the docs suggest users add their own CTRL-click binding for it. Selection wins over link by construction. - kitty (default mouse maps,
kitty/options/definition.py@3295c7c):mouse_handle_click selection link prompton plain left click ungrabbed ("Click the link under the mouse or move the cursor"), andclick_urlon ctrl+shift+left release for the grabbed case.mouse_open_urlinmouse.ccallsscreen_open_url(screen, "open_url")and "Opening a URL must work even when hover highlighting is disabled"; pressing on a link is classifiedPOTENTIAL_DRAG_URLso a press that becomes a drag selects instead of opening. Where the URL goes isopen_url_with(defaultdefault, i.e. the OS opener after user handlers), withurl_mappingsrewrites first. - GNOME Terminal (
src/terminal-screen.cc@ HEAD, fetched 2026-12-05):terminal_screen_capture_click_pressed_cbresolvesvte_terminal_check_hyperlink_at(OSC 8) andterminal_screen_check_match(regex) and opens either on button 1 or 2 with GDK_CONTROL_MASK, emitting itsmatch-clickedsignal; button 3 gathers the same data for the context menu. Ctrl is required for both kinds, no distinction. - Windows Terminal (
ControlInteractivity.cpp@74da6b6):_getHyperlinkForPointerEventreturns the URI onlyif (isLeftButton && modifiers.IsCtrlPressed())— Ctrl+left click — then raisesOpenHyperlinkfor the app layer to launch; a click-count gate ("Handle hyper-link only on the first click to prevent multiple activations") and suppression of the VT mouse release for hyperlink clicks keep the child out of the transaction. - Alacritty (
alacritty/src/input/mod.rs@e6b67c3): on mouse release,if let Some(hint) = hint.as_ref().filter(|_| button == MouseButton::Left) { self.ctx.trigger_hint(hint); }— plain left release opens, for both regex hints and OSC 8 links (they are one match type). The keyboard path (Ctrl+Shift+O by default) opens the hint at the vi cursor. - Zed (
crates/terminal/src/terminal.rs@0b8d056): mouse down captures the link only whene.button == MouseButton::Left && e.modifiers.secondary(cx) && self.can_open_links(...); mouse up re-resolves and opens only if the release lands on the same link (mouse_down_hyperlink == mouse_up_hyperlink), thenEvent::Openfans out tocx.open_url(url)for URLs and to the workspace path-opener forPathLiketargets (file paths get existence checks and a working directory;file://URIs are URL-decoded intoPathLike). Secondary-modifier click, down/up same-link semantics. - iTerm2 (
sources/SemanticHistory/@987644c): cmd-click entersiTermURLActionFactory's four-stage resolution —openableURLAtCoord(sync, scheme-bearing),urlActionForHypertextLinkAtCoord(OSC 8, cell-attribute read),urlActionForPromptAtCoord("cmd-click tries this before a hyperlink, so a prompt wins over a hyperlink inside it"), and the full asyncurlActionAtCoordwith aiTermSemanticHistoryController: the click can open the file at a line number, run the user's configured command with\1-\5substitutions (path, line, column, prefix/suffix, working directory), launch a coprocess, or send text; primitives (openURL,launchTaskWithPath,openFile) are overridable, and path reconstruction can brute-force a real path out of surrounding text.
5. Multi-line and wrapped links
The OSC 8 id param is the spec's answer (same URI + same id underline
together across wraps; emitters should use explicit ids in full-screen
apps; multiplexers should prefix ids). At the terminal side the wrap
problem dissolves if links are cell attributes: nothing per-line exists
to break. Zed's resolver demonstrates the cell-attribute expansion loop —
from the pointed cell, walk left/right decrementing/incrementing the
index and stop when the neighbor's hyperlink() != link
(crates/terminal/src/alacritty/hyperlinks.rs @ 0b8d056) — which
crosses soft-wrapped rows for free because the grid is linear in cells.
VTE stores ids per attr in the Ring's row stream, so a hyperlink spans
wrapped rows by construction. DropTerm already carries the one tricky
residue: hover matching must reach the wide-char spacer cells that
inherit the preceding cell's attributes, which is exactly the
WIDE_CHAR_SPACER neighbor check in engine.rs:4651-4663. VTE's
auto-id (":%ld", m_hyperlink_auto_id++) uses a leading colon so an
implicit id can never collide with an explicit one (src/vteseq.cc @
2969788); alacritty's _alacritty suffix serves the same purpose
(cell.rs:85-96).
6. The Rust/GPUI ecosystem
- Zed ships clickable terminal links on the same stack DropTerm uses
(gpui + a forked
alacritty_terminal; Zed pins its own fork at rev4c129667ce56611becdc82de6e28218c80e2e88f, rootCargo.toml@0b8d056). Its resolver order — OSC 8 cell attribute first, then the URL regex over the line (RegexIter), then configured path regexes — returnsHyperlinkMatch { text, is_url, range }(crates/terminal/src/alacritty/hyperlinks.rs), the terminal crate classifies it (Url, orPathLikewith cwd + file decoding), and the view layer opens it. Forkingalacritty_terminalto add surface behavior is therefore not just accepted practice, it is what Zed does. - GPUI at DropTerm's pin has interactive text with link hit regions:
InteractiveText(gpui-pre-0.3.12/src/elements/text.rs:1014-1028) wraps aStyledTextwithclickable_ranges: Vec<Range<usize>>, a click listener gated on down-index and up-index landing in the same range (:1061-1067), a hover listener, and tooltips; its paint pass setsCursorStyle::PointingHandwhen the pointer is inside a range and resolves characters throughtext_layout.index_for_position(:1173-1222). It is a text-run primitive: the right tool for DropTerm's chrome (popups, markdown, plugin surfaces), the wrong tool for a canvas-drawn grid whose hit-test is one division by cell size. - WezTerm's crates are the parse-and-store reference (not a reuse
candidate):
wezterm-escape-parser'sHyperlink::parsesplits params from URI with the "everything after the params belongs to the URI" rule that survives semicolons inside URLs (wezterm-escape-parser/src/ {osc.rs,hyperlink.rs}@a8bf87e), the pen carries the hyperlink into every printed cell (term/src/terminalstate/mod.rs:self.pen.set_hyperlink(Some(Arc::new(hyperlink)))), and the config crate defaultshyperlink_rulesto six rules — bracket-wrapped URLs (\((\w+://\S+)\)etc. mapping to$1), the generic and closing-parenthesis URL patterns, and an email rule rewritten tomailto:$0(config/src/config.rs@a8bf87e). DropTerm's carried stack already holds the same two halves in the same lineage; what DropTerm can copy from WezTerm is the surface: rules-as-config with$0/$Ncapture templates, rules applied to the grid so implicit links become real cell attributes, and the selection-else-open click default.
7. Shipped-binary corroboration: the installed VTE 0.76.0 decodes to the same architecture (REA MCP, 2026-12-05)
First-hand instruction-level pass over the Ubuntu runtime library on this
machine (/usr/lib/x86_64-linux-gnu/libvte-2.91.so.0.7600.0, package
0.76.0-1ubuntu0.1, sha256
39da50a5bf2ca0a22437d358927986c5e645c248b5d6ddbfbde0f2c4d34e22a2), via
REA's digest-bound GNU objdump provider (Evidence
ev_58b7f9d1bee1b3ce3d863a6838e4a13623357b63a650d1890d4c15ff92171c64).
.symtab is stripped; names come from .dynsym, so all internal
addresses below are raw offsets.
- Click is a pure function: event → URI-or-null.
vte_terminal_hyperlink_check_event(@0x43cb0) type-checks the widget, converts the event to view coordinates through one shared helper (@0x5cdb0, which readsgdk_event_get_event_type/window/button— the same helper serves motion and button events), maps view to grid withround()plus two integer divisions by cell width/height (@0x6fd20), gates on theallow-hyperlinkflag (Terminal byte0x3c18, the same bytevte_terminal_set_allow_hyperlinkcompares at0x47192), runs the Ring lookup (@0x24600), then returnsg_strdup(strchr(stored, ';') + 1)— the stored string isid;uriexactly asring.hhdeclares, so the library hands back the URI and nothing else: opening stays the app's decision. - Storage is the pool the source survey predicted. The Ring lookup
(@
0x24600) bounds-checks the row against the ring window, resolves through a per-row hyperdata map (@0x23b20) into an index→object pool (@0x23990), treats an empty string as "no link", and a flag variant caches the resolved hyperlink index (Ring+0x9c0) for hover tracking; a cached last-row field (Ring+0x80, reset to −1 by the click path) drives the hover fast path. - Hover is row-cache-guarded and ends in a signal. The motion-side
function (@
0x36400) skips the lookup while the row is unchanged (cmpagainst Ring+0x80at0x3643a); on change it re-resolves with the caching flag, splits the URI, stores the hover URI (@0x30600), and lands ing_signal_emit+g_object_notify_by_pspec(0x3656f/0x3657e). Thehyperlink-hover-uri-changedsignal name string sits at0x71afawith its class-init installation at0x3b51a. - URL detection is the parallel structure on shared seams.
vte_terminal_match_check_event(@0x43b80) runs the identical coordinate helpers and swaps the Ring lookup for a regex-match lookup (@0x2a6e0) — OSC 8 links and regex URLs converge into one hover/underline/click machinery, the same merge kitty'sscreen_detect_urland Zed's resolver implement in code.
No conflict with the source findings; the shipped artifact confirms the source-derived design point for point. Limitation: no decompiler provider is configured in this environment (Ghidra/Hopper/IDA absent), so this pass is instruction-level reading, not pseudocode.
Recommendation
Build clickable text as the completion of the OSC 8 path DropTerm's carried stack already parses, with WezTerm as the reference implementation and Zed as the worked example of the same stack under GPUI. In order:
- Hover (OSC 8 day one). In
on_motionwith no pressed button, convert to a grid cell (selection::cell_at+viewport_to_pointexist), readcell.hyperlink()with the wide-spacer fallback the render walk already implements, and write the id intoactive_hyperlink_id— the underline render atengine.rs:4646-4667lights up unchanged. Clear on leave/output (kitty'slink_hover_cleared_by_outputis the precedent), point the cursor (gpuiCursorStyle::PointingHandon the canvas hitbox, or Zed's throttle at 5 px/100 ms if the per-move cost shows). - Click (OSC 8 day one). Left press records the hovered id; left
release opens only if the id is unchanged and no selection drag
started (Zed's down/up same-link check; WezTerm's
CompleteSelectionOrOpenLink ordering, selection first). Open through
open::that_detachedforhttp(s),mailto:, andfile://on the local host — refusing foreign-hostfile://per the OSC 8 spec — with the images panel's one-warn refusal shape. Ctrl+click (and Ctrl+Shift for the mouse-reporting case, kitty's grabbed map) always opens, matching Zed/WT/GNOME Terminal, while plain click follows the kitty/WezTerm/Alacritty default DropTerm's shell-first UX sits closer to. Right-click on a link adds Copy Link Address and Open Link rows to the existing context menu (GNOME Terminal's button-3 handler gathers the same link data). - Regex fallback (stage two). Consume
regex_matches(engine.rs:4194-4200) as the fallback link source when the cell carries no OSC 8 attribute, in Zed's order (OSC 8 first, then the URL regex). Kitty's model — one resolver returning "hyperlink id or detected URL", a flag telling the click path which kind it opened — is the clean merge. The default regex is already in the engine verbatim from alacritty (engine.rs:302-308). - Config. A
hyperlink_ruleslist modeled on WezTerm's{regex, url}with$0/$Ncapture templates, defaulted to the bracket/URL/ mailto six, plus anopen_url_with-class key when a second opener behavior is wanted. Every key lands indocs/docs/configuration.mdper the docs gate.
Rejected, with reasons:
- iTerm2 as the code reference — its storage (a 16-bit
urlCodeinto a URL store behind AppKit views), mouse handling, and semantic history are Objective-C bound to the NSTextView mouse model; nothing maps onto a GPUI canvas grid. Adopt its UX ambitions (semantic history actions, prompt-wins-over-link precedence, Open Selection as URL) as later stages, not its code. - Reusing wezterm's crates (
wezterm-escape-parser,wezterm-cell) — DropTerm already carries a parser that parses OSC 8 into the same cell-attribute shape; a second escape-parser stack for one OSC is the resource-audit antipattern. The carry discipline (kit-root-border shape) applies if a fork gap ever appears instead. - GPUI
InteractiveTextfor the grid — styled-text-run hit regions with per-character index resolution; the grid has no text runs and its hit-test iscell_at. UseInteractiveTextwhere DropTerm already renders rich text (popups, the plugin declarative surfaces), not here. - Plain click with no selection precedence — kitty classifies press
on a link as
POTENTIAL_DRAG_URLand WezTerm bindsCompleteSelectionOrOpenLinkAtMouseCursorprecisely because click-to- open must never eat drag selection over a link. Any click design that opens on press, or that lacks the drag escape, is rejected on that precedent. - Ctrl-required-only (the GNOME Terminal/WT policy) as the sole path — defensible and it is Zed's choice, but it abandons the drop-down's mouse-first posture; kept only as the mouse-reporting-mode rule (when the child owns the mouse, only a modifier path may steal the click).
- VTE as a porting source — its pool design is the best storage
citation but the code is C++/GTK with the open action deliberately
delegated to the widget consumer (
vte.ccemitshyperlink-hover-uri-changedand never opens); the behavior to copy from VTE is the id/URI pool with caps and GC, and DropTerm does not need it (Arc'd cells make the pool unnecessary).
Unverified / open questions
- iTerm2 internals beyond the headers: hover underline wiring and
mouse-down entry inside
PTYTextView.mwere not line-read (the file is ~12k lines); the click pipeline is cited at theiTermURLActionFactory.h/iTermSemanticHistoryController.hcontract level. The modern renderer's hyperlink storage beyond the legacyscreen_char_t's absence of a field (the legacyurlCodecarries it) was not pinned. - kitty: the OSC 8 entry point into
get_id_for_hyperlink(inscreen.c/screen.h, not fetched) and the value ofHYPERLINK_MAX_NUMBERwere not pinned;hyperlink.c's pool andmouse.c's merge are the cited halves. - Windows Terminal:
experimental.detectURLs' detection regex and the hover tooltip UI live in ControlCore/ControlPresenter files not read; "OSC 8 since v1.4" comes from secondary issue references (microsoft/terminal#204 cited by third-party issues), not from release notes. - GNOME Terminal hover: VTE emits
hyperlink-hover-uri-changed, but the app-level underline-on-hover rendering was not line-read (terminal-screen.cccarries no motion handler; VTE's draw path was not fetched). - Alacritty hover-underline styling:
display/content.rsshows only the hint-label underline; the highlighted-hint underline lives in display code not line-read. The equivalent DropTerm render hook (engine.rs:4641-4667) is the pinned citation for the behavior. - docs.gtk.org's
vte4page forget_hyperlink_at_positionreturned 404 on the fetch date; VTE API claims citesrc/vte.ccinstead. - WezTerm's
hyperlink_rulesdocs page 404'd (bothhyperlink-rules.htmlandhyperlink_rules.html); the default rules are cited fromconfig/src/config.rssource instead. - Whether DropTerm's plain-click policy should extend into mouse-reporting mode at all (kitty keeps a grabbed-only ctrl+shift map; DropTerm's reporting path already owns presses) is an owner ruling the spec stage should take.
Sources
- OSC 8 spec: egmontkob's gist — syntax, id semantics, defaults, file:// host rules, 2083/250 caps — https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda (fetched 2026-12-05)
- WezTerm: wez/wezterm @ main
a8bf87e5bcb1135161cb7a86d4e1451ce5c61f38(2026-12-04):wezterm-cell/src/lib.rs(FatAttributes.hyperlink),wezterm-escape-parser/src/{osc.rs,hyperlink.rs}(Hyperlink::parse),term/src/terminalstate/mod.rs(set_hyperlinkonto the pen),wezterm-gui/src/termwindow/mouseevent.rs(apply_hyperlinks,FindCurrentLink, pointer cursor),config/src/config.rs(default_hyperlink_rules); default mouse assignments — https://wezterm.org/config/mouse.html (fetched 2026-12-05) - Alacritty: alacritty/alacritty @ master
e6b67c3ab1470bc42370d561e63c9e7f1ab549dc(2026-12-03):alacritty/src/input/mod.rs(hint hit-test,highlighted_hint, left-releasetrigger_hint,should_highlight(point, hyperlink)),alacritty/src/config/ui_config.rs(default hints: URL regex,hyperlinks: true,HintMouse { enabled: true }, Ctrl+Shift+O),alacritty/src/config/bindings.rs(default mouse bindings carry no link action),CHANGELOG.md(OSC 8 support landed in 0.11.0,;-in- URI fix in 0.12.1) (fetched 2026-12-05) - kitty: kovidgoyal/kitty @ master
3295c7cc3190bea8755dd462b51c113d26233cf1(2026-12-05):kitty/hyperlink.{h,c}(HyperLinkPool, "id:url" keys,MAX_KEY_LEN 2048,MAX_ID_LEN 256, GC at 8192 adds),kitty/mouse.c(detect_url/screen_detect_urlmerge withhid < 0for detected URLs,mouse_open_url,POTENTIAL_DRAG_URL, pointer hand, hover cleared by output),kitty/options/definition.py(detect_urlsyes,open_url_withdefault,show_hyperlink_targetsnever, themouse_handle_click selection link promptmaps) (fetched 2026-12-05) - VTE: GNOME/vte @ main
2969788c460501d9ac8db4506ccc66dbbed47943(2026-12-04):src/ring.hh(m_hyperlinksGPtrArray ofid;uriGStrings,hyperlink_idx_t, hover pinning),src/vteinternal.hh(m_allow_hyperlink,m_hyperlink_hover_idx/uri,m_hyperlink_auto_id),src/vteseq.cc(set_current_hyperlink: id parsing,:%ldimplicit ids, length caps),src/vte.cc(hyperlink_check, hover signal, opens nothing itself) (fetched 2026-12-05) - VTE shipped binary (REA cross-check, finding 7): Ubuntu
libvte-2.91.so.0.7600.00.76.0-1ubuntu0.1, sha25639da50a5bf2ca0a22437d358927986c5e645c248b5d6ddbfbde0f2c4d34e22a2, instruction-level disassembly via REA's objdump provider (Evidenceev_58b7f9d1bee1b3ce3d863a6838e4a13623357b63a650d1890d4c15ff92171c64) (read 2026-12-05) - GNOME Terminal: GNOME/gnome-terminal @ HEAD
src/terminal-screen.cc(Ctrl+button 1/2 for both OSC 8 and regex matches,match-clickedsignal, button 3 gathers link data) — via https://gitlab.gnome.org/GNOME/gnome-terminal/-/raw/HEAD/src/terminal-screen.cc (fetched 2026-12-05) - Windows Terminal: microsoft/terminal @ main
74da6b602c25b333e24261e39fc39a3820ddd0d0(2026-12-05):src/buffer/out/TextAttribute.hpp(_hyperlinkId: uint16_t),src/buffer/out/textBuffer.cpp(_hyperlinkMap,_hyperlinkCustomIdMap,_PruneHyperlinks),src/cascadia/TerminalControl/ControlInteractivity.cpp(SetHoveredCell, Ctrl+left-clickOpenHyperlink, single-click gate); interaction settings docs (experimental.detectURLsdefault true, underline on hover, Ctrl+click) — https://learn.microsoft.com/en-us/windows/terminal/customize-settings/interaction (updated 2026-12-01, fetched 2026-12-05) - iTerm2: gnachman/iTerm2 @ master
987644ca28c56648690bf509347c451229d68009(2026-12-04):sources/ScreenChar/ScreenChar.h(legacyurlCode"index into the URL store"),sources/TerminalView/PTYTextView.h(textViewShowHoverURL:anchor:,removeUnderline,urlActionHelper),sources/SemanticHistory/iTermURLActionFactory.h(the four click-resolution entry points, prompt-wins precedence),sources/SemanticHistory/iTermSemanticHistoryController.h(semantic history dispatch,\1-\5substitutions) (fetched 2026-12-05) - Zed: zed-industries/zed @ main
0b8d056a5f11bb26f25ab3370523102612b20d84(2026-12-05):crates/terminal/src/terminal.rs(throttledFindHyperlink,process_hyperlink, down/up same-link open,UrlvsPathLike),crates/terminal/src/alacritty.rs+alacritty/hyperlinks.rs(OSC 8-first resolver, expand-until-hyperlink-differs,HyperlinkMatch),crates/terminal_view/src/{terminal_view.rs,terminal_element.rs}(Event::Opentocx.open_url, secondary-modifier hover underline + tooltip + pointing hand), rootCargo.toml(alacritty_terminalgit fork rev4c129667) (fetched 2026-12-05) - GPUI at DropTerm's pin:
gpui-pre-0.3.12(= zedd2a4fb6ded7c470be25d1541281da3882495b65b, crates.io snapshot),src/elements/text.rs:1014-1028, 1061-1067, 1157-1222(InteractiveText, clickable ranges, down/up click gating, pointing hand,index_for_position) (local registry checkout, read 2026-12-05) - DropTerm local (HEAD, 2026-12-05):
dropterm/Cargo.toml:148(open5.3.2), rootCargo.toml:40-53(carriedvte/alacritty_terminalpath pins),carried/vte/src/ansi.rs:742, 1438-1464,carried/alacritty-terminal/src/term/cell.rs:44-98, 149-153, 230-251,carried/alacritty-terminal/src/term/mod.rs:2041,dropterm/src/core/terminal/engine.rs:302-308, 840-847, 2009-2012, 4087, 4194-4200, 4641-4667, 4725, 4882-4988,dropterm/src/terminal/view.rs:1690-1740, 1791-1836, 2095-2201,dropterm/src/core/context_menu.rs:1-19,dropterm/src/settings.rs:2408-2419,dropterm/src/app_shell.rs:8191