This commit is contained in:
Joao Moreno
2017-12-06 18:07:00 +01:00
parent eb426875e9
commit a34d92131f
2 changed files with 7 additions and 3 deletions
@@ -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));
@@ -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());