Skip to content

Commit

Permalink
fixes #784 (#814)
Browse files Browse the repository at this point in the history
* fixes #784

* Cleaned up implementation of fix slightly
  • Loading branch information
xconverge authored and johnfn committed Oct 5, 2016
1 parent 7206aca commit b193c22
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2619,10 +2619,16 @@ abstract class MoveByScreenLine extends BaseMovement {
* cursorMove command is handling the selection for us.
* So we are not following our design principal (do no real movement inside an action) here.
*/
return {
start: Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.start),
stop: Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.end)
};

let start = Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.start);
let stop = Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.end);

// We want to swap the cursor start stop positions based on which direction we are moving, up or down
if (start.line < position.line) {
[start, stop] = [stop, start];
}

return { start, stop };
}
}

Expand Down
7 changes: 7 additions & 0 deletions test/mode/modeVisual.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ suite("Mode Visual", () => {
assertEqualLines(["wo three"]);
});

newTest({
title: "Can handle H key",
start: ['1', '2', '|3', '4', '5'],
keysPressed: 'vH',
end: ['|1', '2', '3', '4', '5']
});

test("handles case where we delete over a newline", async () => {
await modeHandler.handleMultipleKeyEvents("ione two\n\nthree four".split(""));
await modeHandler.handleMultipleKeyEvents([
Expand Down

0 comments on commit b193c22

Please sign in to comment.