Skip to content
Open
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
21 changes: 13 additions & 8 deletions sdks/react/src/ProcessTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
import type { FitAddon as GhosttyFitAddon, Terminal as GhosttyTerminal } from "ghostty-web";
import type { CSSProperties } from "react";
import { useEffect, useRef, useState } from "react";
import type {
SandboxAgent,
TerminalErrorStatus,
TerminalExitStatus,
TerminalReadyStatus,
} from "sandbox-agent";
import type { SandboxAgent, TerminalErrorStatus, TerminalExitStatus, TerminalReadyStatus } from "sandbox-agent";

type ConnectionState = "connecting" | "ready" | "closed" | "error";

Expand All @@ -23,6 +18,15 @@ export interface ProcessTerminalProps {
statusBarStyleOverride?: CSSProperties;
height?: number | string;
showStatusBar?: boolean;
/**
* Forwarded to `ghostty.Terminal`. Defaults to `true`. Opt out with
* `false` to work around a canvas-rendering bug in ghostty-web@0.4.0
* where transparent-background rendering skips `clearRect` before
* `fillRect`, causing stale cells to accumulate on screen. Fix is
* merged upstream (coder/ghostty-web#116) but not yet released
* (coder/ghostty-web#137).
*/
allowTransparency?: boolean;
onExit?: (status: TerminalExitStatus) => void;
onError?: (error: TerminalErrorStatus | Error) => void;
}
Expand Down Expand Up @@ -106,6 +110,7 @@ export const ProcessTerminal = ({
statusBarStyleOverride,
height = 360,
showStatusBar = true,
allowTransparency = true,
onExit,
onError,
}: ProcessTerminalProps) => {
Expand Down Expand Up @@ -148,7 +153,7 @@ export const ProcessTerminal = ({
}

terminal = new ghostty.Terminal({
allowTransparency: true,
allowTransparency,
cursorBlink: true,
cursorStyle: "block",
fontFamily: "ui-monospace, SFMono-Regular, SF Mono, Menlo, monospace",
Expand Down Expand Up @@ -253,7 +258,7 @@ export const ProcessTerminal = ({
session?.close();
terminal?.dispose();
};
}, [client, onError, onExit, processId]);
}, [allowTransparency, client, onError, onExit, processId]);

return (
<div className={className} style={{ ...shellStyle, ...style }}>
Expand Down
Loading