未验证 提交 b2b3b015 编写于 作者: A Alex Dima

Sort line decorations

上级 796a38f9
......@@ -34,22 +34,8 @@ export class LineDecoration {
if (aLen !== bLen) {
return false;
}
if (aLen === 0) {
return true;
}
if (aLen === 1) {
return LineDecoration._equals(a[0], b[0]);
}
const bSeen: (undefined | true)[] = new Array(bLen);
for (let i = 0; i < aLen; ++i) {
let j = 0;
for (; j < bLen; ++j) {
if (bSeen[j] !== true && LineDecoration._equals(a[i], b[j])) {
bSeen[j] = true;
break;
}
}
if (j === bLen) {
for (let i = 0; i < aLen; i++) {
if (!LineDecoration._equals(a[i], b[i])) {
return false;
}
}
......
......@@ -127,7 +127,7 @@ export class RenderLineInput {
this.containsRTL = containsRTL;
this.fauxIndentLength = fauxIndentLength;
this.lineTokens = lineTokens;
this.lineDecorations = lineDecorations;
this.lineDecorations = lineDecorations.sort(LineDecoration.compare);
this.tabSize = tabSize;
this.startVisibleColumn = startVisibleColumn;
this.spaceWidth = spaceWidth;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册