Skip to content

Commit

Permalink
consumers of wordDef should reset lastIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jan 7, 2017
1 parent 443d914 commit 4f88ca7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/vs/editor/common/services/editorSimpleWorker.ts
Expand Up @@ -148,8 +148,11 @@ class MirrorModel extends MirrorModel2 implements ICommonModel {

// TODO@Joh, TODO@Alex - remove these and make sure the super-things work
private _wordenize(content: string, wordDefinition: RegExp): editorCommon.IWordRange[] {
var result: editorCommon.IWordRange[] = [];
var match: RegExpExecArray;
const result: editorCommon.IWordRange[] = [];
let match: RegExpExecArray;

wordDefinition.lastIndex = 0; // reset lastIndex just to be sure

while (match = wordDefinition.exec(content)) {
if (match[0].length === 0) {
// it did match the empty string
Expand Down

0 comments on commit 4f88ca7

Please sign in to comment.