Clean up, improve comments

Co-authored-by: Megan Rogge <merogge@microsoft.com>
This commit is contained in:
Daniel Imms
2021-01-11 09:19:53 -08:00
co-authored by Megan Rogge
parent d3d8ec3b20
commit 519e44d30e
+6 -3
View File
@@ -158,9 +158,11 @@ export class SearchAddon implements ITerminalAddon {
}; };
if (incremental) { if (incremental) {
result = this._findInLine(term, searchPosition, searchOptions, false); // Try to expand selection to right first. // Try to expand selection to right first.
if (!(result && result.row === startRow && result.col === startCol)) { result = this._findInLine(term, searchPosition, searchOptions, false);
// If selection was not able to be expanded to right, then reverse search begin. const isOldResultHighlighted = result && result.row === startRow && result.col === startCol;
if (!isOldResultHighlighted) {
// If selection was not able to be expanded to the right, then try reverse search
if (currentSelection) { if (currentSelection) {
searchPosition.startRow = currentSelection.endRow; searchPosition.startRow = currentSelection.endRow;
searchPosition.startCol = currentSelection.endColumn; searchPosition.startCol = currentSelection.endColumn;
@@ -250,6 +252,7 @@ export class SearchAddon implements ITerminalAddon {
* @param term The search term. * @param term The search term.
* @param position The position to start the search. * @param position The position to start the search.
* @param searchOptions Search options. * @param searchOptions Search options.
* @param isReverseSearch Whether the search should start from the right side of the terminal and search to the left.
* @return The search result if it was found. * @return The search result if it was found.
*/ */
protected _findInLine(term: string, searchPosition: ISearchPosition, searchOptions: ISearchOptions = {}, isReverseSearch: boolean = false): ISearchResult | undefined { protected _findInLine(term: string, searchPosition: ISearchPosition, searchOptions: ISearchOptions = {}, isReverseSearch: boolean = false): ISearchResult | undefined {