mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 18:44:30 -07:00
fix(cli): allow ask question dialog to take full window height (#23693)
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
} from 'react';
|
||||
import {
|
||||
type DOMElement,
|
||||
measureElement,
|
||||
ResizeObserver,
|
||||
useApp,
|
||||
useStdout,
|
||||
useStdin,
|
||||
@@ -397,7 +397,6 @@ export const AppContainer = (props: AppContainerProps) => {
|
||||
const branchName = useGitBranchName(config.getTargetDir());
|
||||
|
||||
// Layout measurements
|
||||
const mainControlsRef = useRef<DOMElement>(null);
|
||||
// For performance profiling only
|
||||
const rootUiRef = useRef<DOMElement>(null);
|
||||
const lastTitleRef = useRef<string | null>(null);
|
||||
@@ -1396,6 +1395,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
!proQuotaRequest &&
|
||||
!copyModeEnabled;
|
||||
|
||||
const observerRef = useRef<ResizeObserver | null>(null);
|
||||
const [controlsHeight, setControlsHeight] = useState(0);
|
||||
const [lastNonCopyControlsHeight, setLastNonCopyControlsHeight] = useState(0);
|
||||
|
||||
@@ -1410,15 +1410,26 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
? lastNonCopyControlsHeight
|
||||
: controlsHeight;
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (mainControlsRef.current) {
|
||||
const fullFooterMeasurement = measureElement(mainControlsRef.current);
|
||||
const roundedHeight = Math.round(fullFooterMeasurement.height);
|
||||
if (roundedHeight > 0 && roundedHeight !== controlsHeight) {
|
||||
setControlsHeight(roundedHeight);
|
||||
}
|
||||
const mainControlsRef = useCallback((node: DOMElement | null) => {
|
||||
if (observerRef.current) {
|
||||
observerRef.current.disconnect();
|
||||
observerRef.current = null;
|
||||
}
|
||||
}, [buffer, terminalWidth, terminalHeight, controlsHeight, isInputActive]);
|
||||
|
||||
if (node) {
|
||||
const observer = new ResizeObserver((entries) => {
|
||||
const entry = entries[0];
|
||||
if (entry) {
|
||||
const roundedHeight = Math.round(entry.contentRect.height);
|
||||
setControlsHeight((prev) =>
|
||||
roundedHeight !== prev ? roundedHeight : prev,
|
||||
);
|
||||
}
|
||||
});
|
||||
observer.observe(node);
|
||||
observerRef.current = observer;
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Compute available terminal height based on stable controls measurement
|
||||
const availableTerminalHeight = Math.max(
|
||||
|
||||
Reference in New Issue
Block a user