Skip to content

Make a URL written plainly clickable too - #23

Merged
tkc merged 1 commit into
mainfrom
bare-url-links
Sep 9, 2026
Merged

Make a URL written plainly clickable too#23
tkc merged 1 commit into
mainfrom
bare-url-links

Conversation

@tkc

@tkc tkc commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Why

OSC 8 only works when the program marks the text up. A URL printed by a
program, or echoed back by an error message, carries no markup — which is
exactly where you want to click it:

tkc@tkcs-MacBook-Air ~ % https://github.com/tkc/termit/pull/22
zsh: no such file or directory: https://github.com/tkc/termit/pull/22

Nothing there is a link, and #21 could not help.

What

Pointing at a URL in the output underlines it, turns the pointer into a hand,
and clicking opens it — the same as a marked-up link. Both kinds go through the
same check for what is allowed to open.

The search runs over the visible screen only; following the scrollback to
its end on every mouse move is too much for something that runs that often.

The pattern covers the four schemes that may be opened, so anything else is
never offered, and it refuses to end on punctuation:

Text Found
zsh: no such file or directory: https://github.com/tkc/termit/pull/22 https://github.com/tkc/termit/pull/22
see https://example.com/a. next https://example.com/a
(https://example.com/b) https://example.com/b
ftp://example.com/x

Testing

Six new tests, 200 total: a URL inside a shell error message is found, pointing
beside it finds nothing, a trailing full stop / closing bracket / comma are
excluded, ftp/ssh/javascript are not offered, http/mailto/file are,
and whatever is found always passes the check for what may be opened.

The probe prints one of each so both are rendered every time.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GvMacYD6T9EoWqc7C247Hr

OSC 8 only works when the program marks the text up. A URL printed by a
program, or echoed back by an error message, carries no markup — which is
where you most want to click it. Pasting one at a prompt and having it stay
inert is what prompted this.

Pointing at a URL in the output now underlines it, turns the pointer into a
hand, and clicking opens it, the same as a marked-up link.

The search runs over the visible screen only. Following the scrollback to its
end on every mouse move is too much for something that runs that often. The
pattern covers the four schemes that are allowed to open, so anything else is
never even offered, and it refuses to end on punctuation — a URL at the end of
a sentence or inside brackets would otherwise carry the full stop or the
bracket along with it.

Adds six tests: a URL inside a shell error message is found, pointing beside it
finds nothing, a trailing full stop, closing bracket and comma are excluded,
ftp/ssh/javascript are not offered, http/mailto/file are, and what is found
always passes the check for what may be opened.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GvMacYD6T9EoWqc7C247Hr
@tkc
tkc merged commit 5233a32 into main Sep 9, 2026
1 check passed
@tkc
tkc deleted the bare-url-links branch September 9, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant