fix(tui): linkify complete bare URLs with tildes#27088
Merged
Merged
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Background
Bare URLs containing
~in their path are currently only clickable up to the tilde in the interactive TUI. For example, Codex renders the visible text for:https://www.cs.tufts.edu/~nr/cs257/archive/olin-shivers/dissertation.pdfbut the OSC 8 destination stops at
https://www.cs.tufts.edu/. This makes Cmd-click open the wrong location even though the terminal recognizes the complete URL outside Codex.Fixes #26774.
Root Cause
The URL scanner already accepts
~. The truncation happens earlier: with strikethrough parsing enabled,pulldown-cmarksplits this URL into adjacent decodedEvent::Textvalues around the tilde. The Markdown renderer annotated each text event independently, so only the first event still looked like a complete URL with a supported scheme.The renderer now merges adjacent decoded text events before URL annotation. It preserves the combined source range while retaining parser-decoded contents, which avoids regressing entities such as
&.Changes
How to Test
just c.https://www.cs.tufts.edu/~nr/cs257/archive/olin-shivers/dissertation.pdf~, is one destination.Targeted tests:
just test -p codex-tui url_with_tildejust test -p codex-tui merged_text_events_preserve_entity_decodingThe full
codex-tuitest run was also executed. Its only failures were the two existing Guardian feature-flag tests:app::tests::update_feature_flags_disabling_guardian_clears_review_policy_and_restores_defaultapp::tests::update_feature_flags_disabling_guardian_clears_manual_review_policy_without_history