diff --git a/packages/cli/src/ui/components/shared/MaxSizedBox.test.tsx b/packages/cli/src/ui/components/shared/MaxSizedBox.test.tsx index 6d25efffb9..d21cebe971 100644 --- a/packages/cli/src/ui/components/shared/MaxSizedBox.test.tsx +++ b/packages/cli/src/ui/components/shared/MaxSizedBox.test.tsx @@ -6,7 +6,7 @@ import { render, renderWithProviders } from '../../../test-utils/render.js'; import { OverflowProvider } from '../../contexts/OverflowContext.js'; -import { MaxSizedBox, ceilHeight } from './MaxSizedBox.js'; +import { MaxSizedBox } from './MaxSizedBox.js'; import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js'; import { Box, Text } from 'ink'; import { act } from 'react'; @@ -316,17 +316,4 @@ describe('', () => { expect(lastFrame()).toMatchSnapshot(); unmount(); }); - - describe('ceilHeight', () => { - it('should round up fractional heights to next integer', () => { - expect(ceilHeight(2.1)).toBe(3); - expect(ceilHeight(2.9)).toBe(3); - expect(ceilHeight(2.0)).toBe(2); - expect(ceilHeight(0.1)).toBe(1); - }); - - it('should handle zero correctly', () => { - expect(ceilHeight(0)).toBe(0); - }); - }); }); diff --git a/packages/cli/src/ui/components/shared/MaxSizedBox.tsx b/packages/cli/src/ui/components/shared/MaxSizedBox.tsx index e659ce94b1..afc3c3cc10 100644 --- a/packages/cli/src/ui/components/shared/MaxSizedBox.tsx +++ b/packages/cli/src/ui/components/shared/MaxSizedBox.tsx @@ -28,9 +28,6 @@ export interface MaxSizedBoxProps { additionalHiddenLinesCount?: number; } -/** Ensures that fractional heights are correctly identified as overflowing. */ -export const ceilHeight = (height: number): number => Math.ceil(height); - /** * A React component that constrains the size of its children and provides * content-aware truncation when the content exceeds the specified `maxHeight`. @@ -58,8 +55,7 @@ export const MaxSizedBox: React.FC = ({ const observer = new ResizeObserver((entries) => { const entry = entries[0]; if (entry) { - // Use ceilHeight to ensure that fractional heights (e.g. from zooming) that exceed the limit are correctly identified as overflowing. - setContentHeight(ceilHeight(entry.contentRect.height)); + setContentHeight(entry.contentRect.height); } }); observer.observe(node);