Skip to content

Commit

Permalink
fix #501 (#632)
Browse files Browse the repository at this point in the history
* fix #501

* fixing whitespace from failed checks
  • Loading branch information
xconverge authored and johnfn committed Aug 20, 2016
1 parent 3a3d09b commit 61312b7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,11 @@ class MoveDown extends BaseMovement {
public async execAction(position: Position, vimState: VimState): Promise<Position> {
return position.getDown(vimState.desiredColumn);
}

public async execActionForOperator(position: Position, vimState: VimState): Promise<Position> {
vimState.currentRegisterMode = RegisterMode.LineWise;
return position.getDown(position.getLineEnd().character);
}
}

@RegisterAction
Expand Down Expand Up @@ -2198,8 +2203,15 @@ class MoveNonBlank extends BaseMovement {
class MoveNextLineNonBlank extends BaseMovement {
keys = ["\n"];

public async execAction(position: Position, vimState: VimState): Promise<Position> {
return position.getDown(0).getFirstLineNonBlankChar();
public async execActionWithCount(position: Position, vimState: VimState, count: number): Promise<Position> {
vimState.currentRegisterMode = RegisterMode.LineWise;

// Count === 0 if just pressing enter in normal mode, need to still go down 1 line
if (count === 0) {
count++;
}

return position.getDownByCount(count).getFirstLineNonBlankChar();
}
}

Expand Down
14 changes: 14 additions & 0 deletions test/mode/modeNormal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,20 @@ suite("Mode Normal", () => {
end: ['abcd|h'],
});

newTest({
title: "Can handle 'd3' then <enter>",
start: ['|1', '2', '3', '4', '5', '6'],
keysPressed: 'd3\n',
end: ['|5', '6'],
});

newTest({
title: "Can handle 'dj'",
start: ['|11', '22', '33', '44', '55', '66'],
keysPressed: 'dj',
end: ['|33', '44', '55', '66'],
});

newTest({
title: "Can handle 'cw'",
start: ['text text tex|t'],
Expand Down

0 comments on commit 61312b7

Please sign in to comment.