Skip to content

Match complete OSC 8 id parameter names when wrapping links - #325

Closed
ainuo-AI wants to merge 1 commit into
jquast:masterfrom
ainuo-AI:fix/hyperlink-id-parameter-matching
Closed

ainuo-AI wants to merge 1 commit into
jquast:masterfrom
ainuo-AI:fix/hyperlink-id-parameter-matching

Conversation

@ainuo-AI

Copy link
Copy Markdown

wrap() checks whether OSC 8 metadata contains the substring 'id='. Parameters such as 'grid=tile-1', 'other_id=label' or 'custom=id=value' therefore look like an existing hyperlink ID. When that link wraps, its fragments do not receive the shared ID that SequenceTextWrapper promises to generate.

Check complete colon-delimited metadata items for the 'id=' prefix, and reuse that result when inserting the opening sequence. Preserve existing IDs and unrelated metadata. Add 14 cases covering BEL/ST terminators, misleading keys/values, a bare 'id' item and genuine IDs in different positions; update the history entry.

Validation on Windows / CPython 3.12.10 with WCWIDTH_PYTHON=1:

  • New regressions: 6 failed / 8 passed against unchanged upstream; all 14 pass with the fix.
  • Complete pure-Python test/doctest suite with coverage: 1870 passed / 50 skipped. Skips require the optional C extension or unavailable Unicode conformance data files.
  • Flake8 for both changed Python files, strict mypy for all 49 package files and git diff --check pass.

The C-extension mode and full supported interpreter/OS matrix were not run locally. AI assistance: OpenAI Codex was used for investigation, implementation and running the validation commands.

@jquast

jquast commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Parameters such as 'grid=tile-1', 'other_id=label' or 'custom=id=value' therefore look like an existing hyperlink ID.

The specification for OSC 8 reads:

params is an optional list of key=value assignments, separated by the : character. Example: id=xyz123:foo=bar:baz=quux. Currently only the id key is defined, see below. These parameters allow future extendability of this feature.

I have researched and found no evidence of any additional ID's proposed for use with OSC 8 in any terminal emulator. Further, some terminal emulators would be unable to handle any "extra" metadata. I will add this to the list of Unlikely Sequences.

The theoretical fix of your bug report is,

  • a hyperlink is used without an id parameter, but a custom "extendability" metadata, e.g. grid=tile-1.
  • wcwidth.wrap() may terminate and repeat as-is across two lines.
  • but without a generated-shared id= parameter.
  • so when a user "hovers" over this hyperlink, it does not appear "continuous" across the two lines.

The OSC 8 Hyperlinks in Terminal Emulators specification is closed, the author's last comment before deleting all comments in Mar. 2025:

In a couple of days, when the two current ongoing discussions settle down, I'll get this site crawled by the well known web archiver, and then I'll disable commenting.

I realized (multiple times) that it was a mistake to host this document on a site that allows commenting. It should have been hosted on a static site from day 1, with no commenting possibility, as are the vast majority of documentations or specifications out there.

I have no desire to keep voluntarily providing consultation support for this feature that I've co-designed, implemented, and documented 8 years ago. It's time for me to leave this past work behind and move on.

I also have no desire to take any more blame for anything that I did not do 100% perfectly, or does not 100% pleases a commenter.

But as I have written previously, because the specification says it could be defined, and the performance regression is small, I really don't have any choice but to accept some form of this change, to try and prevent AI Agents from boiling water and re-creating and submitting the same PR later.

@jquast jquast closed this Nov 13, 2026
@ainuo-AI

Copy link
Copy Markdown
Author

Thank you for investigating this and explaining the project's approach to Unlikely Sequences. I understand the concerns about practical terminal usage and performance, and appreciate the documentation update. I'll focus future reports on concrete examples from real terminal behavior.

jquast added a commit that referenced this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants