Merge 4d0f0f405e
into 7dfcd74e63
This commit is contained in:
commit
a55f49182a
|
@ -533,7 +533,8 @@ export class Searcher {
|
|||
|
||||
let m: RegExpExecArray | null;
|
||||
do {
|
||||
if (this._prevMatchStartIndex + this._prevMatchLength === textLength) {
|
||||
const previousMatchEnd = this._prevMatchStartIndex + this._prevMatchLength;
|
||||
if (previousMatchEnd === textLength) {
|
||||
// Reached the end of the line
|
||||
return null;
|
||||
}
|
||||
|
@ -562,6 +563,11 @@ export class Searcher {
|
|||
this._prevMatchStartIndex = matchStartIndex;
|
||||
this._prevMatchLength = matchLength;
|
||||
|
||||
// do not return empty matches at he end of previous match
|
||||
if (matchLength === 0 && matchStartIndex === previousMatchEnd) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this._wordSeparators || isValidMatch(this._wordSeparators, text, textLength, matchStartIndex, matchLength)) {
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -757,11 +757,8 @@ suite('TextModelSearch', () => {
|
|||
let actual = TextModelSearch.findMatches(model, searchParams, model.getFullModelRange(), true, 100);
|
||||
assert.deepStrictEqual(actual, [
|
||||
new FindMatch(new Range(1, 1, 1, 3), ['10']),
|
||||
new FindMatch(new Range(1, 3, 1, 3), ['']),
|
||||
new FindMatch(new Range(1, 4, 1, 7), ['243']),
|
||||
new FindMatch(new Range(1, 7, 1, 7), ['']),
|
||||
new FindMatch(new Range(1, 8, 1, 10), ['30']),
|
||||
new FindMatch(new Range(1, 10, 1, 10), ['']),
|
||||
new FindMatch(new Range(1, 11, 1, 13), ['10'])
|
||||
]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue