Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different behavior when search two same words in only one row #2867

Merged
merged 8 commits into from
May 3, 2020
11 changes: 9 additions & 2 deletions addons/xterm-addon-search/src/SearchAddon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,15 @@ 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);
Expand Down