未验证 提交 70b5e936 编写于 作者: I Isidor Nikolic 提交者: GitHub

Merge pull request #90822 from jeanp413/zen-mode-linenumbers-1

Properly reset editor.lineNumbers after disabling zen mode
......@@ -25,6 +25,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import { LifecyclePhase, StartupKind, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility } from 'vs/platform/windows/common/windows';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IEditor } from 'vs/editor/common/editorCommon';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
......@@ -120,6 +121,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
private workbenchGrid!: SerializableGrid<ISerializableView>;
private editorWidgetSet = new Set<IEditor>();
private disposed: boolean | undefined;
private titleBarPartView!: ISerializableView;
......@@ -690,7 +693,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.state.zenMode.active = !this.state.zenMode.active;
this.state.zenMode.transitionDisposables.clear();
const setLineNumbers = (lineNumbers?: any) => this.editorService.visibleTextEditorWidgets.forEach(editor => {
const setLineNumbers = (lineNumbers?: any) => {
const setEditorLineNumbers = (editor: IEditor) => {
// To properly reset line numbers we need to read the configuration for each editor respecting it's uri.
if (!lineNumbers && isCodeEditor(editor) && editor.hasModel()) {
const model = editor.getModel();
......@@ -701,7 +705,21 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
editor.updateOptions({ lineNumbers });
};
if (!lineNumbers) {
// Reset line numbers on all editors visible and non-visible
for (const editor of this.editorWidgetSet) {
setEditorLineNumbers(editor);
}
this.editorWidgetSet.clear();
} else {
this.editorService.visibleTextEditorWidgets.forEach(editor => {
this.editorWidgetSet.add(editor);
setEditorLineNumbers(editor);
});
}
};
// Check if zen mode transitioned to full screen and if now we are out of zen mode
// -> we need to go out of full screen (same goes for the centered editor layout)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册