(searchState: SearchState)
| 363 | } |
| 364 | |
| 365 | public static async addSearchStateToHistory(searchState: SearchState) { |
| 366 | const prevSearchString = SearchCommandLine.previousSearchStates.at(-1)?.searchString; |
| 367 | // Store this search if different than previous |
| 368 | if (searchState.searchString !== prevSearchString) { |
| 369 | SearchCommandLine.previousSearchStates.push(searchState); |
| 370 | if (SearchCommandLine.history !== undefined) { |
| 371 | await SearchCommandLine.history.add(searchState.searchString); |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | // Make sure search history does not exceed configuration option |
| 376 | if (SearchCommandLine.previousSearchStates.length > configuration.history) { |
| 377 | SearchCommandLine.previousSearchStates.splice(0, 1); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | * Keeps the state of the current match, i.e. the match to which the cursor moves when the search is executed. |
no test coverage detected