Skip to content

Commit

Permalink
fix #639 visual block mode minor issues (#640)
Browse files Browse the repository at this point in the history
* fix #639 visual block mode minor issues

* some additional visual block fixes
  • Loading branch information
xconverge authored and johnfn committed Aug 23, 2016
1 parent c33e515 commit a1cc72b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1616,11 +1616,16 @@ class CommandVisualMode extends BaseCommand {

@RegisterAction
class CommandVisualBlockMode extends BaseCommand {
modes = [ModeName.Normal];
modes = [ModeName.Normal, ModeName.Visual, ModeName.VisualBlock];
keys = ["ctrl+v"];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.currentMode = ModeName.VisualBlock;

if (vimState.currentMode === ModeName.VisualBlock) {
vimState.currentMode = ModeName.Normal;
} else {
vimState.currentMode = ModeName.VisualBlock;
}

return vimState;
}
Expand Down Expand Up @@ -2634,10 +2639,10 @@ class ActionXVisualBlock extends BaseCommand {

// Iterate in reverse so we don't lose track of indicies
for (const { start, end } of Position.IterateLine(vimState, { reverse: true })) {
vimState = await new DeleteOperator().run(vimState, start, end);
vimState = await new DeleteOperator().run(vimState, start, new Position(end.line, end.character - 1));
}

vimState.cursorPosition = position;
vimState.cursorPosition = vimState.cursorStartPosition;
return vimState;
}
}
Expand Down

0 comments on commit a1cc72b

Please sign in to comment.