diff --git a/src/vs/base/common/history.ts b/src/vs/base/common/history.ts index 466bda628f4b0f75750a0d7de89d79e478cabe0c..6eba18a69c09c13a0d2b3d4b07f6c80b0e36f65e 100644 --- a/src/vs/base/common/history.ts +++ b/src/vs/base/common/history.ts @@ -23,6 +23,12 @@ export class HistoryNavigator implements INavigator { this._onChange(); } + public addIfNotPresent(t: T) { + if(!this._history.contains(t)) { + this.add(t); + } + } + public next(): T { if (this._navigator.next()) { return this._navigator.current(); @@ -67,4 +73,5 @@ export class HistoryNavigator implements INavigator { this._history = new ArraySet(data.slice(data.length - this._limit)); } } + } \ No newline at end of file diff --git a/src/vs/workbench/parts/search/browser/searchWidget.ts b/src/vs/workbench/parts/search/browser/searchWidget.ts index 6fe164daf55eefa7b68676b135c87c1f49719e63..4d8e55f39bac3e2629eb6ae7285a6e6e99405b3a 100644 --- a/src/vs/workbench/parts/search/browser/searchWidget.ts +++ b/src/vs/workbench/parts/search/browser/searchWidget.ts @@ -174,6 +174,7 @@ export class SearchWidget extends Widget { if (this.searchInput.getValue().length === 0) { previous = this.searchHistory.current(); } else { + this.searchHistory.addIfNotPresent(this.searchInput.getValue()); previous = this.searchHistory.previous(); } if (previous) {