提交 7e777570 编写于 作者: S shskwmt

Fixes #113318: Show having no change when diffing two empty files

上级 689fbbd9
...@@ -313,6 +313,13 @@ export class DiffComputer { ...@@ -313,6 +313,13 @@ export class DiffComputer {
if (this.original.lines.length === 1 && this.original.lines[0].length === 0) { if (this.original.lines.length === 1 && this.original.lines[0].length === 0) {
// empty original => fast path // empty original => fast path
if (this.modified.lines.length === 1 && this.modified.lines[0].length === 0) {
return {
quitEarly: false,
changes: []
};
}
return { return {
quitEarly: false, quitEarly: false,
changes: [{ changes: [{
......
...@@ -462,6 +462,13 @@ suite('Editor Diff - DiffComputer', () => { ...@@ -462,6 +462,13 @@ suite('Editor Diff - DiffComputer', () => {
assertDiff(original, modified, expected, true, false, true); assertDiff(original, modified, expected, true, false, true);
}); });
test('empty diff 5', () => {
let original = [''];
let modified = [''];
let expected: ILineChange[] = [];
assertDiff(original, modified, expected, true, false, true);
});
test('pretty diff 1', () => { test('pretty diff 1', () => {
let original = [ let original = [
'suite(function () {', 'suite(function () {',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册