Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee authored and Andrew Cobby committed May 3, 2017
1 parent a6e8901 commit 947032b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5295,6 +5295,10 @@ class SelectWord extends TextObjectMovement {
stop = position.getCurrentWordEnd();
} else {
stop = position.getWordRight();
// If the next word is not at the beginning of the next line, we want to pretend it is.
// This is because 'aw' has two fundamentally different behaviors distinguished by whether
// the next word is directly after the current word, as described in the following comment.
// The only case that's not true is in cases like #1350.
if (stop.isEqual(stop.getFirstLineNonBlankChar())) {
stop = stop.getLineBegin();
}
Expand Down Expand Up @@ -5344,10 +5348,15 @@ class SelectABigWord extends TextObjectMovement {
start = position.getLastBigWordEnd().getRight();
stop = position.getCurrentBigWordEnd();
} else {
start = position.getBigWordLeft();
stop = position.getBigWordRight().getLeft();
let nextWord = position.getBigWordRight();
if (nextWord.isEqual(nextWord.getFirstLineNonBlankChar()) || nextWord.isLineEnd()) {
start = position.getLastWordEnd().getRight();
stop = position.getLineEnd();
} else {
start = position.getBigWordLeft(true);
stop = position.getBigWordRight().getLeft();
}
}

if (vimState.currentMode === ModeName.Visual && !vimState.cursorPosition.isEqual(vimState.cursorStartPosition)) {
start = vimState.cursorStartPosition;

Expand Down

0 comments on commit 947032b

Please sign in to comment.