@@ -80,7 +80,7 @@ interface IPrivateReplService {
80
80
}
81
81
82
82
function revealLastElement ( tree : WorkbenchAsyncDataTree < any , any , any > ) {
83
- tree . scrollTop = Number . POSITIVE_INFINITY ;
83
+ tree . scrollTop = tree . scrollHeight - tree . renderHeight ;
84
84
}
85
85
86
86
const sessionsToIgnore = new Set < IDebugSession > ( ) ;
@@ -799,6 +799,8 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
799
799
constructor ( private configurationService : IConfigurationService ) { }
800
800
801
801
getHeight ( element : IReplElement ) : number {
802
+ const countNumberOfLines = ( str : string ) => Math . max ( 1 , ( str && str . match ( / \r \n | \n / g) || [ ] ) . length ) ;
803
+
802
804
// Give approximate heights. Repl has dynamic height so the tree will measure the actual height on its own.
803
805
const config = this . configurationService . getValue < IDebugConfiguration > ( 'debug' ) ;
804
806
const fontSize = config . console . fontSize ;
@@ -817,13 +819,13 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
817
819
return rowHeight ;
818
820
}
819
821
820
- let valueRows = value ? Math . ceil ( value . length / 150 ) : 0 ;
822
+ let valueRows = value ? ( countNumberOfLines ( value ) + Math . floor ( value . length / 150 ) ) : 0 ;
821
823
return rowHeight * valueRows ;
822
824
}
823
825
824
826
if ( element instanceof SimpleReplElement || element instanceof ReplEvaluationInput ) {
825
827
let value = element . value ;
826
- let valueRows = Math . ceil ( value . length / 150 ) ;
828
+ let valueRows = countNumberOfLines ( value ) + Math . floor ( value . length / 150 ) ;
827
829
828
830
return valueRows * rowHeight ;
829
831
}
0 commit comments