fix(tui): enable OSC 8 for Windows Terminal (closes #4923)

This commit is contained in:
Armin Ronacher
2026-05-25 00:55:39 +02:00
parent e007fcd0d2
commit 3eb002766f
3 changed files with 9 additions and 2 deletions

View File

@@ -5,6 +5,7 @@
### Fixed
- Fixed `Shift+Enter` in Apple Terminal by detecting local macOS modifier state when Terminal.app sends plain Return.
- Fixed Windows Terminal capability detection to enable OSC 8 hyperlinks, preserving clickable long URLs across wrapped lines ([#4923](https://github.com/earendil-works/pi/issues/4923)).
## [0.75.5] - 2026-05-23

View File

@@ -70,6 +70,10 @@ export function detectCapabilities(): TerminalCapabilities {
return { images: "iterm2", trueColor: true, hyperlinks: true };
}
if (process.env.WT_SESSION) {
return { images: null, trueColor: true, hyperlinks: true };
}
if (termProgram === "vscode") {
return { images: null, trueColor: true, hyperlinks: true };
}
@@ -82,7 +86,7 @@ export function detectCapabilities(): TerminalCapabilities {
// text" on terminals that swallow it, which means the URL disappears from
// the rendered output. Default to the legacy `text (url)` behavior unless we
// have positively identified a hyperlink-capable terminal above.
return { images: null, trueColor: hasTrueColorHint || !!process.env.WT_SESSION, hyperlinks: false };
return { images: null, trueColor: hasTrueColorHint, hyperlinks: false };
}
export function getCapabilities(): TerminalCapabilities {

View File

@@ -273,10 +273,12 @@ describe("detectCapabilities", () => {
});
});
it("detects truecolor for Windows Terminal outside multiplexers", () => {
it("enables truecolor and hyperlinks for Windows Terminal outside multiplexers", () => {
withEnv({ WT_SESSION: "session", TERM: "xterm-256color" }, () => {
const caps = detectCapabilities();
assert.strictEqual(caps.trueColor, true);
assert.strictEqual(caps.hyperlinks, true);
assert.strictEqual(caps.images, null);
});
});