mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(tui): detect Herdr as supporting OSC 8 hyperlinks
TERM_PROGRAM=herdr enables hyperlinks with image protocols off. Herdr is checked before outer-terminal detection so leaked variables such as KITTY_WINDOW_ID do not enable images inside Herdr panes. closes #10573
This commit is contained in:
parent
ea6fa125ab
commit
b2363841a5
3 changed files with 23 additions and 0 deletions
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
- Added `Box.setPaddingX(...)` and `Text.setPaddingX(...)` ([#10557](https://github.com/earendil-works/pi/pull/10557) by [@rwachtler](https://github.com/rwachtler))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Markdown links not being clickable in Herdr: `TERM_PROGRAM=herdr` is now detected as supporting OSC 8 hyperlinks ([#10573](https://github.com/earendil-works/pi/issues/10573))
|
||||
|
||||
## [1.0.4] - 2026-10-05
|
||||
|
||||
## [1.0.3] - 2026-10-05
|
||||
|
|
|
|||
|
|
@ -86,6 +86,12 @@ function detectCapabilitiesFromEnvironment(tmuxForwardsHyperlink: () => boolean)
|
|||
return { images: null, trueColor: hasTrueColorHint, hyperlinks: false };
|
||||
}
|
||||
|
||||
// Herdr forwards OSC 8 hyperlinks. It runs inside another terminal whose variables, such as
|
||||
// KITTY_WINDOW_ID, may leak into its panes, so check it first and leave image protocols off.
|
||||
if (termProgram === "herdr") {
|
||||
return { images: null, trueColor: hasTrueColorHint, hyperlinks: true };
|
||||
}
|
||||
|
||||
if (process.env.KITTY_WINDOW_ID || termProgram === "kitty") {
|
||||
return { images: "kitty", trueColor: true, hyperlinks: true };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,6 +317,19 @@ describe("detectCapabilities", () => {
|
|||
});
|
||||
});
|
||||
|
||||
// #10573
|
||||
it("enables hyperlinks without images for Herdr", () => {
|
||||
withEnv({ TERM_PROGRAM: "herdr", TERM: "xterm-256color", COLORTERM: "truecolor", KITTY_WINDOW_ID: "1" }, () => {
|
||||
const caps = detectCapabilities();
|
||||
assert.strictEqual(caps.hyperlinks, true);
|
||||
assert.strictEqual(caps.images, null);
|
||||
assert.strictEqual(caps.trueColor, true);
|
||||
});
|
||||
withEnv({ TERM_PROGRAM: "herdr", PI_HYPERLINKS: "0" }, () => {
|
||||
assert.strictEqual(detectCapabilities().hyperlinks, false);
|
||||
});
|
||||
});
|
||||
|
||||
it("enables hyperlinks for Ghostty", () => {
|
||||
withEnv({ TERM_PROGRAM: "ghostty" }, () => {
|
||||
const caps = detectCapabilities();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue