File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -178,8 +178,16 @@ function handleCommand(input) {
178178
179179function displayOutput ( text , success = true ) {
180180 const timestamp = new Date ( ) . toLocaleTimeString ( ) ;
181- const line = `[${ timestamp } ] ${ text } ` ;
182- outputElement . innerHTML += `<div class="${ success ? '' : 'error' } ">${ line } </div>` ;
181+ // Replace escaped newlines with actual newlines and handle indentation
182+ const formattedText = text . replace ( / \\ n / g, '\n' ) . split ( '\n' ) . map ( line => line . trim ( ) ) . join ( '\n' ) ;
183+ const lines = formattedText . split ( '\n' ) ;
184+
185+ lines . forEach ( ( line , index ) => {
186+ // Only add timestamp to first line
187+ const prefix = index === 0 ? `[${ timestamp } ] ` : ' ' ;
188+ outputElement . innerHTML += `<div class="${ success ? '' : 'error' } ">${ prefix } ${ line } </div>` ;
189+ } ) ;
190+
183191 scrollToBottom ( ) ;
184192}
185193
You can’t perform that action at this time.
0 commit comments