Closed Vinzent03 closed 2 weeks ago
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.
unifiedMergeView()
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.
Firefox 131.0.3 and electron on linux
https://codemirror.net/try/?c=aW1wb3J0IHtiYXNpY1NldHVwLCBFZGl0b3JWaWV3fSBmcm9tICJjb2RlbWlycm9yIgppbXBvcnQge3VuaWZpZWRNZXJnZVZpZXd9IGZyb20gIkBjb2RlbWlycm9yL21lcmdlIgppbXBvcnQge1RleHR9IGZyb20gIkBjb2RlbWlycm9yL3N0YXRlIgoKCm5ldyBFZGl0b3JWaWV3KHsKICBkb2M6IFRleHQub2YoWyIiLCJIZWxsbyIsIiIsIiIsIkJ5ZSJdKSwKICBleHRlbnNpb25zOiBbCiAgICAuLi5iYXNpY1NldHVwLAogICAgdW5pZmllZE1lcmdlVmlldyh7CiAgICAgIG9yaWdpbmFsOiBUZXh0Lm9mKFsiIiwiSGVsbG8iLCIiLCJCeWUiXSkKICAgIH0pLAogIF0sCiAgcGFyZW50OiBkb2N1bWVudC5ib2R5Cn0pCg==
Thanks for spotting that. Attached patch should help.
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.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==