Skip to content

Commit

Permalink
Create own function
Browse files Browse the repository at this point in the history
  • Loading branch information
Elblinator committed Oct 16, 2024
1 parent bb10512 commit cfec396
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,6 @@ export class MotionDiffService {
firstLine: change.getLineFrom()
});
let diff = this.diff(oldText, change.getChangeNewText());
//console.log(diff);

// If an insertion makes the line longer than the line length limit, we need two line breaking runs:
// - First, for the official line numbers, ignoring insertions (that's been done some lines before)
Expand All @@ -2023,7 +2022,6 @@ export class MotionDiffService {
DomHelpers.addCSSClassToFirstTag(origBeginning, `merge-before`) + diff.substring(origBeginning.length);
}

//console.log(diff);
return diff;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,33 +239,36 @@ export class MotionFormatService {
)
);
}
text[text.length - 1] = text[text.length - 1].replace(`os-line-number `, ``);
text.push(`<span class="amendment-nr-n-icon">`);
if (this.hasCollissions(changesToShow[i], changesToShow)) {
text.push(`<mat-icon class="margin-right-10">warning</mat-icon>`);
}
const current_text = changesToShow[i];
if (`amend_nr` in current_text) {
if (typeof current_text.amend_nr === `string`) {
text.push(`<span class="amendment-nr">`, current_text.amend_nr);
}
if (current_text.amend_nr === ``) {
text.push(`Amendment`);
}
text.push(`:</span></span>`);
}
text.push(...this.addAmendmentNr(changesToShow, changesToShow[i]));
text.push(this.diffService.getChangeDiff(motionText, changesToShow[i], lineLength, highlightedLine));
lastLineTo = changesToShow[i].getLineTo();
}

text.push(
this.diffService.getTextRemainderAfterLastChange(motionText, changesToShow, lineLength, highlightedLine)
);
//console.log(text, text.join(``));
return text.join(``);
};

public hasCollissions(change: ViewUnifiedChange, changes: ViewUnifiedChange[]): boolean {
return this.diffService.changeHasCollissions(change, changes);
}

private addAmendmentNr(changesToShow: ViewUnifiedChange[], current_text: ViewUnifiedChange): string[] {
const amendmentNr: string[] = [];
amendmentNr.push(`<span class="amendment-nr-n-icon">`);
if (this.hasCollissions(current_text, changesToShow)) {
amendmentNr.push(`<mat-icon class="margin-right-10">warning</mat-icon>`);
}
if (`amend_nr` in current_text) {
if (typeof current_text.amend_nr === `string`) {
amendmentNr.push(`<span class="amendment-nr">`, current_text.amend_nr);
}
if (current_text.amend_nr === ``) {
amendmentNr.push(`Amendment`);
}
amendmentNr.push(`:</span></span>`);
}
return amendmentNr;
}
}

0 comments on commit cfec396

Please sign in to comment.