Fire onSelectionChange when starting to drag

This commit is contained in:
Daniel Imms
2026-01-08 16:51:45 -08:00
parent 8e4de23c11
commit 613aa6ba23
3 changed files with 69 additions and 0 deletions
+8
View File
@@ -532,6 +532,9 @@ export class SelectionService extends Disposable implements ISelectionService {
* @param event The mouse event.
*/
private _handleSingleClick(event: MouseEvent): void {
// Track if there was a selection before clearing
const hadSelection = this.hasSelection;
this._model.selectionStartLength = 0;
this._model.isSelectAllActive = false;
this._activeSelectionMode = this.shouldColumnSelect(event) ? SelectionMode.COLUMN : SelectionMode.NORMAL;
@@ -543,6 +546,11 @@ export class SelectionService extends Disposable implements ISelectionService {
}
this._model.selectionEnd = undefined;
// Fire selection change event if a selection was cleared
if (hadSelection) {
this._fireOnSelectionChange(this._model.finalSelectionStart, this._model.finalSelectionEnd, false);
}
// Ensure the line exists
const line = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);
if (!line) {