提交 35d8f0a1 编写于 作者: I isidor

indentation: better handling for read only editor and diff editors

fixes #3257
上级 157e6c99
......@@ -424,12 +424,23 @@ export class EditorStatus implements IStatusbarItem {
}
private onIndentationChange(e: IBaseEditor): void {
let update: StateDelta = { indentation: null };
if (e && !this.isActiveEditor(e)) {
return;
}
const update: StateDelta = { indentation: null };
if (e instanceof BaseTextEditor) {
const options = (<ICommonCodeEditor>e.getControl()).getIndentationOptions();
update.indentation = options.insertSpaces ? nls.localize('spacesSize', "Spaces: {0}", options.tabSize) :
nls.localize('tabSize', "Tab Size: {0}", options.tabSize);
let editorWidget = e.getControl();
if (editorWidget) {
if (editorWidget.getEditorType() === EditorType.IDiffEditor) {
editorWidget = (<IDiffEditor>editorWidget).getModifiedEditor();
}
const options = (<ICommonCodeEditor>editorWidget).getIndentationOptions();
update.indentation = options.insertSpaces ? nls.localize('spacesSize', "Spaces: {0}", options.tabSize) :
nls.localize('tabSize', "Tab Size: {0}", options.tabSize);
}
}
this.updateState(update);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册