提交 eb4161ee 编写于 作者: A Alex Dima

Use null when a decoration does not use overviewRuler

上级 ae670f0d
......@@ -198,7 +198,7 @@ export class IntervalNode implements IModelDecoration {
|| className === ClassName.EditorInfoDecoration
));
_setNodeStickiness(this, <number>this.options.stickiness);
setNodeIsInOverviewRuler(this, this.options.overviewRuler.color ? true : false);
setNodeIsInOverviewRuler(this, (this.options.overviewRuler && this.options.overviewRuler.color) ? true : false);
}
public setCachedOffsets(absoluteStart: number, absoluteEnd: number, cachedVersionId: number): void {
......
......@@ -1676,8 +1676,8 @@ export class TextModel extends Disposable implements model.ITextModel {
return;
}
const nodeWasInOverviewRuler = (node.options.overviewRuler.color ? true : false);
const nodeIsInOverviewRuler = (options.overviewRuler.color ? true : false);
const nodeWasInOverviewRuler = (node.options.overviewRuler && node.options.overviewRuler.color ? true : false);
const nodeIsInOverviewRuler = (options.overviewRuler && options.overviewRuler.color ? true : false);
if (nodeWasInOverviewRuler !== nodeIsInOverviewRuler) {
// Delete + Insert due to an overview ruler status change
......@@ -2846,7 +2846,7 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
this.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;
this.isWholeLine = options.isWholeLine || false;
this.showIfCollapsed = options.showIfCollapsed || false;
this.overviewRuler = new ModelDecorationOverviewRulerOptions(options.overviewRuler);
this.overviewRuler = options.overviewRuler ? new ModelDecorationOverviewRulerOptions(options.overviewRuler) : null;
this.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;
this.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;
this.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;
......
......@@ -793,7 +793,7 @@ export class SplitLinesCollection implements IViewModelLinesCollection {
for (let i = 0, len = decorations.length; i < len; i++) {
const decoration = decorations[i];
const opts = <ModelDecorationOverviewRulerOptions>decoration.options.overviewRuler;
const lane = opts.position;
const lane = opts ? opts.position : 0;
if (lane === 0) {
continue;
}
......@@ -1356,7 +1356,7 @@ export class IdentityLinesCollection implements IViewModelLinesCollection {
for (let i = 0, len = decorations.length; i < len; i++) {
const decoration = decorations[i];
const opts = <ModelDecorationOverviewRulerOptions>decoration.options.overviewRuler;
const lane = opts.position;
const lane = opts ? opts.position : 0;
if (lane === 0) {
continue;
}
......
......@@ -539,7 +539,9 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
for (let i = 0, len = decorations.length; i < len; i++) {
const decoration = decorations[i];
const opts = <ModelDecorationOverviewRulerOptions>decoration.options.overviewRuler;
opts._resolvedColor = null;
if (opts) {
opts._resolvedColor = null;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册