fix(cli): hide scrollbars when in alternate buffer copy mode (#18354)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
Andrew Garrett
2026-02-11 07:30:27 +11:00
committed by GitHub
parent f9fc9335f5
commit ef02cec2cd
6 changed files with 67 additions and 7 deletions
@@ -17,6 +17,7 @@ import {
import type React from 'react';
import { theme } from '../../semantic-colors.js';
import { useBatchedScroll } from '../../hooks/useBatchedScroll.js';
import { useUIState } from '../../contexts/UIStateContext.js';
import { type DOMElement, measureElement, Box } from 'ink';
@@ -78,6 +79,7 @@ function VirtualizedList<T>(
initialScrollIndex,
initialScrollOffsetInIndex,
} = props;
const { copyModeEnabled } = useUIState();
const dataRef = useRef(data);
useEffect(() => {
dataRef.current = data;
@@ -474,16 +476,21 @@ function VirtualizedList<T>(
return (
<Box
ref={containerRef}
overflowY="scroll"
overflowY={copyModeEnabled ? 'hidden' : 'scroll'}
overflowX="hidden"
scrollTop={scrollTop}
scrollTop={copyModeEnabled ? 0 : scrollTop}
scrollbarThumbColor={props.scrollbarThumbColor ?? theme.text.secondary}
width="100%"
height="100%"
flexDirection="column"
paddingRight={1}
paddingRight={copyModeEnabled ? 0 : 1}
>
<Box flexShrink={0} width="100%" flexDirection="column">
<Box
flexShrink={0}
width="100%"
flexDirection="column"
marginTop={copyModeEnabled ? -scrollTop : 0}
>
<Box height={topSpacerHeight} flexShrink={0} />
{renderedItems}
<Box height={bottomSpacerHeight} flexShrink={0} />