Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff for revision is sometimes broken #565

Open
jeriox opened this issue Jun 12, 2024 · 1 comment
Open

Diff for revision is sometimes broken #565

jeriox opened this issue Jun 12, 2024 · 1 comment
Labels
[P] minor [T] bug Something isn't working

Comments

@jeriox
Copy link
Contributor

jeriox commented Jun 12, 2024

When looking at the diff between two revisions, it is sometimes hard to see something because the markdown source is rendered without line breaks. Also sometimes this seems to display erroneous results (@lukasrad02 has more context)

@jeriox jeriox added [T] bug Something isn't working [P] minor labels Jun 12, 2024
@lukasrad02
Copy link
Contributor

I have taken a look at some pages with (seemingly) wrong diffs once again. From as far as I can tell, the diffs are not wrong, but unnecessarily complex. This might be caused by the missing line breaks, so the diff algorithm might detect replacements that did not actually happen.

Steps to reproduce:

  1. Create a page with the following filler text:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam felis massa, fringilla suscipit scelerisque et, fermentum sit amet eros. Maecenas pellentesque, nulla eu eleifend porttitor, lectus metus ullamcorper elit, in ullamcorper arcu odio ac felis. Vestibulum congue cursus dui vel hendrerit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut viverra hendrerit ipsum sed mattis.

Aenean eleifend tellus urna, id semper mauris sodales in. In gravida at metus pulvinar semper. Nullam finibus nisi consequat, condimentum odio sed, vehicula ante. Vivamus molestie risus sed libero tincidunt sodales. Phasellus semper, turpis id tempor rhoncus, justo mauris facilisis erat, non pretium est tellus vel mauris. Phasellus finibus massa quis elit sagittis eleifend. Aliquam eget efficitur neque. Quisque nec odio sed ante egestas facilisis quis ac arcu. Phasellus malesuada placerat ex a elementum. Donec porta risus sit amet orci pharetra aliquam.

  1. Save the page as a draft
  2. Copy one sentence from the second paragraph and use it to replace a sentence from the first one. A result could look like

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam felis massa, fringilla suscipit scelerisque et, fermentum sit amet eros. Maecenas pellentesque, nulla eu eleifend porttitor, lectus metus ullamcorper elit, in ullamcorper arcu odio ac felis. Phasellus finibus massa quis elit sagittis eleifend. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut viverra hendrerit ipsum sed mattis.

Aenean eleifend tellus urna, id semper mauris sodales in. In gravida at metus pulvinar semper. Nullam finibus nisi consequat, condimentum odio sed, vehicula ante. Vivamus molestie risus sed libero tincidunt sodales. Phasellus semper, turpis id tempor rhoncus, justo mauris facilisis erat, non pretium est tellus vel mauris. Phasellus finibus massa quis elit sagittis eleifend. Aliquam eget efficitur neque. Quisque nec odio sed ante egestas facilisis quis ac arcu. Phasellus malesuada placerat ex a elementum. Donec porta risus sit amet orci pharetra aliquam.

  1. Save another draft of the page
  2. View the diff between the two pages

The diff generated by Wagtail looks like this

image

I would expect a diff like the following one (generated with VS Code), showing way less changes

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[P] minor [T] bug Something isn't working
Development

No branches or pull requests

2 participants