Skip to content

Commit

Permalink
Make clicking update position.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfn committed Jun 9, 2016
1 parent 854bc44 commit 0a292b5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,25 @@ export class ModeHandler implements vscode.Disposable {
this._vimState.currentMode = ModeName.Normal;

this.setCurrentModeByName(this._vimState);

// handle scenarios where mouse used to change current position
vscode.window.onDidChangeTextEditorSelection(e => {
let selection = e.selections[0];

if (selection) {
let line = selection.active.line;
let char = selection.active.character;

var newPosition = new Position(line, char);

if (char > newPosition.getLineEnd().character) {
newPosition = new Position(newPosition.line, newPosition.getLineEnd().character);
}

this._vimState.cursorPosition = newPosition;
this._vimState.desiredColumn = newPosition.character;
}
});
}

/**
Expand Down

0 comments on commit 0a292b5

Please sign in to comment.