Skip to content

Commit a3083e5

Browse files
committed
fix getWordAtText for webkit-based browsers
1 parent 39ebbba commit a3083e5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/vs/editor/common/model/wordHelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ export function getWordAtText(column: number, wordDefinition: RegExp, text: stri
8686
for (let i = 1; ; i++) {
8787
// check time budget
8888
if (Date.now() - t1 >= config.timeBudget) {
89-
break;
89+
// break;
9090
}
9191

9292
// reset the index at which the regexp should start matching, also know where it
9393
// should stop so that subsequent search don't repeat previous searches
9494
const regexIndex = pos - config.windowSize * i;
95-
wordDefinition.lastIndex = regexIndex;
95+
wordDefinition.lastIndex = Math.max(0, regexIndex);
9696
match = _findRegexMatchEnclosingPosition(wordDefinition, text, pos, prevRegexIndex);
9797

9898
// stop: found something

0 commit comments

Comments
 (0)