Hyperlinks¶
Terminal applications can attach a URI to arbitrary visible text with the
OSC 8 control sequence. Revenant recognizes those links. It also detects
visible http:// and https:// URLs in ordinary terminal text without
changing the terminal's contents or OSC 8 state.
Try it with:
printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n'
Opening a link¶
Hold Shift while the pointer is over linked text. Revenant gives all visible
cells of that explicit OSC 8 target, or the detected URL occurrence under the
pointer, a single underline. An application-supplied single underline is
promoted to a double underline instead. Revenant also changes the pointer to a
hand over that target. The hand appears for both explicit OSC 8 and detected
URLs. Shift+Button 1 opens an http:// or https:// target with xdg-open
when the button is released over the same target.
Detected URLs may cross soft-wrapped rows. Sentence punctuation at the end is
not included: for example, the final period in See https://example.com/. is
not opened. Closing parentheses, brackets, and braces remain part of the URL
when they balance an opening delimiter, but unmatched closing delimiters are
trimmed. Whitespace, angle brackets, quotes—including apostrophes—and backticks
end a detected URL. An explicit OSC 8 target always takes precedence over
detection, even when its visible label itself resembles a URL.
The modifier keeps hyperlink activation separate from the established mouse bindings:
- Button 1 without Shift starts a selection.
- Button 2 pastes the selected X11 data.
- Ctrl+buttons 1, 2, and 3 open the xterm popup menus.
- When an application has enabled mouse reporting, Shift retains the local terminal gesture instead of sending it to the application.
Explicit OSC 8 targets using file:, mailto:, ftp:, or any other scheme still
underline on Shift-hover, but Shift-click deliberately does nothing. This
lets Revenant expose the terminal's actual hyperlink state without handing
arbitrary URI schemes to a desktop launcher.
Security model¶
An OSC 8 label and its target can be different: text which says
example.com can point somewhere else. The underline confirms that the cells
carry a link, not that the visible label describes its destination.
A detected URL has no hidden destination: the opened bytes are the visible URL after the documented punctuation trimming. Detection is bounded to the visible logical line and does not perform a network request or validate the destination before opening it.
Revenant passes an allowed target to xdg-open as one argument without invoking
a shell. It rejects embedded NUL bytes and permits only the case-insensitive
http:// and https:// prefixes. The browser or desktop handler remains
responsible for displaying and applying its own policy to the destination.
For protocol syntax, application guidance, and compatibility across terminal emulators, see the TDN OSC 8 reference.