Fix bug that prevented moveWordLeft/Right to move behind || or [
This commit is contained in:
parent
537209da57
commit
848e29912c
2 changed files with 37 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue