diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js index f828b0df..d8cb4e30 100644 --- a/lib/ace/edit_session.js +++ b/lib/ace/edit_session.js @@ -286,7 +286,7 @@ var EditSession = function(text, mode) { }; this.tokenRe = /^[\w\d]+/g; - this.nonTokenRe = /^(?:[^\w\d|[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF])+/g; + this.nonTokenRe = /^(?:[^\w\d]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF])+/g; this.getWordRange = function(row, column) { var line = this.getLine(row); diff --git a/lib/ace/test/selection_test.js b/lib/ace/test/selection_test.js index 445a0e72..b94a17db 100644 --- a/lib/ace/test/selection_test.js +++ b/lib/ace/test/selection_test.js @@ -287,6 +287,42 @@ var Test = { selection.moveCursorTo(0, 5); assert.notOk(called); + }, + + "test: moveWordLeft should move past || and [": function() { + var session = new EditSession("||foo["); + var selection = session.getSelection(); + + // Move behind || + selection.moveCursorWordRight(); + assert.position(selection.getCursor(), 0, 2); + + // Move beind foo + selection.moveCursorWordRight(); + assert.position(selection.getCursor(), 0, 5); + + // Move behind [ + selection.moveCursorWordRight(); + assert.position(selection.getCursor(), 0, 6); + }, + + "test: moveWordRight should move past || and [": function() { + var session = new EditSession("||foo["); + var selection = session.getSelection(); + + selection.moveCursorTo(0, 6); + + // Move behind [ + selection.moveCursorWordLeft(); + assert.position(selection.getCursor(), 0, 5); + + // Move beind foo + selection.moveCursorWordLeft(); + assert.position(selection.getCursor(), 0, 2); + + // Move behind || + selection.moveCursorWordLeft(); + assert.position(selection.getCursor(), 0, 0); } };