@@ -80,7 +80,7 @@ interface IPrivateReplService {
8080}
8181
8282function revealLastElement ( tree : WorkbenchAsyncDataTree < any , any , any > ) {
83- tree . scrollTop = Number . POSITIVE_INFINITY ;
83+ tree . scrollTop = tree . scrollHeight - tree . renderHeight ;
8484}
8585
8686const sessionsToIgnore = new Set < IDebugSession > ( ) ;
@@ -799,6 +799,8 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
799799 constructor ( private configurationService : IConfigurationService ) { }
800800
801801 getHeight ( element : IReplElement ) : number {
802+ const countNumberOfLines = ( str : string ) => Math . max ( 1 , ( str && str . match ( / \r \n | \n / g) || [ ] ) . length ) ;
803+
802804 // Give approximate heights. Repl has dynamic height so the tree will measure the actual height on its own.
803805 const config = this . configurationService . getValue < IDebugConfiguration > ( 'debug' ) ;
804806 const fontSize = config . console . fontSize ;
@@ -817,13 +819,13 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
817819 return rowHeight ;
818820 }
819821
820- let valueRows = value ? Math . ceil ( value . length / 150 ) : 0 ;
822+ let valueRows = value ? ( countNumberOfLines ( value ) + Math . floor ( value . length / 150 ) ) : 0 ;
821823 return rowHeight * valueRows ;
822824 }
823825
824826 if ( element instanceof SimpleReplElement || element instanceof ReplEvaluationInput ) {
825827 let value = element . value ;
826- let valueRows = Math . ceil ( value . length / 150 ) ;
828+ let valueRows = countNumberOfLines ( value ) + Math . floor ( value . length / 150 ) ;
827829
828830 return valueRows * rowHeight ;
829831 }
0 commit comments