Skip to content

Commit

Permalink
fixes #879
Browse files Browse the repository at this point in the history
  • Loading branch information
xconverge authored and rebornix committed Oct 19, 2016
1 parent b0f8376 commit 9289271
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,20 @@ export class CommandInsertInInsertMode extends BaseCommand {
const char = this.keysPressed[this.keysPressed.length - 1];

if (char === "<BS>") {
vimState.recordedState.transformations.push({
type : "deleteText",
position : position,
});
const selection = TextEditor.getSelection();

// Check if a selection is active
if (!selection.isEmpty) {
vimState.recordedState.transformations.push({
type: "deleteRange",
range: new Range(selection.start as Position, selection.end as Position),
});
} else {
vimState.recordedState.transformations.push({
type: "deleteText",
position: position,
});
}

vimState.cursorPosition = vimState.cursorPosition.getLeft();
vimState.cursorStartPosition = vimState.cursorStartPosition.getLeft();
Expand Down

0 comments on commit 9289271

Please sign in to comment.