mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-18 17:20:38 -07:00
fix(ui): prevent flicker by constraining content height
Resolves flicker and UI instability by dynamically calculating the available vertical space for the main content area. A ResizeObserver is used to measure the height of the composer/input area. This height is subtracted from the total terminal height, and the result is used to set a on the component via . This ensures the total UI height never exceeds the terminal viewport, preventing overflow and eliminating the root cause of the flicker during re-renders.
This commit is contained in:
@@ -4,6 +4,24 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
// Mock the ResizeObserver API for tests.
|
||||
// This needs to be at the top of the file to ensure it's available globally
|
||||
// before any other modules (especially React components) are imported.
|
||||
// Otherwise, we can get a "ResizeObserver is not defined" error during test runs.
|
||||
class ResizeObserver {
|
||||
observe() {
|
||||
// do nothing
|
||||
}
|
||||
unobserve() {
|
||||
// do nothing
|
||||
}
|
||||
disconnect() {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
global.ResizeObserver = ResizeObserver;
|
||||
|
||||
import { vi, beforeEach, afterEach } from 'vitest';
|
||||
import { format } from 'node:util';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user