Skip to content

Handle cells containing OSC 8 hyperlinks#145

Open
hlascelles wants to merge 1 commit into
tj:masterfrom
hlascelles:fix/osc8-hyperlink-width
Open

Handle cells containing OSC 8 hyperlinks#145
hlascelles wants to merge 1 commit into
tj:masterfrom
hlascelles:fix/osc8-hyperlink-width

Conversation

@hlascelles

Copy link
Copy Markdown

Terminal::Table::Util.ansi_escape strips ANSI CSI escape sequences (e.g. SGR color codes) when computing a cell's visible width, but it does not recognize OSC 8 hyperlink escape sequences (\e]8;;URL\e\\text\e]8;;\e\\ or the BEL-terminated variant \e]8;;URL\atext\e]8;;\a).

As a result, any cell whose value includes a terminal hyperlink is measured as if the escape sequence bytes were visible characters, inflating the calculated column width and breaking table alignment/borders.

This PR caters for those hyperlink sequences.

`Terminal::Table::Util.ansi_escape` strips ANSI CSI escape sequences (e.g. SGR color codes) when computing a cell's visible width, but it does not recognize OSC 8 hyperlink escape sequences (`\e]8;;URL\e\\text\e]8;;\e\\` or the BEL-terminated variant ``\e]8;;URL\atext\e]8;;\a`).

As a result, any cell whose value includes a terminal hyperlink is measured as if the escape sequence bytes were visible characters, inflating the calculated column width and breaking table alignment/borders.

This PR caters for those hyperlink sequences.
@hlascelles hlascelles changed the title Fix column width miscalculation for cells containing OSC 8 hyperlinks Handle cells containing OSC 8 hyperlinks Jul 21, 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.

1 participant