diff --git a/src/motion/position.ts b/src/motion/position.ts index f5942215f6f..4ffb1424801 100644 --- a/src/motion/position.ts +++ b/src/motion/position.ts @@ -264,6 +264,7 @@ export class Position extends vscode.Position { } } + // Iterates through words on the same line, starting from the current position. public static *IterateWords(start: Position): Iterable<{ start: Position, end: Position, word: string }> { const text = TextEditor.getLineAt(start).text; let wordEnd = start.getCurrentWordEnd(true); @@ -275,11 +276,11 @@ export class Position extends vscode.Position { word: word, }; - if (wordEnd.isLineEnd()) { + if (wordEnd.getRight().isLineEnd()) { return; } start = start.getWordRight(); - wordEnd = start.getCurrentWordEnd(); + wordEnd = start.getCurrentWordEnd(true); } while (true); } diff --git a/test/mode/modeNormal.test.ts b/test/mode/modeNormal.test.ts index 45508d2b49e..0199895571f 100644 --- a/test/mode/modeNormal.test.ts +++ b/test/mode/modeNormal.test.ts @@ -1378,6 +1378,13 @@ suite("Mode Normal", () => { end: ["test|1abc"] }); + newTest({ + title: "can ctrl-a properly on multiple lines", + start: ["id: 1|,", "someOtherId: 1"], + keysPressed: "", + end: ["id: 1|,", "someOtherId: 1"] + }); + newTest({ title: "can do Y", start: ["|blah blah"],