Remove incremental?

This commit is contained in:
Jean Pierre
2023-05-07 15:19:23 -05:00
parent 508589aa80
commit 1c19f1d282
+19 -19
View File
@@ -232,12 +232,12 @@ export class SearchAddon extends Disposable implements ITerminalAddon {
let startRow = 0; let startRow = 0;
let currentSelection: IBufferRange | undefined; let currentSelection: IBufferRange | undefined;
if (this._terminal.hasSelection()) { if (this._terminal.hasSelection()) {
const incremental = searchOptions ? searchOptions.incremental : false; // const incremental = searchOptions ? searchOptions.incremental : false;
// Start from the selection end if there is a selection // Start from the selection end if there is a selection
// For incremental search, use existing row // For incremental search, use existing row
currentSelection = this._terminal.getSelectionPosition()!; currentSelection = this._terminal.getSelectionPosition()!;
startRow = incremental ? currentSelection.start.y : currentSelection.end.y; startRow = currentSelection.end.y;
startCol = incremental ? currentSelection.start.x : currentSelection.end.x; startCol = currentSelection.end.x;
} }
this._initLinesCache(); this._initLinesCache();
@@ -347,7 +347,6 @@ export class SearchAddon extends Disposable implements ITerminalAddon {
let startCol = this._terminal.cols; let startCol = this._terminal.cols;
const isReverseSearch = true; const isReverseSearch = true;
const incremental = searchOptions ? searchOptions.incremental : false;
let currentSelection: IBufferRange | undefined; let currentSelection: IBufferRange | undefined;
if (this._terminal.hasSelection()) { if (this._terminal.hasSelection()) {
currentSelection = this._terminal.getSelectionPosition()!; currentSelection = this._terminal.getSelectionPosition()!;
@@ -362,21 +361,22 @@ export class SearchAddon extends Disposable implements ITerminalAddon {
startCol startCol
}; };
if (incremental) { // const incremental = searchOptions ? searchOptions.incremental : false;
// Try to expand selection to right first. // if (incremental) {
result = this._findInLine(term, searchPosition, searchOptions, false); // // Try to expand selection to right first.
const isOldResultHighlighted = result && result.row === startRow && result.col === startCol; // result = this._findInLine(term, searchPosition, searchOptions, false);
if (!isOldResultHighlighted) { // const isOldResultHighlighted = result && result.row === startRow && result.col === startCol;
// If selection was not able to be expanded to the right, then try reverse search // if (!isOldResultHighlighted) {
if (currentSelection) { // // If selection was not able to be expanded to the right, then try reverse search
searchPosition.startRow = currentSelection.end.y; // if (currentSelection) {
searchPosition.startCol = currentSelection.end.x; // searchPosition.startRow = currentSelection.end.y;
} // searchPosition.startCol = currentSelection.end.x;
result = this._findInLine(term, searchPosition, searchOptions, true); // }
} // result = this._findInLine(term, searchPosition, searchOptions, true);
} else { // }
result = this._findInLine(term, searchPosition, searchOptions, isReverseSearch); // } else {
} result = this._findInLine(term, searchPosition, searchOptions, isReverseSearch);
// }
// Search from startRow - 1 to top // Search from startRow - 1 to top
if (!result) { if (!result) {