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

Fixes #18353: Always respect the `shouldIgnoreTrimWhitespace` flag

上级 14057a64
......@@ -34,24 +34,6 @@ class MarkerSequence implements ISequence {
this.endMarkers = endMarkers;
}
public equals(other: any): boolean {
if (!(other instanceof MarkerSequence)) {
return false;
}
const otherMarkerSequence = <MarkerSequence>other;
if (this.getLength() !== otherMarkerSequence.getLength()) {
return false;
}
for (let i = 0, len = this.getLength(); i < len; i++) {
const myElement = this.getElementHash(i);
const otherElement = otherMarkerSequence.getElementHash(i);
if (myElement !== otherElement) {
return false;
}
}
return true;
}
public getLength(): number {
return this.startMarkers.length;
}
......@@ -321,7 +303,6 @@ class LineChange implements ILineChange {
export interface IDiffComputerOpts {
shouldPostProcessCharChanges: boolean;
shouldIgnoreTrimWhitespace: boolean;
shouldConsiderTrimWhitespaceInEmptyCase: boolean;
shouldMakePrettyDiff: boolean;
}
......@@ -347,11 +328,6 @@ export class DiffComputer {
this.modifiedLines = modifiedLines;
this.original = new LineMarkerSequence(originalLines);
this.modified = new LineMarkerSequence(modifiedLines);
if (opts.shouldConsiderTrimWhitespaceInEmptyCase && this.shouldIgnoreTrimWhitespace && this.original.equals(this.modified)) {
// Diff would be empty with `shouldIgnoreTrimWhitespace`
this.shouldIgnoreTrimWhitespace = false;
}
}
public computeDiff(): ILineChange[] {
......
......@@ -313,7 +313,6 @@ export abstract class BaseEditorSimpleWorker {
let diffComputer = new DiffComputer(originalLines, modifiedLines, {
shouldPostProcessCharChanges: true,
shouldIgnoreTrimWhitespace: ignoreTrimWhitespace,
shouldConsiderTrimWhitespaceInEmptyCase: true,
shouldMakePrettyDiff: true
});
return TPromise.as(diffComputer.computeDiff());
......@@ -331,7 +330,6 @@ export abstract class BaseEditorSimpleWorker {
let diffComputer = new DiffComputer(originalLines, modifiedLines, {
shouldPostProcessCharChanges: false,
shouldIgnoreTrimWhitespace: ignoreTrimWhitespace,
shouldConsiderTrimWhitespaceInEmptyCase: false,
shouldMakePrettyDiff: true
});
return TPromise.as(diffComputer.computeDiff());
......
......@@ -55,7 +55,6 @@ function assertDiff(originalLines: string[], modifiedLines: string[], expectedCh
var diffComputer = new DiffComputer(originalLines, modifiedLines, {
shouldPostProcessCharChanges: shouldPostProcessCharChanges || false,
shouldIgnoreTrimWhitespace: shouldIgnoreTrimWhitespace || false,
shouldConsiderTrimWhitespaceInEmptyCase: true,
shouldMakePrettyDiff: true
});
var changes = diffComputer.computeDiff();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册