Add RawText markup support for escape sequences with safe width and search handling #370
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.
Motivation
This change introduces a small, generic markup layer so VIT can carry raw terminal escape sequences (like OSC‑8 hyperlinks) without corrupting them or letting them affect layout sizing. That makes it possible for custom formatters to inject clickable links in supported terminals (e.g., WezTerm) while keeping column widths and search behavior stable.
What Changed
New
vit/markup.pyhelper module with:RawText— a tiny wrapper for raw byte sequences (e.g., OSC‑8)normalize_markup()— converts markup containing RawText into byte-safe markup for urwidmarkup_display_width()— computes visible width while ignoring RawTextmarkup_to_str()— reconstructs a search-safe string from markup, ignoring RawTextTask table rendering now normalizes markup and uses
markup_display_width()for column sizing.Search string reconstruction is now robust to mixed str/bytes/RawText markup.
Why This Matters
Before this, any control sequence embedded in a description would be encoded with replacement by urwid, producing
?]8;;...instead of a real hyperlink. By exposing aRawTextcontainer, formatter authors can inject raw OSC‑8 sequences safely without breaking layout or search.Example: Custom Description Formatter with OSC‑8 Links
Below is a minimal example formatter that turns Jira-style prefixes into clickable terminal hyperlinks. Save as
~/.vit/formatters/description.py:NOTE: The code changes and example code were generated by Codex. I did review the code that would be committed to VIT, and it seems solid, however, I did not verify the example override, or if the code added to VIT would work as expected -- this will need to be verified by someone prior to merge