提交 f5f4ad9d 编写于 作者: A Alex Dima

Fixes #64810

上级 376c7496
......@@ -252,8 +252,10 @@ export class WordOperations {
let lineNumber = position.lineNumber;
let column = position.column;
let movedDown = false;
if (column === model.getLineMaxColumn(lineNumber)) {
if (lineNumber < model.getLineCount()) {
movedDown = true;
lineNumber = lineNumber + 1;
column = 1;
}
......@@ -274,7 +276,7 @@ export class WordOperations {
column = model.getLineMaxColumn(lineNumber);
}
} else {
if (nextWordOnLine && column >= nextWordOnLine.start + 1) {
if (nextWordOnLine && !movedDown && column >= nextWordOnLine.start + 1) {
nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1));
}
if (nextWordOnLine) {
......
......@@ -295,6 +295,21 @@ suite('WordOperations', () => {
assert.deepEqual(actual, EXPECTED);
});
test('issue #64810: cursorWordStartRight skips first word after newline', () => {
// This is the behaviour observed in Visual Studio, please do not touch test
const EXPECTED = ['Hello |World|', '|Hei |mailman|'].join('\n');
const [text,] = deserializePipePositions(EXPECTED);
const actualStops = testRepeatedActionAndExtractPositions(
text,
new Position(1, 1),
ed => moveWordStartRight(ed),
ed => ed.getPosition(),
ed => ed.getPosition().equals(new Position(2, 12))
);
const actual = serializePipePositions(text, actualStops);
assert.deepEqual(actual, EXPECTED);
});
test('deleteWordLeft for non-empty selection', () => {
withTestCodeEditor([
' \tMy First Line\t ',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册