🔗 feat(link-styling): add per-profile underline style and hover/active colours for OSC 8 hyperlinks#650
Draft
kud wants to merge 1 commit into
Draft
Conversation
…e colours for OSC 8 hyperlinks
Contributor
Author
|
Still working on it. Draft: not ready to present it to reviewers, but gives information that I'm working on a feature. |
Owner
|
There are a number of underlines. In addition to the ones set by SGR control sequence, they are also used for annotations, semantic history, and OSC 8 hyperlinks. There could be others I'm forgetting. Customizing colors is simple enough but customizing the shapes is riskier - you could easily end up with ambiguous cases. I believe there's a special code path for semantic history on already-underlined text that shows a mixed sold/dash underline. |
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.
Overview
Add per-profile customisation for OSC 8 hyperlinks beyond colour. Previously iTerm2 only allowed users to set a single link colour per profile. This PR introduces:
KEY_LINK_HOVER_COLOR, opt-in with checkbox).KEY_LINK_ACTIVE_COLOR, opt-in with checkbox).Changes
Profile Keys & Defaults (5 new)
ITAddressBookMgr.h— addedKEY_LINK_UNDERLINE_STYLE,KEY_LINK_HOVER_COLOR,KEY_LINK_HOVER_COLOR_ENABLED,KEY_LINK_ACTIVE_COLOR,KEY_LINK_ACTIVE_COLOR_ENABLEDiTermProfilePreferences.m— registered defaults, help text, type registrationColour Map & Rendering
iTermColorMap.h/.m— addedkColorMapLinkHoverandkColorMapLinkActive(extended colour slots 2 and 3)iTermColorPresets.m— included new colour keys in preset serialisation listiTermAttributedStringBuilder.m— unified hover colour check across Metal and non-Metal pathsMetal Rendering
iTermMetalPerFrameStateConfiguration.h/.m— addedunderlineStylefield and hover/active colour flagsiTermMetalPerFrameStateRow.h/.m— per-row snapshot of active link range (mirrors existing hover tracking)iTermMetalPerFrameState.m— bounds-checked underline style substitution with three-way colour priority (active > hover > default)Session & View Logic
PTYSession.m/.swift— colour table wiring andterminalOnlyKeysconfigurationPTYTextView+ARC.m/PTYTextView.m— set/clear active link range on Cmd+mouseDown/mouseUpiTermTextDrawingHelper.h/.m—activeLinkRangeproperty andactiveLinkRangeOnLine:methodUI
ProfilesColorsPreferencesViewController.m— IBOutlets and control registration for the style picker and colour wells (xib wiring required — see Known Gaps below)Tests
ModernTests/LinkColourMapAndActiveRangeTests.swift— 21 unit tests covering colour priority, range tracking, and style substitutionValidation
To test the feature:
The three-way colour priority ensures: active colour (when clicking) > hover colour (when hovering) > default link colour.
Known Gaps
The
Interfaces/PreferencePanel.xibchanges are not included in this commit. The xib requires Xcode Interface Builder to wire:All IBOutlet declarations and
defineControl:registrations are in place inProfilesColorsPreferencesViewController.m— only the visual controls in the xib file are pending.Notes