From a34d92131fbf0178c204b7b417bb18e24a2aa857 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Wed, 6 Dec 2017 18:07:00 +0100 Subject: [PATCH] fixes #39668 --- src/vs/editor/contrib/zoneWidget/zoneWidget.ts | 8 ++++++-- .../parts/scm/electron-browser/dirtydiffDecorator.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/contrib/zoneWidget/zoneWidget.ts b/src/vs/editor/contrib/zoneWidget/zoneWidget.ts index dca1d69a836..a2a990f46e8 100644 --- a/src/vs/editor/contrib/zoneWidget/zoneWidget.ts +++ b/src/vs/editor/contrib/zoneWidget/zoneWidget.ts @@ -28,6 +28,7 @@ export interface IOptions { isResizeable?: boolean; frameColor?: Color; arrowColor?: Color; + keepEditorSelection?: boolean; } export interface IStyles { @@ -42,7 +43,8 @@ const defaultOptions: IOptions = { showFrame: true, className: '', frameColor: defaultColor, - arrowColor: defaultColor + arrowColor: defaultColor, + keepEditorSelection: false }; const WIDGET_ID = 'vs.editor.contrib.zoneWidget'; @@ -391,7 +393,9 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider { this._doLayout(containerHeight, width); - this.editor.setSelection(where); + if (!this.options.keepEditorSelection) { + this.editor.setSelection(where); + } // Reveal the line above or below the zone widget, to get the zone widget in the viewport const revealLineNumber = Math.min(this.editor.getModel().getLineCount(), Math.max(1, where.endLineNumber + 1)); diff --git a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts index 426aa42688b..fb28a9e4c3f 100644 --- a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts @@ -197,7 +197,7 @@ class DirtyDiffWidget extends PeekViewWidget { @IMessageService private messageService: IMessageService, @IContextKeyService contextKeyService: IContextKeyService ) { - super(editor, { isResizeable: true, frameWidth: 1 }); + super(editor, { isResizeable: true, frameWidth: 1, keepEditorSelection: true }); themeService.onThemeChange(this._applyTheme, this, this._disposables); this._applyTheme(themeService.getTheme());