merge: fix terminal fullscreen cumulative shrinkage
This commit is contained in:
@@ -568,7 +568,7 @@ export const TerminalComponent = React.forwardRef<TerminalRef, TerminalProps>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`terminal-wrapper ${isMobile ? "mobile" : ""}`}>
|
<div className={`terminal-wrapper ${isMobile ? "mobile" : ""} ${!showControls ? "no-controls" : ""}`}>
|
||||||
{showControls && (
|
{showControls && (
|
||||||
<div className="terminal-header">
|
<div className="terminal-header">
|
||||||
<div className="terminal-header-left">
|
<div className="terminal-header-left">
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ const SESSIONS_TO_INFO = (sessions: TerminalSession[]): TerminalSessionInfo[] =>
|
|||||||
status: s.status as TerminalSessionInfo["status"],
|
status: s.status as TerminalSessionInfo["status"],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
type TerminalStatus = "connecting" | "connected" | "disconnected" | "error" | "resetting";
|
type TerminalStatus =
|
||||||
|
| "connecting"
|
||||||
|
| "connected"
|
||||||
|
| "disconnected"
|
||||||
|
| "error"
|
||||||
|
| "resetting";
|
||||||
|
|
||||||
export const TerminalPage: React.FC = () => {
|
export const TerminalPage: React.FC = () => {
|
||||||
const { instanceId } = useParams<{
|
const { instanceId } = useParams<{
|
||||||
@@ -30,7 +35,9 @@ export const TerminalPage: React.FC = () => {
|
|||||||
const headerAutoHide = useAutoHide({ timeout: 3000, enabled: isMobile });
|
const headerAutoHide = useAutoHide({ timeout: 3000, enabled: isMobile });
|
||||||
|
|
||||||
// Track terminal status and callbacks for unified fullscreen header
|
// Track terminal status and callbacks for unified fullscreen header
|
||||||
const [terminalStatuses, setTerminalStatuses] = useState<Record<string, TerminalStatus>>({});
|
const [terminalStatuses, setTerminalStatuses] = useState<
|
||||||
|
Record<string, TerminalStatus>
|
||||||
|
>({});
|
||||||
const changeFontSizeRef = useRef<((delta: number) => void) | null>(null);
|
const changeFontSizeRef = useRef<((delta: number) => void) | null>(null);
|
||||||
const [showResetConfirm, setShowResetConfirm] = useState(false);
|
const [showResetConfirm, setShowResetConfirm] = useState(false);
|
||||||
|
|
||||||
@@ -73,12 +80,19 @@ export const TerminalPage: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (activeSessionId && terminalRefs.current[activeSessionId]) {
|
if (activeSessionId && terminalRefs.current[activeSessionId]) {
|
||||||
const ref = terminalRefs.current[activeSessionId];
|
const ref = terminalRefs.current[activeSessionId];
|
||||||
// Small delay to allow display:block to apply
|
// Double rAF ensures layout has settled after the display:block switch
|
||||||
const timer = setTimeout(() => {
|
let raf1 = 0;
|
||||||
|
let raf2 = 0;
|
||||||
|
raf1 = requestAnimationFrame(() => {
|
||||||
|
raf2 = requestAnimationFrame(() => {
|
||||||
ref.current?.fit();
|
ref.current?.fit();
|
||||||
ref.current?.focus();
|
ref.current?.focus();
|
||||||
}, 50);
|
});
|
||||||
return () => clearTimeout(timer);
|
});
|
||||||
|
return () => {
|
||||||
|
cancelAnimationFrame(raf1);
|
||||||
|
cancelAnimationFrame(raf2);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}, [activeSessionId]);
|
}, [activeSessionId]);
|
||||||
|
|
||||||
@@ -192,7 +206,10 @@ export const TerminalPage: React.FC = () => {
|
|||||||
_focusInput: () => void,
|
_focusInput: () => void,
|
||||||
changeFontSize: (delta: number) => void,
|
changeFontSize: (delta: number) => void,
|
||||||
) => {
|
) => {
|
||||||
setTerminalStatuses((prev) => ({ ...prev, [activeSessionId ?? "default"]: status }));
|
setTerminalStatuses((prev) => ({
|
||||||
|
...prev,
|
||||||
|
[activeSessionId ?? "default"]: status,
|
||||||
|
}));
|
||||||
changeFontSizeRef.current = changeFontSize;
|
changeFontSizeRef.current = changeFontSize;
|
||||||
},
|
},
|
||||||
[activeSessionId],
|
[activeSessionId],
|
||||||
|
|||||||
@@ -2562,6 +2562,13 @@ a.nav-item,
|
|||||||
background: #1e1e1e;
|
background: #1e1e1e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When controls are hidden (fullscreen), only the container is in flow;
|
||||||
|
force it into the 1fr track so it fills the wrapper instead of landing
|
||||||
|
in the auto track and shrinking on each fit(). */
|
||||||
|
.terminal-wrapper.no-controls {
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
.terminal-header {
|
.terminal-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: terminal-fullscreen-unified-header
|
name: terminal-fullscreen-unified-header
|
||||||
status: in-progress
|
status: completed
|
||||||
phase: apply
|
phase: verify
|
||||||
type: bugfix
|
type: bugfix
|
||||||
description: Fix terminal fullscreen mode where session switcher overlays terminal controls. Combine both elements into a single unified header visible at all times.
|
description: Fix terminal fullscreen mode where session switcher overlays terminal controls. Combine both elements into a single unified header visible at all times.
|
||||||
created_at: 2026-05-28
|
created_at: 2026-05-28
|
||||||
|
|||||||
Reference in New Issue
Block a user