Skip to content

Commit

Permalink
Fix append at EOL in visual block mode
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfn committed Aug 9, 2016
1 parent cb0bff7 commit e4fa3b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,7 @@ class InsertInInsertVisualBlockMode extends BaseCommand {
}

for (const { start, end } of Position.IterateLine(vimState)) {
const insertPos = insertAtStart ? start : end;
const insertPos = insertAtStart ? start : end;

if (char === '<backspace>') {
await TextEditor.backspace(insertPos.getLeft());
Expand Down
4 changes: 3 additions & 1 deletion src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,9 @@ export class ModeHandler implements vscode.Disposable {
const movement = action instanceof BaseMovement ? action : undefined;

if ((movement && !movement.doesntChangeDesiredColumn) ||
(recordedState.command && vimState.currentMode !== ModeName.VisualBlock)) {
(recordedState.command &&
vimState.currentMode !== ModeName.VisualBlock &&
vimState.currentMode !== ModeName.VisualBlockInsertMode)) {
// We check !operator here because e.g. d$ should NOT set the desired column to EOL.

if (movement && movement.setsDesiredColumnToEOL && !recordedState.operator) {
Expand Down
2 changes: 1 addition & 1 deletion src/motion/position.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class Position extends vscode.Position {

for (let lineIndex = itrStart; reverse ? lineIndex >= itrEnd : lineIndex <= itrEnd; reverse ? lineIndex-- : lineIndex++) {
const line = TextEditor.getLineAt(new Position(lineIndex, 0)).text;
const endCharacter = runToLineEnd ? line.length : bottomRight.character + 1;
const endCharacter = runToLineEnd ? line.length + 1 : bottomRight.character + 1;

yield {
line : line.substring(topLeft.character, endCharacter),
Expand Down

0 comments on commit e4fa3b5

Please sign in to comment.