From 81b0f45f1339fe04a1e0175cf639f41e81e21eec Mon Sep 17 00:00:00 2001 From: CVVPK Date: Thu, 20 Feb 2020 13:23:21 -0500 Subject: [PATCH 1/2] Sync all cursors --- src/mode/modeHandler.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mode/modeHandler.ts b/src/mode/modeHandler.ts index def3699ad56..5463f10c837 100644 --- a/src/mode/modeHandler.ts +++ b/src/mode/modeHandler.ts @@ -79,6 +79,14 @@ export class ModeHandler implements vscode.Disposable { public syncCursors() { setImmediate(() => { if (this.vimState.editor) { + let cursors: Range[] = []; + for (const { start, end } of this.vimState.editor.selections) { + cursors.push( + new Range(Position.FromVSCodePosition(start), Position.FromVSCodePosition(end)) + ); + } + this.vimState.cursors = cursors; + this.vimState.cursorStartPosition = Position.FromVSCodePosition( this.vimState.editor.selection.start ); From a4664ae1e527e7abd0fd530e59b6ca3a58493b88 Mon Sep 17 00:00:00 2001 From: CVVPK Date: Tue, 25 Feb 2020 12:23:15 -0500 Subject: [PATCH 2/2] Map over editor selections to update cursors --- src/mode/modeHandler.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mode/modeHandler.ts b/src/mode/modeHandler.ts index 5463f10c837..7d130ca5253 100644 --- a/src/mode/modeHandler.ts +++ b/src/mode/modeHandler.ts @@ -79,13 +79,10 @@ export class ModeHandler implements vscode.Disposable { public syncCursors() { setImmediate(() => { if (this.vimState.editor) { - let cursors: Range[] = []; - for (const { start, end } of this.vimState.editor.selections) { - cursors.push( + this.vimState.cursors = this.vimState.editor.selections.map( + ({ start, end }) => new Range(Position.FromVSCodePosition(start), Position.FromVSCodePosition(end)) - ); - } - this.vimState.cursors = cursors; + ); this.vimState.cursorStartPosition = Position.FromVSCodePosition( this.vimState.editor.selection.start