提交 678700ea 编写于 作者: A Alex Dima

Adopt new editor.wordSeparators for moveWordRight

上级 d3bad4ff
......@@ -636,10 +636,10 @@ export class OneCursorOp {
}
}
var word = cursor.findWord(new Position(lineNumber, column), 'right', true);
let nextWordOnLine = cursor.findNextWordOnLine(new Position(lineNumber, column));
if (word) {
column = word.end + 1;
if (nextWordOnLine) {
column = nextWordOnLine.end + 1;
} else {
column = cursor.model.getLineMaxColumn(lineNumber);
}
......
......@@ -1165,6 +1165,36 @@ suite('Editor Controller - Regression tests', () => {
moveWordLeft(cursor); assert.equal(cursor.getPosition().column, ' '.length + 1, '015');
});
});
test('issue #832: moveWordLeft', () => {
usingCursor({
text: [
' /* Just some more text a+= 3 +5-3 + 7 */ '
],
mode: null,
config: null
}, (model, cursor) => {
moveTo(cursor, 1, 1, false);
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /*'.length + 1, '001');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just'.length + 1, '003');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some'.length + 1, '004');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more'.length + 1, '005');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text'.length + 1, '006');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a'.length + 1, '007');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+='.length + 1, '008');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3'.length + 1, '009');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3 +'.length + 1, '010');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3 +5'.length + 1, '011');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3 +5-'.length + 1, '012');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3 +5-3'.length + 1, '013');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3 +5-3 +'.length + 1, '014');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3 +5-3 + 7'.length + 1, '015');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3 +5-3 + 7 */'.length + 1, '016');
moveWordRight(cursor); assert.equal(cursor.getPosition().column, ' /* Just some more text a+= 3 +5-3 + 7 */ '.length + 1, '016');
});
});
});
suite('Editor Controller - Cursor Configuration', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册