提交 2dbb1fea 编写于 作者: P Peng Lyu

read configuration when relayout

上级 fe789ed2
......@@ -374,7 +374,7 @@ const editorConfiguration: IConfigurationNode = {
'editor.find.addExtraSpaceOnTop': {
'type': 'boolean',
'default': true,
'description': nls.localize('find.addExtraSpaceOnTop', "Controls whether the Find Widget should add extra lines on top of the editor.")
'description': nls.localize('find.addExtraSpaceOnTop', "Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")
},
'editor.wordWrap': {
'type': 'string',
......
......@@ -164,17 +164,11 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
if (e.contribInfo) {
const addExtraSpaceOnTop = this._codeEditor.getConfiguration().contribInfo.find.addExtraSpaceOnTop;
if (addExtraSpaceOnTop && !this._viewZone) {
this._viewZone = this._viewZone = new FindWidgetViewZone(0);
this._viewZone = new FindWidgetViewZone(0);
this._showViewZone();
}
if (!addExtraSpaceOnTop && this._viewZone) {
this._codeEditor.changeViewZones((accessor) => {
if (this._viewZoneId) {
accessor.removeZone(this._viewZoneId);
}
this._viewZoneId = undefined;
this._viewZone = undefined;
});
this._removeViewZone();
}
}
}));
......@@ -487,19 +481,18 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
this._codeEditor.focus();
}
this._codeEditor.layoutOverlayWidget(this);
this._codeEditor.changeViewZones((accessor) => {
if (this._viewZoneId !== undefined) {
accessor.removeZone(this._viewZoneId);
this._viewZoneId = undefined;
if (this._viewZone) {
this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() - this._viewZone.heightInPx);
}
}
});
this._removeViewZone();
}
}
private _layoutViewZone() {
const addExtraSpaceOnTop = this._codeEditor.getConfiguration().contribInfo.find.addExtraSpaceOnTop;
if (!addExtraSpaceOnTop) {
this._removeViewZone();
return;
}
if (!this._isVisible) {
return;
}
......@@ -550,6 +543,19 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
});
}
private _removeViewZone() {
this._codeEditor.changeViewZones((accessor) => {
if (this._viewZoneId !== undefined) {
accessor.removeZone(this._viewZoneId);
this._viewZoneId = undefined;
if (this._viewZone) {
this._codeEditor.setScrollTop(this._codeEditor.getScrollTop() - this._viewZone.heightInPx);
this._viewZone = undefined;
}
}
});
}
private _applyTheme(theme: ITheme) {
let inputStyles: IFindInputStyles = {
inputActiveOptionBorder: theme.getColor(inputActiveOptionBorder),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册