Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #922 #960

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2153,9 +2153,16 @@ export class PutCommandVisual extends BaseCommand {
canBePrefixedWithDot = true;

public async exec(position: Position, vimState: VimState, after: boolean = false): Promise<VimState> {
const result = await new DeleteOperator().run(vimState, vimState.cursorStartPosition, vimState.cursorPosition, false);
let start = vimState.cursorStartPosition;
let end = vimState.cursorPosition;

return await new PutCommand().exec(vimState.cursorStartPosition, result, true);
if (start.isAfter(end)) {
[start, end] = [end, start];
}

const result = await new DeleteOperator().run(vimState, start, end, false);

return await new PutCommand().exec(start, result, true);
}

// TODO - execWithCount
Expand Down
7 changes: 7 additions & 0 deletions test/mode/modeNormal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,13 @@ suite("Mode Normal", () => {
end: ["abc abc |dhi"]
});

newTest({
title: "can handle p with selection",
start: ["one", "two", "|three"],
keysPressed: "yykVkp",
end: ["|three", "three"]
});

newTest({
title: "can handle P with selection",
start: ["|abc def ghi"],
Expand Down