mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-20 11:00:40 -07:00
Modernize MaxSizedBox to use <Box maxHeight> and ResizeObservers (#16565)
This commit is contained in:
@@ -178,17 +178,8 @@ export function colorizeCode({
|
||||
);
|
||||
|
||||
return (
|
||||
<Box key={index} minHeight={useMaxSizedBox ? undefined : 1}>
|
||||
{/* We have to render line numbers differently depending on whether we are using MaxSizeBox or not */}
|
||||
{showLineNumbers && useMaxSizedBox && (
|
||||
<Text color={activeTheme.colors.Gray}>
|
||||
{`${String(index + 1 + hiddenLinesCount).padStart(
|
||||
padWidth,
|
||||
' ',
|
||||
)} `}
|
||||
</Text>
|
||||
)}
|
||||
{showLineNumbers && !useMaxSizedBox && (
|
||||
<Box key={index} minHeight={1}>
|
||||
{showLineNumbers && (
|
||||
<Box
|
||||
minWidth={padWidth + 1}
|
||||
flexShrink={0}
|
||||
@@ -236,14 +227,8 @@ export function colorizeCode({
|
||||
const lines = codeToHighlight.split('\n');
|
||||
const padWidth = String(lines.length).length; // Calculate padding width based on number of lines
|
||||
const fallbackLines = lines.map((line, index) => (
|
||||
<Box key={index} minHeight={useMaxSizedBox ? undefined : 1}>
|
||||
{/* We have to render line numbers differently depending on whether we are using MaxSizeBox or not */}
|
||||
{showLineNumbers && useMaxSizedBox && (
|
||||
<Text color={activeTheme.defaultColor}>
|
||||
{`${String(index + 1).padStart(padWidth, ' ')} `}
|
||||
</Text>
|
||||
)}
|
||||
{showLineNumbers && !useMaxSizedBox && (
|
||||
<Box key={index} minHeight={1}>
|
||||
{showLineNumbers && (
|
||||
<Box
|
||||
minWidth={padWidth + 1}
|
||||
flexShrink={0}
|
||||
|
||||
Reference in New Issue
Block a user