提交 f467841b 编写于 作者: I isidor

tree: scroll position is 1 if scrolled all the way

fixes #40899
上级 b2df3e8b
...@@ -826,7 +826,7 @@ export class TreeView extends HeightMap { ...@@ -826,7 +826,7 @@ export class TreeView extends HeightMap {
public getScrollPosition(): number { public getScrollPosition(): number {
const height = this.getTotalHeight() - this.viewHeight; const height = this.getTotalHeight() - this.viewHeight;
return height <= 0 ? 0 : this.scrollTop / height; return height <= 0 ? 1 : this.scrollTop / height;
} }
public setScrollPosition(pos: number): void { public setScrollPosition(pos: number): void {
...@@ -1653,4 +1653,4 @@ export class TreeView extends HeightMap { ...@@ -1653,4 +1653,4 @@ export class TreeView extends HeightMap {
super.dispose(); super.dispose();
} }
} }
\ No newline at end of file
...@@ -118,7 +118,7 @@ export class Repl extends Panel implements IPrivateReplService { ...@@ -118,7 +118,7 @@ export class Repl extends Panel implements IPrivateReplService {
this.refreshTimeoutHandle = null; this.refreshTimeoutHandle = null;
const previousScrollPosition = this.tree.getScrollPosition(); const previousScrollPosition = this.tree.getScrollPosition();
this.tree.refresh().then(() => { this.tree.refresh().then(() => {
if (previousScrollPosition === 1 || previousScrollPosition === 0) { if (previousScrollPosition === 1) {
// Only scroll if we were scrolled all the way down before tree refreshed #10486 // Only scroll if we were scrolled all the way down before tree refreshed #10486
this.tree.setScrollPosition(1); this.tree.setScrollPosition(1);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册