Implement <count>yy

This commit is contained in:
rebornix 2016-06-24 16:36:00 +08:00
parent a8f5457235
commit 433ba199a5
2 changed files with 16 additions and 2 deletions

View File

@ -1714,10 +1714,10 @@ class MoveYY extends BaseMovement {
modes = [ModeName.Normal];
keys = ["y"];
public async execAction(position: Position, vimState: VimState): Promise<IMovement> {
public async execActionWithCount(position: Position, vimState: VimState, count: number): Promise<IMovement> {
return {
start : position.getLineBegin(),
stop : position.getLineEndIncludingEOL(),
stop : position.getDownByCount(Math.max(0, count - 1)).getLineEnd(),
registerMode: RegisterMode.LineWise,
};
}

View File

@ -238,6 +238,20 @@ suite("Mode Normal", () => {
end: ['one', 'two', '|two']
});
newTest({
title: "Can handle 'P' after 'Nyy'",
start: ['on|e', 'two', 'three'],
keysPressed: '3yyP',
end: ['|one', 'two', 'three', 'one', 'two', 'three']
});
newTest({
title: "Can handle 'p' after 'Nyy'",
start: ['on|e', 'two', 'three'],
keysPressed: '3yyp',
end: ['one', '|one', 'two', 'three', 'two', 'three']
});
newTest({
title: "Can repeat w",
start: ['|one two three four'],