Skip to main content

Links

Text in the terminal becomes something you can act on. Two kinds of link exist today: one the program itself marked with OSC 8 - a hyperlink escape sequence, so the label may read click me while the address underneath is anything - and one a spotting rule guessed: a web address printed as plain text, recognized by its shape. Tagged wins where both sit on the same cells; the program said what the link is, and the rule only guesses.

Hover a link and three things happen, all of them reversible by moving away:

  • The link underlines while the pointer is on it - the whole link, across every row it wraps onto, and only while hovered. Move off and the underline is gone; scroll while hovered and the underline follows the text or disappears, never sticking to the row the link used to sit on.
  • The pointer becomes a pointing hand over the link and the text cursor again over plain text. Nothing changes while the pointer is outside the pane.
  • A tooltip shows the address the link really points to - the tagged address, never the label dressed up as one. It appears at once, beside the pointer, under the link's own row, and stays where the link was entered until you move to a different link.

Nothing is opened yet. Hovering is read-only: no mouse reporting reaches the program, no click opens anything, and a hover never changes what the terminal sends.

What a plugin can change​

Hovering tells a plugin where you point, and a plugin gets the first say on what a click does.

  • Watching. A plugin that declares the link-watch permission is told each link the pointer comes onto - its address, its text, its kind - and once more when the pointer leaves. It cannot change the hover: the underline, the hand and the tooltip stay the terminal's.
  • Answering a click. Before a link opens, the plugins' link-open handlers are asked in order. One may take the link ({ handled = true }), or refuse it with a message ({ warn = 'text' }) that shows as a brief verdict in the pane. A handler that returns nothing passes the link on.
  • Replacing the core rules. What a link does when no plugin of yours answers is itself a plugin, core-links, embedded in the app and asked after every plugin of your own. A folder in plugins/ named core-links replaces it whole.

The events, their payloads and the three answers: Link events.