Skip to content

Commit

Permalink
Don't change editor selection if invoked for line containing selection (
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceerhl authored Mar 22, 2023
1 parent 324d1a2 commit 06fb8fd
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ export class EditorLineNumberContextMenu extends Disposable implements IEditorCo
// set the selection to the clicked line number
if (e.target.type === MouseTargetType.GUTTER_LINE_NUMBERS) {
const currentSelections = this.editor.getSelections();
const containsSelection = currentSelections?.some(selection => selection.containsPosition({ lineNumber, column: 1 }));
const lineRange = {
startLineNumber: lineNumber,
endLineNumber: lineNumber,
startColumn: 1,
endColumn: model.getLineLength(lineNumber) + 1
};
const containsSelection = currentSelections?.some(selection => !selection.isEmpty() && selection.intersectRanges(lineRange) !== null);
if (!containsSelection) {
const selection = {
startLineNumber: lineNumber,
endLineNumber: lineNumber,
startColumn: 1,
endColumn: model.getLineLength(lineNumber) + 1
};
this.editor.setSelection(selection, TextEditorSelectionSource.PROGRAMMATIC);
this.editor.setSelection(lineRange, TextEditorSelectionSource.PROGRAMMATIC);
}
}

Expand Down

0 comments on commit 06fb8fd

Please sign in to comment.