提交 56c54ef9 编写于 作者: S Sandeep Somavarapu 提交者: GitHub

Merge pull request #21859 from delftswa2017/21600-clearing-search-results

proposal to fix issue 21600
......@@ -23,6 +23,12 @@ export class HistoryNavigator<T> implements INavigator<T> {
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<T> implements INavigator<T> {
this._history = new ArraySet<T>(data.slice(data.length - this._limit));
}
}
}
\ No newline at end of file
......@@ -170,7 +170,13 @@ export class SearchWidget extends Widget {
}
public showPreviousSearchTerm() {
let previous = this.searchHistory.previous();
let previous;
if (this.searchInput.getValue().length === 0) {
previous = this.searchHistory.current();
} else {
this.searchHistory.addIfNotPresent(this.searchInput.getValue());
previous = this.searchHistory.previous();
}
if (previous) {
this.searchInput.setValue(previous);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册