diff --git a/src/vs/editor/common/controller/cursorCollection.ts b/src/vs/editor/common/controller/cursorCollection.ts index 515ca3fbf6d26959d1189408ea1ea1ad43dc6a50..47d6cc402dc772f1cf11354064ffc323e1688764 100644 --- a/src/vs/editor/common/controller/cursorCollection.ts +++ b/src/vs/editor/common/controller/cursorCollection.ts @@ -183,41 +183,39 @@ export class CursorCollection { interface SortedCursor { index: number; selection: Selection; - viewSelection: Selection; } let sortedCursors: SortedCursor[] = []; for (let i = 0, len = cursors.length; i < len; i++) { sortedCursors.push({ index: i, selection: cursors[i].modelState.selection, - viewSelection: cursors[i].viewState.selection }); } sortedCursors.sort((a, b) => { - if (a.viewSelection.startLineNumber === b.viewSelection.startLineNumber) { - return a.viewSelection.startColumn - b.viewSelection.startColumn; + if (a.selection.startLineNumber === b.selection.startLineNumber) { + return a.selection.startColumn - b.selection.startColumn; } - return a.viewSelection.startLineNumber - b.viewSelection.startLineNumber; + return a.selection.startLineNumber - b.selection.startLineNumber; }); for (let sortedCursorIndex = 0; sortedCursorIndex < sortedCursors.length - 1; sortedCursorIndex++) { const current = sortedCursors[sortedCursorIndex]; const next = sortedCursors[sortedCursorIndex + 1]; - const currentViewSelection = current.viewSelection; - const nextViewSelection = next.viewSelection; + const currentSelection = current.selection; + const nextSelection = next.selection; if (!this.context.config.multiCursorMergeOverlapping) { continue; } let shouldMergeCursors: boolean; - if (nextViewSelection.isEmpty() || currentViewSelection.isEmpty()) { + if (nextSelection.isEmpty() || currentSelection.isEmpty()) { // Merge touching cursors if one of them is collapsed - shouldMergeCursors = nextViewSelection.getStartPosition().isBeforeOrEqual(currentViewSelection.getEndPosition()); + shouldMergeCursors = nextSelection.getStartPosition().isBeforeOrEqual(currentSelection.getEndPosition()); } else { // Merge only overlapping cursors (i.e. allow touching ranges) - shouldMergeCursors = nextViewSelection.getStartPosition().isBefore(currentViewSelection.getEndPosition()); + shouldMergeCursors = nextSelection.getStartPosition().isBefore(currentSelection.getEndPosition()); } if (shouldMergeCursors) {