From c85ef95dfa0e1cabdc1719aca2a4ad2857f8d80a Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 14 Jun 2016 12:06:35 +0200 Subject: [PATCH] restore input when added from close event --- .../services/history/browser/history.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index a9f9feaddf5..531b5f8b05c 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -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); + }); + } } } -- GitLab