append to results

This commit is contained in:
meganrogge
2022-03-18 13:29:59 -04:00
parent a1468d0f58
commit 6c4f8b42dd
2 changed files with 3 additions and 8 deletions
+3 -6
View File
@@ -91,25 +91,22 @@ export class SearchAddon implements ITerminalAddon {
this.clear(); this.clear();
return false; return false;
} }
searchOptions = searchOptions || {};
if (term === this._cachedSearchTerm) { if (term === this._cachedSearchTerm) {
if (!this._dataChanged) { if (!this._dataChanged) {
return this.findNext(term, searchOptions); return this.findNext(term, searchOptions);
} }
// set start row to avoid redoing work // set start row and col to avoid redoing work
searchOptions = searchOptions || {};
const key = Array.from(this._searchResults.keys()).pop()?.split('-'); const key = Array.from(this._searchResults.keys()).pop()?.split('-');
if (key?.length === 2) { if (key?.length === 2) {
searchOptions.startRow = Number.parseInt(key[0]) + 1; searchOptions.startRow = Number.parseInt(key[0]) + 1;
searchOptions.startCol = Number.parseInt(key[1]); searchOptions.startCol = Number.parseInt(key[1]);
console.log(searchOptions.startRow, searchOptions.startCol);
} }
} else { } else {
// new search, clear out the old decorations // new search, clear out the old decorations
this._resultDecorations.forEach(decorations => decorations.forEach(d=> d.dispose())); this._resultDecorations.forEach(decorations => decorations.forEach(d=> d.dispose()));
this._resultDecorations.clear(); this._resultDecorations.clear();
this._searchResults.clear(); this._searchResults.clear();
searchOptions = searchOptions || {};
} }
searchOptions.incremental = false; searchOptions.incremental = false;
@@ -166,7 +163,7 @@ export class SearchAddon implements ITerminalAddon {
currentSelection = this._terminal.getSelectionPosition()!; currentSelection = this._terminal.getSelectionPosition()!;
startRow = incremental ? currentSelection.startRow : currentSelection.endRow; startRow = incremental ? currentSelection.startRow : currentSelection.endRow;
startCol = incremental ? currentSelection.startColumn : currentSelection.endColumn; startCol = incremental ? currentSelection.startColumn : currentSelection.endColumn;
} else { } else if (!startRow) {
startRow = this._terminal.buffer.active.cursorY; startRow = this._terminal.buffer.active.cursorY;
startCol = this._terminal.buffer.active.cursorX; startCol = this._terminal.buffer.active.cursorX;
} }
-2
View File
@@ -7,8 +7,6 @@
* to be stable and consumed by external programs. * to be stable and consumed by external programs.
*/ */
import { IModelDecorationOverviewRulerOptions } from 'vs/editor/common/model';
/// <reference lib="dom"/> /// <reference lib="dom"/>
declare module 'xterm' { declare module 'xterm' {