Skip to content

Commit 9dbe45d

Browse files
committed
update docs and better naming for cursor/selection
1 parent 3147490 commit 9dbe45d

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

src/vs/editor/common/editorCommon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3939,7 +3939,7 @@ export interface ICommonCodeEditor extends IEditor {
39393939
pushUndoStop(): boolean;
39403940

39413941
/**
3942-
* Execute a command on the editor.
3942+
* Execute edits on the editor.
39433943
* @param source The source of the call.
39443944
* @param edits The edits to execute.
39453945
* @param endCursoState Cursor state after the edits were applied.

src/vs/editor/contrib/linesOperations/common/linesOperations.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -518,16 +518,16 @@ export class JoinLinesAction extends EditorAction {
518518

519519
public run(accessor: ServicesAccessor, editor: ICommonCodeEditor): void {
520520
let selections = editor.getSelections();
521-
let primarySelection = editor.getSelection();
521+
let primaryCursor = editor.getSelection();
522522

523523
selections.sort(Range.compareRangesUsingStarts);
524524
let reducedSelections: Selection[] = [];
525525

526526
let lastSelection = selections.reduce((previousValue, currentValue) => {
527527
if (previousValue.isEmpty()) {
528528
if (previousValue.endLineNumber === currentValue.startLineNumber) {
529-
if (primarySelection.equalsSelection(previousValue)) {
530-
primarySelection = currentValue;
529+
if (primaryCursor.equalsSelection(previousValue)) {
530+
primaryCursor = currentValue;
531531
}
532532
return currentValue;
533533
}
@@ -553,7 +553,7 @@ export class JoinLinesAction extends EditorAction {
553553
let model = editor.getModel();
554554
let edits = [];
555555
let endCursorState = [];
556-
let resultPrimarySelection = primarySelection;
556+
let endPrimaryCursor = primaryCursor;
557557
let lineOffset = 0;
558558

559559
for (let i = 0, len = reducedSelections.length; i < len; i++) {
@@ -632,8 +632,8 @@ export class JoinLinesAction extends EditorAction {
632632
}
633633
}
634634

635-
if (Range.intersectRanges(deleteSelection, primarySelection) !== null) {
636-
resultPrimarySelection = resultSelection;
635+
if (Range.intersectRanges(deleteSelection, primaryCursor) !== null) {
636+
endPrimaryCursor = resultSelection;
637637
} else {
638638
endCursorState.push(resultSelection);
639639
}
@@ -642,7 +642,7 @@ export class JoinLinesAction extends EditorAction {
642642
lineOffset += deleteSelection.endLineNumber - deleteSelection.startLineNumber;
643643
}
644644

645-
endCursorState.unshift(resultPrimarySelection);
645+
endCursorState.unshift(endPrimaryCursor);
646646
editor.executeEdits(this.id, edits, endCursorState);
647647

648648
}

src/vs/monaco.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,11 +3163,12 @@ declare module monaco.editor {
31633163
*/
31643164
pushUndoStop(): boolean;
31653165
/**
3166-
* Execute a command on the editor.
3166+
* Execute edits on the editor.
31673167
* @param source The source of the call.
3168-
* @param command The command to execute
3168+
* @param edits The edits to execute.
3169+
* @param endCursoState Cursor state after the edits were applied.
31693170
*/
3170-
executeEdits(source: string, edits: IIdentifiedSingleEditOperation[]): boolean;
3171+
executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursoState?: Selection[]): boolean;
31713172
/**
31723173
* Execute multiple (concommitent) commands on the editor.
31733174
* @param source The source of the call.

0 commit comments

Comments
 (0)