Skip to content

Commit

Permalink
Fix #53142. Reset if editor blurs.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Sep 7, 2018
1 parent 3447140 commit e82498a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/vs/editor/contrib/dnd/dnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,20 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
this._toUnhook.push(this._editor.onMouseDrop((e: IEditorMouseEvent) => this._onEditorMouseDrop(e)));
this._toUnhook.push(this._editor.onKeyDown((e: IKeyboardEvent) => this.onEditorKeyDown(e)));
this._toUnhook.push(this._editor.onKeyUp((e: IKeyboardEvent) => this.onEditorKeyUp(e)));
this._toUnhook.push(this._editor.onDidBlurEditorWidget(() => this.onEditorBlur()));

This comment has been minimized.

Copy link
@alexdima

alexdima Sep 10, 2018

Member

@rebornix Rather than tracking key down and key up (which is problematic), could we not look at the modifier key on the mouse event in _onEditorMouseDrop? (each mouse event gives the current state of the modifiers in e.ctrlKey, e.altKey, etc.).

This comment has been minimized.

Copy link
@rebornix

rebornix Sep 10, 2018

Author Member

That's better than key down/up events, thanks! Will do.

This comment has been minimized.

Copy link
@alexdima

alexdima Sep 12, 2018

Member

👍 I've extracted #58515 so we don't forget

this._dndDecorationIds = [];
this._mouseDown = false;
this._modiferPressed = false;
this._dragSelection = null;
}

private onEditorBlur() {
this._removeDecoration();
this._dragSelection = null;
this._mouseDown = false;
this._modiferPressed = false;
}

private onEditorKeyDown(e: IKeyboardEvent): void {
if (!this._editor.getConfiguration().dragAndDrop) {
return;
Expand Down

0 comments on commit e82498a

Please sign in to comment.