diff --git a/apps/red-ui/src/app/modules/shared/components/editor/editor.component.ts b/apps/red-ui/src/app/modules/shared/components/editor/editor.component.ts index 1bac843a6..4b5fa1fb1 100644 --- a/apps/red-ui/src/app/modules/shared/components/editor/editor.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/editor/editor.component.ts @@ -17,6 +17,7 @@ const lineChangeToDecoration = ({ originalEndLineNumber, originalStartLineNumber }, } as IModelDeltaDecoration); const isPositive = (lineChange: ILineChange) => lineChange.originalEndLineNumber - lineChange.originalStartLineNumber >= 0; +const notZero = (lineChange: ILineChange) => lineChange.originalEndLineNumber !== 0 && lineChange.originalStartLineNumber !== 0; @Component({ selector: 'redaction-editor', @@ -122,11 +123,12 @@ export class EditorComponent implements OnInit { let glyphDecorations = []; this.diffEditor.onDidUpdateDiff(() => { /** - * Sometimes diff editor thinks that there's a change that ends on line 0 and starts on line 2000 or so. + * Sometimes diff editor thinks that there's a change that starts on a line greater than 0 and ends on line 0. * We must get all change that started on a line and ended on the same or greater line * Otherwise margin buttons will have an odd behaviour */ - const decorations = this.diffEditor.getLineChanges().filter(isPositive).map(lineChangeToDecoration); + const lineChanges = this.diffEditor.getLineChanges().filter(change => isPositive(change) && notZero(change)); + const decorations = lineChanges.map(lineChangeToDecoration); glyphDecorations = this.diffEditor.getOriginalEditor().deltaDecorations(glyphDecorations, decorations); }); }