Skip to content

Commit 5cd3b2a

Browse files
authored
Merge pull request #82100 from microsoft/isidorn/debugAutoScroll
Revert "fixes #77837"
2 parents 7cc583c + b5ed575 commit 5cd3b2a

File tree

1 file changed

+5
-3
lines changed
  • src/vs/workbench/contrib/debug/browser

1 file changed

+5
-3
lines changed

src/vs/workbench/contrib/debug/browser/repl.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ interface IPrivateReplService {
8080
}
8181

8282
function revealLastElement(tree: WorkbenchAsyncDataTree<any, any, any>) {
83-
tree.scrollTop = Number.POSITIVE_INFINITY;
83+
tree.scrollTop = tree.scrollHeight - tree.renderHeight;
8484
}
8585

8686
const 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

Comments
 (0)