Skip to content

Commit

Permalink
add editor onFocusChanged event to update active editor when switchin…
Browse files Browse the repository at this point in the history
…g editors

Signed-off-by: odelia <odelia.zehavi@sap.com>
  • Loading branch information
odelia committed Feb 1, 2021
1 parent ef9d9ee commit 261038c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/editor/src/browser/editor-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ export class EditorWidget extends BaseWidget implements SaveableSource, Navigata
this.addClass('theia-editor');
this.toDispose.push(this.editor);
this.toDispose.push(this.editor.onSelectionChanged(() => {
if (this.editor.isFocused()) {
if (this.editor.isFocused() && this.selectionService.selection !== this.editor) {
this.selectionService.selection = this.editor;
}
}));
this.toDispose.push(this.editor.onFocusChanged(() => {
if (this.editor.isFocused() && this.selectionService.selection !== this.editor) {
this.selectionService.selection = this.editor;
}
}));
Expand Down

0 comments on commit 261038c

Please sign in to comment.