Wrap search back if there exists a result in search

Search must wrap back as it does when there are multiple lines.
This commit is contained in:
rishab
2020-04-25 03:13:19 -07:00
parent cdcbb1d6da
commit 50ba6bfa1b
+9 -1
View File
@@ -110,8 +110,16 @@ export class SearchAddon implements ITerminalAddon {
}
}
// If there is only one result, return true.
if (!result && currentSelection) return true;
// If there is only one result, wrap back and return selection if exists.
if (!result && currentSelection) {
searchPosition.startRow = currentSelection.startRow;
searchPosition.startCol = 0;
result = this._findInLine(term, searchPosition, searchOptions);
if (result) {
return this._selectResult(result);
}
}
// Set selection and scroll if a result was found
return this._selectResult(result);