@@ -266,20 +266,27 @@ export const MultilineInput = forwardRef<
266266 const isPlaceholder = value . length === 0 && placeholder . length > 0
267267 const displayValue = isPlaceholder ? placeholder : value
268268 const showCursor = focused
269-
269+
270270 // Replace tabs with spaces for proper rendering
271271 // Terminal tab stops are typically 8 columns, but 4 is more readable
272272 const TAB_WIDTH = 4
273- const displayValueForRendering = displayValue . replace ( / \t / g, ' ' . repeat ( TAB_WIDTH ) )
274-
273+ const displayValueForRendering = displayValue . replace (
274+ / \t / g,
275+ ' ' . repeat ( TAB_WIDTH ) ,
276+ )
277+
275278 // Calculate cursor position in the expanded string (accounting for tabs)
276279 let renderCursorPosition = 0
277280 for ( let i = 0 ; i < cursorPosition && i < displayValue . length ; i ++ ) {
278281 renderCursorPosition += displayValue [ i ] === '\t' ? TAB_WIDTH : 1
279282 }
280-
281- const beforeCursor = showCursor ? displayValueForRendering . slice ( 0 , renderCursorPosition ) : ''
282- const afterCursor = showCursor ? displayValueForRendering . slice ( renderCursorPosition ) : ''
283+
284+ const beforeCursor = showCursor
285+ ? displayValueForRendering . slice ( 0 , renderCursorPosition )
286+ : ''
287+ const afterCursor = showCursor
288+ ? displayValueForRendering . slice ( renderCursorPosition )
289+ : ''
283290 const activeChar = afterCursor . charAt ( 0 ) || ' '
284291 const shouldHighlight =
285292 showCursor &&
@@ -773,22 +780,12 @@ export const MultilineInput = forwardRef<
773780 [ layoutContent , cursorProbe , getEffectiveCols , maxHeight ] ,
774781 )
775782
776- const height = layoutMetrics . heightLines
777-
778- const shouldRenderBottomGutter = layoutMetrics . gutterEnabled
779-
780783 const inputColor = isPlaceholder
781784 ? theme . muted
782785 : focused
783786 ? theme . inputFocusedFg
784787 : theme . inputFg
785788
786- const textStyle : Record < string , unknown > = {
787- bg : 'transparent' ,
788- fg : inputColor ,
789- }
790-
791- const cursorFg = theme . info
792789 const highlightBg = '#7dd3fc' // Lighter blue for highlight background
793790
794791 return (
@@ -803,7 +800,7 @@ export const MultilineInput = forwardRef<
803800 flexShrink : 0 ,
804801 rootOptions : {
805802 width : '100%' ,
806- height : height ,
803+ height : layoutMetrics . heightLines ,
807804 backgroundColor : 'transparent' ,
808805 flexGrow : 0 ,
809806 flexShrink : 0 ,
@@ -818,7 +815,10 @@ export const MultilineInput = forwardRef<
818815 } ,
819816 } }
820817 >
821- < text ref = { textRef } style = { { ...textStyle , wrapMode : 'word' } } >
818+ < text
819+ ref = { textRef }
820+ style = { { bg : 'transparent' , fg : inputColor , wrapMode : 'word' } }
821+ >
822822 { showCursor ? (
823823 < >
824824 { beforeCursor }
@@ -831,10 +831,7 @@ export const MultilineInput = forwardRef<
831831 { activeChar === ' ' ? '\u00a0' : activeChar }
832832 </ span >
833833 ) : (
834- < span
835- { ...( cursorFg ? { fg : cursorFg } : undefined ) }
836- attributes = { TextAttributes . BOLD }
837- >
834+ < span fg = { theme . info } attributes = { TextAttributes . BOLD } >
838835 { CURSOR_CHAR }
839836 </ span >
840837 ) }
@@ -843,12 +840,12 @@ export const MultilineInput = forwardRef<
843840 ? afterCursor . slice ( 1 )
844841 : ''
845842 : afterCursor }
846- { shouldRenderBottomGutter ? '\n' : '' }
843+ { layoutMetrics . gutterEnabled ? '\n' : '' }
847844 </ >
848845 ) : (
849846 < >
850847 { displayValueForRendering }
851- { shouldRenderBottomGutter ? '\n' : '' }
848+ { layoutMetrics . gutterEnabled ? '\n' : '' }
852849 </ >
853850 ) }
854851 </ text >
0 commit comments