fire onSelectionChange on right click select

fixes #3216.
This commit is contained in:
Martin Sander
2021-01-16 10:14:11 +01:00
parent 8a4772ca39
commit c6f93701f5
3 changed files with 12 additions and 6 deletions
+9 -2
View File
@@ -293,7 +293,7 @@ export class SelectionService extends Disposable implements ISelectionService {
* Checks if the current click was inside the current selection
* @param event The mouse event
*/
public isClickInSelection(event: MouseEvent): boolean {
private _isClickInSelection(event: MouseEvent): boolean {
const coords = this._getMouseBufferCoords(event);
const start = this._model.finalSelectionStart;
const end = this._model.finalSelectionEnd;
@@ -316,7 +316,7 @@ export class SelectionService extends Disposable implements ISelectionService {
* Selects word at the current mouse event coordinates.
* @param event The mouse event.
*/
public selectWordAtCursor(event: MouseEvent): void {
private _selectWordAtCursor(event: MouseEvent): void {
const coords = this._getMouseBufferCoords(event);
if (coords) {
this._selectWordAt(coords, false);
@@ -759,6 +759,13 @@ export class SelectionService extends Disposable implements ISelectionService {
this.refresh();
}
public rightClickSelect(ev: MouseEvent): void {
if (!this._isClickInSelection(ev)) {
this._selectWordAtCursor(ev);
this._fireIfSelectionChanged();
}
}
/**
* Gets positional information for the word at the coordinated specified.
* @param coords The coordinates to get the word at.