From 8ce940f33d35c737e1a4f07af0579f9722f65b8a Mon Sep 17 00:00:00 2001 From: Brandon Bloom Date: Fri, 20 Oct 2017 03:18:51 -0700 Subject: [PATCH] Fixes #36544. (#36578) --- src/vs/workbench/services/history/browser/history.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index 6b3a56407ef..96778df112d 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -572,15 +572,16 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic this.stack = this.stack.slice(0, this.index + 1); } - this.setIndex(this.index + 1); - this.stack.splice(this.index, 0, entry); + this.stack.splice(this.index + 1, 0, entry); // Check for limit if (this.stack.length > HistoryService.MAX_STACK_ITEMS) { this.stack.shift(); // remove first and dispose - if (this.index > 0) { - this.setIndex(this.index - 1); + if (this.lastIndex >= 0) { + this.lastIndex--; } + } else { + this.setIndex(this.index + 1); } } -- GitLab