import { CommandResult } from "./CommandResult" ; param lines param extra param indentation export const addLineEnder = ( lines , extra , indentation ) : void => { let currentLine = lines [ lines . length - 1 ] ; let endlineIndex = extra . indexOf ( "\n" ) ; if ( endlineIndex === - 1 ) { currentLine . text += extra ; currentLine . indentation = indentation ; return ; } let currentIndex = 0 ; while ( endlineIndex !== - 1 ) { const component = extra . substring ( currentIndex , endlineIndex ) ; currentLine . text += component ; currentIndex = endlineIndex ; currentLine = new CommandResult ( "" , 0 ) ; lines . push ( currentLine ) ; currentIndex += 1 ; endlineIndex = extra . indexOf ( "\n" , currentIndex ) ; } if ( currentIndex !== - 1 ) { currentLine . text = extra . substring ( currentIndex ) ; } lines [ lines . length - 1 ] . indentation = indentation ; } ;