Bugfix in motion's diff-view: correct amendment diff

This commit is contained in:
Tobias Hößl 2019-03-16 14:07:05 +01:00
parent e03ec00567
commit 1764447704
No known key found for this signature in database
GPG Key ID: 1D780C7599C2D2A2

View File

@ -679,26 +679,18 @@ export class MotionRepositoryService extends BaseAgendaContentObjectRepository<V
}
const origText = baseParagraphs[paraNo],
paragraphLines = this.lineNumbering.getLineNumberRange(origText),
diff = this.diff.diff(origText, newText),
affectedLines = this.diff.detectAffectedLineRange(diff);
if (affectedLines === null) {
return null;
}
let newTextLines = this.lineNumbering.insertLineNumbers(
newText,
lineLength,
null,
null,
paragraphLines.from
);
newTextLines = this.diff.formatDiff(
this.diff.extractRangeByLineNumbers(newTextLines, affectedLines.from, affectedLines.to)
const affectedDiff = this.diff.formatDiff(
this.diff.extractRangeByLineNumbers(diff, affectedLines.from, affectedLines.to)
);
const affectedConsolidated = this.diff.diffHtmlToFinalText(affectedDiff);
return new ViewMotionAmendedParagraph(amendment, paraNo, newTextLines, affectedLines);
return new ViewMotionAmendedParagraph(amendment, paraNo, affectedConsolidated, affectedLines);
}
)
.filter((para: ViewMotionAmendedParagraph) => para !== null);