config: add link-url-style for always-underline link rendering#397
Draft
deblasis wants to merge 1 commit into
Draft
config: add link-url-style for always-underline link rendering#397deblasis wants to merge 1 commit into
deblasis wants to merge 1 commit into
Conversation
OSC 8 hyperlinks and the default URL matcher currently only show
underlines while the mouse is hovering them with Ctrl/Cmd held. The
majority of modern terminal emulators (Windows Terminal, iTerm2,
WezTerm, Kitty, VS Code) underline links unconditionally, which makes
hyperlinked output discoverable without the modifier-press signal.
This adds a new config knob:
link-url-style: hover-mods | always
Default is hover-mods, which preserves the current behavior. Users who
want industry-standard always-underline can set it to `always`.
Click behavior is intentionally unchanged: opening a link still
requires Ctrl/Cmd regardless of the style setting, so mouse-aware TUI
programs (vim with mouse=a, htop) keep their normal mouse-button
semantics.
Three small changes:
- src/config/Config.zig: new LinkUrlStyle enum + `@"link-url-style"`
config option, plus a finalize() hook that switches the default
URL matcher's highlight to .always when style == .always.
- src/renderer/generic.zig: DerivedConfig.link_url_style propagated
from Config; the OSC 8 underline gate now branches on the style.
In .always mode it walks the whole viewport for hyperlink cells;
in .hover-mods mode the existing point-under-cursor logic runs.
- src/terminal/render.zig: new RenderState.allHyperlinkCells helper
that returns every OSC 8 hyperlink cell in the viewport regardless
of any specific link ID or mouse position. Two tests pin empty-
viewport and multi-hyperlink-per-row cases.
Tested:
- zig build -Dapp-runtime=none (Windows): clean
- zig build test-lib-vt: pass
- dotnet build Ghostty.csproj -p:Platform=x64: clean against the
rebuilt ghostty.dll
Owner
Author
|
Heads-up to future-me / reviewers: this draft is intentionally weird. Why the diff looks the way it does:
Rules of engagement:
Sole purpose: a tracked, browsable preview of what gets sent to |
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.
Staging draft for a planned ghostty-org/ghostty PR.
This branch is
upstream/mainplus the #394 cherry-pick (79550b8c2). The "Files changed" view here previews exactly what the upstream submission will look like.Validated:
zig build test-lib-vt— 4177/4195 passed, 18 skipped, 0 failedzig build test-lib-vt+dotnet build Ghostty.csproj -p:Platform=x64cleanSee the pinned comment for the do-not-merge / do-not-Update-branch reminder.