mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-09-11 12:25:59 +03:00
Make 'gv' work with selection by mouse (and command) (#8965)
Fixes #8913
This commit is contained in:
parent
6ab9def5a6
commit
8fba985b5f
@ -258,6 +258,13 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
|
||||
this.vimState.cursorStopPosition = selection.active;
|
||||
this.vimState.cursorStartPosition = selection.anchor;
|
||||
await this.updateView({ drawSelection: false, revealRange: false });
|
||||
|
||||
// Store selection for commands like gv
|
||||
this.vimState.lastVisualSelection = {
|
||||
mode: this.vimState.currentMode,
|
||||
start: this.vimState.cursorStartPosition,
|
||||
end: this.vimState.cursorStopPosition,
|
||||
};
|
||||
return;
|
||||
} else if (!selection.active.isEqual(selection.anchor)) {
|
||||
Logger.trace('Creating Visual Selection from command!');
|
||||
@ -265,6 +272,13 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
|
||||
this.vimState.cursorStartPosition = selection.anchor;
|
||||
await this.setCurrentMode(Mode.Visual);
|
||||
await this.updateView({ drawSelection: false, revealRange: false });
|
||||
|
||||
// Store selection for commands like gv
|
||||
this.vimState.lastVisualSelection = {
|
||||
mode: Mode.Visual,
|
||||
start: this.vimState.cursorStartPosition,
|
||||
end: this.vimState.cursorStopPosition,
|
||||
};
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -397,6 +411,14 @@ export class ModeHandler implements vscode.Disposable, IModeHandler {
|
||||
await this.setCurrentMode(Mode.Normal);
|
||||
}
|
||||
|
||||
if (isVisualMode(this.vimState.currentMode)) {
|
||||
// Store selection for commands like gv
|
||||
this.vimState.lastVisualSelection = {
|
||||
mode: this.vimState.currentMode,
|
||||
start: this.vimState.cursorStartPosition,
|
||||
end: this.vimState.cursorStopPosition,
|
||||
};
|
||||
}
|
||||
void this.updateView({ drawSelection: toDraw, revealRange: false });
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user