_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
|
// 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
|
// Otherwise, reset beginning column index to zero with set new unwrapped line index
|
||||||
if (this._terminal._core.buffer.lines.get(y).isWrapped) {
|
result = this._findInLine(term, y, 0, searchOptions);
|
||||||
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);
|
|
||||||
if (result) {
|
if (result) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -94,23 +86,11 @@ export class SearchHelper implements ISearchHelper {
|
|||||||
// Search from the top to the startRow (search the whole startRow again in
|
// Search from the top to the startRow (search the whole startRow again in
|
||||||
// case startCol > 0)
|
// case startCol > 0)
|
||||||
if (!result) {
|
if (!result) {
|
||||||
// Assume that The first line is always unwrapped line
|
for (let y = 0; y < findingRow; y++) {
|
||||||
let findingRow = 0;
|
result = this._findInLine(term, y, 0, searchOptions);
|
||||||
// Scan at beginning of the line
|
|
||||||
let cumulativeCols = 0;
|
|
||||||
for (let y = 0; y <= startRow; y++) {
|
|
||||||
result = this._findInLine(term, findingRow, cumulativeCols, searchOptions);
|
|
||||||
if (result) {
|
if (result) {
|
||||||
break;
|
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