Make a URL written plainly clickable too - #23
Merged
Merged
Conversation
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
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.
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:
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:
zsh: no such file or directory: https://github.com/tkc/termit/pull/22https://github.com/tkc/termit/pull/22see https://example.com/a. nexthttps://example.com/a(https://example.com/b)https://example.com/bftp://example.com/xTesting
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/javascriptare not offered,http/mailto/fileare,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