未验证 提交 cebb2f35 编写于 作者: I Isidor Nikolic 提交者: GitHub

Merge pull request #45317 from Microsoft/isidorn/listServiceDropDisposed

listService: forget about disposed lists
......@@ -97,6 +97,10 @@ export class PagedList<T> implements IDisposable {
return this.list;
}
get onDidDispose(): Event<void> {
return this.list.onDidDispose;
}
get onFocusChange(): Event<IListEvent<T>> {
return mapEvent(this.list.onFocusChange, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
}
......
......@@ -1059,7 +1059,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
}
isDOMFocused(): boolean {
return this.view && this.view.domNode === document.activeElement;
return this.view.domNode === document.activeElement;
}
getHTMLElement(): HTMLElement {
......
......@@ -131,7 +131,7 @@ export class Tree implements _.ITree {
}
public isDOMFocused(): boolean {
return this.view && this.view.isFocused();
return this.view.isFocused();
}
public domBlur(): void {
......
......@@ -73,7 +73,13 @@ export class ListService implements IListService {
const result = combinedDisposable([
widget.onDidFocus(() => this._lastFocusedWidget = widget),
toDisposable(() => this.lists.splice(this.lists.indexOf(registeredList), 1))
toDisposable(() => this.lists.splice(this.lists.indexOf(registeredList), 1)),
widget.onDidDispose(() => {
this.lists = this.lists.filter(l => l !== registeredList);
if (this._lastFocusedWidget === widget) {
this._lastFocusedWidget = undefined;
}
})
]);
return result;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册