Skip to content

Commit

Permalink
Merge pull request #82100 from microsoft/isidorn/debugAutoScroll
Browse files Browse the repository at this point in the history
Revert "fixes #77837"
  • Loading branch information
isidorn authored Oct 8, 2019
2 parents 7cc583c + b5ed575 commit 5cd3b2a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/vs/workbench/contrib/debug/browser/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ interface IPrivateReplService {
}

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

const sessionsToIgnore = new Set<IDebugSession>();
Expand Down Expand Up @@ -799,6 +799,8 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
constructor(private configurationService: IConfigurationService) { }

getHeight(element: IReplElement): number {
const countNumberOfLines = (str: string) => Math.max(1, (str && str.match(/\r\n|\n/g) || []).length);

// Give approximate heights. Repl has dynamic height so the tree will measure the actual height on its own.
const config = this.configurationService.getValue<IDebugConfiguration>('debug');
const fontSize = config.console.fontSize;
Expand All @@ -817,13 +819,13 @@ class ReplDelegate implements IListVirtualDelegate<IReplElement> {
return rowHeight;
}

let valueRows = value ? Math.ceil(value.length / 150) : 0;
let valueRows = value ? (countNumberOfLines(value) + Math.floor(value.length / 150)) : 0;
return rowHeight * valueRows;
}

if (element instanceof SimpleReplElement || element instanceof ReplEvaluationInput) {
let value = element.value;
let valueRows = Math.ceil(value.length / 150);
let valueRows = countNumberOfLines(value) + Math.floor(value.length / 150);

return valueRows * rowHeight;
}
Expand Down

0 comments on commit 5cd3b2a

Please sign in to comment.