Status line: OSC 8 hyperlinks break multiline rendering
Description
When a status line script outputs OSC 8 hyperlink escape sequences (\e]8;;URL\aTEXT\e]8;;\a), multiline output breaks — only the first line is rendered. Removing the OSC 8 sequences restores multiline behavior.
Reproduction
Working (two lines, no OSC 8):
#!/bin/bash
cat > /dev/null
E=$'\e'
BLUE="${E}[34m"
GREEN="${E}[32m"
RESET="${E}[0m"
echo "${BLUE}line one with color${RESET}"
echo "${GREEN}line two with color${RESET}"
Result: Both lines render correctly.
Broken (two lines, with OSC 8):
#!/bin/bash
cat > /dev/null
E=$'\e'
BEL=$'\a'
MAGENTA="${E}[35m"
BLUE="${E}[34m"
CYAN="${E}[36m"
GREEN="${E}[32m"
RESET="${E}[0m"
echo "${MAGENTA}(worktree)${RESET} | ${BLUE}${E}]8;;https://example.com${BEL}PR #123${E}]8;;${BEL}${RESET} | ${CYAN}branch-name${RESET}"
echo "${GREEN}ctx:5%${RESET}"
Result: Only the first line renders. Second line disappears.
Also broken (single OSC 8 link):
#!/bin/bash
cat > /dev/null
E=$'\e'
BEL=$'\a'
BLUE="${E}[34m"
GREEN="${E}[32m"
RESET="${E}[0m"
echo "before ${BLUE}${E}]8;;https://example.com${BEL}link${E}]8;;${BEL}${RESET} after"
echo "${GREEN}line two${RESET}"
Result: Both lines render, but the link is NOT clickable (suggesting OSC 8 is being stripped/mishandled by the renderer). Text appears as plain text.
Additional notes
- ANSI color codes (SGR sequences like
\e[34m) work perfectly with multiline — the issue is specific to OSC 8. - Using BEL (
\a/0x07) as the ST terminator. Using\e\\(ESC + backslash) as ST is even more broken — it causes literal characters to leak into output. - Tested on Claude Code 2.1.76, macOS, iTerm2 (which supports OSC 8 natively).
Expected behavior
- OSC 8 hyperlink sequences should be passed through to the terminal so links are clickable (iTerm2, Kitty, WezTerm all support this).
- OSC 8 sequences should not interfere with multiline status line rendering.
Use case
Displaying clickable links to PRs (e.g., Graphite/GitHub) and issue trackers (e.g., Linear) in the status line alongside other session metrics on a second line.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗