codemirror / dev

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

deleted line decoration when adding a new line in unifieedMergeView #1463

Closed Vinzent03 closed 2 weeks ago

Vinzent03 commented 2 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 added to the current doc, the diff shows a removed line as well.

image

The linked reproduction link should show this clearly.

I noticed this after #1459 / https://github.com/codemirror/merge/commit/4cc638117ae9a59d210073c32018e25211d5a773 . I'm pretty sure the issue didn't exist before that.

Browser and platform

Firefox 131.0.3 and electron on linux

Reproduction link

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

marijnh commented 2 weeks ago

Thanks for spotting that. Attached patch should help.