codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 376 forks source link

Decoration is missing when deleting an empty line in unifiedMergeView #1459

Closed Vinzent03 closed 3 weeks ago

Vinzent03 commented 3 weeks ago

Describe the issue

When the current editor doc and the original doc for unifiedMergeView() are the same except that one empty line is removed in the current doc, the removed empty line in comparison to the original doc is not displayed as removed. The merge controls with reject and accept are shown, so a diff is recognized, but the actual change is not displayed. image

The linked reproduction link should show this clearly. When removing two empty lines, one removed line is shown.

Browser and platform

Firefox 131.0.3 and electron on linux

Reproduction link

https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge3VuaWZpZWRNZXJnZVZpZXd9IGZyb20gIkBjb2RlbWlycm9yL21lcmdlIgppbXBvcnQge1RleHR9IGZyb20gIkBjb2RlbWlycm9yL3N0YXRlIgoKCm5ldyBFZGl0b3JWaWV3KHsKICBkb2M6IFRleHQub2YoWyIiLCJIZWxsbyIsIiIsIkJ5ZSJdKSwKICBleHRlbnNpb25zOiBbCiAgICAuLi5iYXNpY1NldHVwLAogICAgdW5pZmllZE1lcmdlVmlldyh7CiAgICAgIG9yaWdpbmFsOiBUZXh0Lm9mKFsiIiwiSGVsbG8iLCIiLCAiIiwiQnllIl0pCiAgICB9KSwKICBdLAogIHBhcmVudDogZG9jdW1lbnQuYm9keQp9KQo=

marijnh commented 3 weeks ago

The decoration is there, but the browser collapses it because it is empty. Attached patch should help with this.