mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
_findInLine() function should not run multiple times on the same row
This commit is contained in:
@@ -76,15 +76,7 @@ export class SearchHelper implements ISearchHelper {
|
||||
|
||||
// If the current line is wrapped line, increase index of column to ignore the previous scan
|
||||
// Otherwise, reset beginning column index to zero with set new unwrapped line index
|
||||
if (this._terminal._core.buffer.lines.get(y).isWrapped) {
|
||||
cumulativeCols += this._terminal.cols;
|
||||
} else {
|
||||
cumulativeCols = 0;
|
||||
findingRow = y;
|
||||
}
|
||||
|
||||
// Run _findInLine at unwrapped row, scan for cumulativeCols columns
|
||||
result = this._findInLine(term, findingRow, cumulativeCols, searchOptions);
|
||||
result = this._findInLine(term, y, 0, searchOptions);
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
@@ -94,23 +86,11 @@ export class SearchHelper implements ISearchHelper {
|
||||
// Search from the top to the startRow (search the whole startRow again in
|
||||
// case startCol > 0)
|
||||
if (!result) {
|
||||
// Assume that The first line is always unwrapped line
|
||||
let findingRow = 0;
|
||||
// Scan at beginning of the line
|
||||
let cumulativeCols = 0;
|
||||
for (let y = 0; y <= startRow; y++) {
|
||||
result = this._findInLine(term, findingRow, cumulativeCols, searchOptions);
|
||||
for (let y = 0; y < findingRow; y++) {
|
||||
result = this._findInLine(term, y, 0, searchOptions);
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
// If the current line is wrapped line, increase index of beginning column
|
||||
// So we ignore the previous scan
|
||||
if (this._terminal._core.buffer.lines.get(y).isWrapped) {
|
||||
cumulativeCols += this._terminal.cols;
|
||||
} else {
|
||||
cumulativeCols = 0;
|
||||
findingRow = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user