提交 c85ef95d 编写于 作者: B Benjamin Pasero

restore input when added from close event

上级 0d5d1d4b
......@@ -260,21 +260,23 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
// Track closing of pinned editor to support to reopen closed editors
if (event.pinned) {
const editor = event.editor;
const editor = this.restoreInput(event.editor); // closed editors are always disposed so we need to restore
if (editor) {
// Remove all inputs matching and add as last recently closed
this.removeFromRecentlyClosed(editor);
this.recentlyClosed.push(editor);
// Remove all inputs matching and add as last recently closed
this.removeFromRecentlyClosed(editor);
this.recentlyClosed.push(editor);
// Bounding
if (this.recentlyClosed.length > HistoryService.MAX_RECENTLY_CLOSED_EDITORS) {
this.recentlyClosed = this.recentlyClosed.slice(this.recentlyClosed.length - HistoryService.MAX_RECENTLY_CLOSED_EDITORS); // upper bound of recently closed
}
// Bounding
if (this.recentlyClosed.length > HistoryService.MAX_RECENTLY_CLOSED_EDITORS) {
this.recentlyClosed = this.recentlyClosed.slice(this.recentlyClosed.length - HistoryService.MAX_RECENTLY_CLOSED_EDITORS); // upper bound of recently closed
}
// Restore on dispose
editor.addOneTimeDisposableListener(EventType.DISPOSE, () => {
this.restoreInRecentlyClosed(editor);
});
// Restore on dispose
editor.addOneTimeDisposableListener(EventType.DISPOSE, () => {
this.restoreInRecentlyClosed(editor);
});
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册