Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions frontend/app/view/term/termwrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,36 @@ export class TermWrap {
this.lastCommandAtom = jotai.atom(null) as jotai.PrimitiveAtom<string | null>;
this.claudeCodeActiveAtom = jotai.atom(false);
this.webglEnabledAtom = jotai.atom(false) as jotai.PrimitiveAtom<boolean>;
// Custom linkHandler for OSC 8 hyperlinks. Without this, xterm.js falls
// back to window.confirm() + window.open(), which Electron's renderer
// blocks — so the confirmation dialog appears but clicking OK silently
// fails. Route OSC 8 clicks through the same Cmd/Ctrl-click path that
// WebLinksAddon uses for regex-detected URLs.
options.linkHandler = {
activate: (event: MouseEvent, uri: string) => {
event.preventDefault();
switch (PLATFORM) {
case PlatformMacOS:
if (event.metaKey) {
fireAndForget(() => openLink(uri));
}
break;
default:
if (event.ctrlKey) {
fireAndForget(() => openLink(uri));
}
break;
}
},
hover: (event: MouseEvent, uri: string) => {
this.hoveredLinkUri = uri;
this.onLinkHover?.(uri, event.clientX, event.clientY);
},
leave: () => {
this.hoveredLinkUri = null;
this.onLinkHover?.(null, 0, 0);
},
};
this.terminal = new Terminal(options);
this.fitAddon = new FitAddon();
this.serializeAddon = new SerializeAddon();
Expand Down