Fixes #4814 - Adds 'Link' View providing OSC 8 Hyperlink Support#4815
Merged
tig merged 33 commits intogui-cs:v2_developfrom Mar 9, 2026
Merged
Fixes #4814 - Adds 'Link' View providing OSC 8 Hyperlink Support#4815tig merged 33 commits intogui-cs:v2_developfrom
tig merged 33 commits intogui-cs:v2_developfrom
Conversation
en doc translation Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
url doc fix Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Update Url property validation to retain previous value on invalid input.
- Added static Link.OpenUrl for platform-specific URL opening; removed OpenUrl from UICatalogRunnable. - Link now handles mouse clicks and keyboard activation, opening URLs directly. - Improved drawing: shows Url if Text is empty, disables link if Url is invalid, always clears Driver.CurrentUrl. - Copy() now copies Text, not Url. - SetUrl validates URLs; invalid URLs revert to DEFAULT_URL. - IDesignable.EnableForDesign sets default Title and Text. - Refactored Links scenario UI for clarity and usability; status bar now shows Link's Text. - Updated all tests for new Link API and behaviors; improved test clarity. - Minor code style improvements and use of System.Diagnostics for process launching.
- IDesignable.EnableForDesign now sets Title and Url, not Text. - Copy() now copies Url to clipboard instead of Text. - Text, Title, and Url are now independent; setting one does not affect the others. - TextFormatter displays Url if Text is empty; otherwise uses Text. - DimAuto sizing uses Text width if set, otherwise Url, including wide chars. - Url property now accepts any string (no URI validation). - Setting the same Url does not fire change events. - UrlChanging event can cancel Url changes. - Rendering tests ensure invalid URLs do not produce OSC 8 hyperlinks and are styled as disabled. - Tests updated and expanded to cover all new behaviors and edge cases. - Minor test code cleanups and clarifications.
Add comprehensive XML docs for the Link class covering the three independent text properties (Text, Title, Url), OSC 8 hyperlink rendering, draw-time URL validation, CWP event pattern, HotKey-to-next-peer behavior, and Dim.Auto sizing. Enhance docs for all public members. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolved conflict in OutputBase.cs: kept _lastUrl hyperlink tracking from Link branch, adopted IsLegacyConsole branching and readonly modifier from v2_develop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Fixes
OSC 8Hyperlink Support #4814NOTE: This is a new PR based on the awesome work @ccoulioufr did. His branch was his own
v2_developfork and that made it tricky for me to update. So I created this new PR instead. I also created #4814 to track.Summary
Adds a new
Linkview and driver-level OSC 8 hyperlink infrastructure to Terminal.Gui.New
LinkView (Terminal.Gui/Views/Link.cs)Text(display),Title(HotKey), andUrl(target)Textis empty,Urlis shown as display text (auto-sized viaDim.Auto(DimAutoStyle.Text))VisualRole.Disabledstyle; valid URLs emit OSC 8 sequencesOpenUrl()opens URLs cross-platform (cmd /c starton Windows,openon macOS,xdg-openon Linux)Copy()copies the URL to the system clipboardUrlChanging(cancellable) andUrlChangedfor theUrlpropertyCanFocusisfalse, HotKey passes focus to the next peer view (likeLabel)IDesignablefor the TUI designerDriver-Level OSC 8 Infrastructure
IDriver.CurrentUrl/IOutputBuffer.CurrentUrl— new property to tag subsequently drawn cells with a URLOutputBufferImpl— sparseDictionary<Point, string>URL map stores per-cell URLs only when setOutputBase.Write()— tracks URL state across cell runs, emittingOSC 8start/end escape sequences; closes open hyperlinks at row boundaries; skips OSC 8 on legacy consolesOsc8UrlLinker.WrapOsc8()— wraps detected plain-text URLs in output with OSC 8 sequencesUICatalog Scenario (
Examples/UICatalog/Scenarios/Links.cs)LinkinstanceTests (
Tests/UnitTestsParallelizable/Views/LinkTests.cs)Text/Title/Urlindependence, CWP event lifecycle, URL validation,OnDrawingTextwith valid/invalid URLs,Copy(),IDesignable, and HotKey proxy behaviorTest Plan
dotnet buildsucceedsdotnet test --project Tests/UnitTestsParallelizablepassesLinksUICatalog scenario in Windows Terminal