difftastic icon indicating copy to clipboard operation
difftastic copied to clipboard

Newlines in strings breaks display

Open NickNick opened this issue 1 year ago • 2 comments

Thanks for reporting a bug! Please include all of the following:

(1) A description of the issue. A screenshot is often helpful too.

Here are two screenshots. The first is my attempt to reproduce the issue, but it shows the perfect diff. I love it! The second one shows the diff in the real project, and as becomes clear by comparing the two screenshots, the diff is projected one line below the actual diff. This is pretty confusing.

Screenshot 2024-01-30 at 09 30 38 Screenshot 2024-01-30 at 09 30 59

(2) A copy of what you're diffing. If you're diffing files, include the before and after files. If you're using difftastic with a VCS repository (e.g. git), include the URL and commit hash.

I can't share the whole document, but I would like to help with making a small repro. I am not sure where to start though.

(3) The version of difftastic you're using (see difft --version) and your operating system.

Difftastic 0.54.0 (built with rustc 1.75.0) on macos.

NickNick avatar Jan 30 '24 08:01 NickNick

Yep, that definitely looks like a bug!

Your attempt to reproduce isn't actually using the XML diff, note that it says Text. Try naming your sample files to something.xml so difftastic knows they're XML, and see if you can reproduce that way?

Wilfred avatar Jan 31 '24 05:01 Wilfred

Thanks for the quick response! Changing the extensions to XML manages to reproduce it. Here is the smallest one I could make. I would upload the files, but github does not support that, so here are the files inline (old, then new).

<p>
The potato
The bananas
</p>
<p>
The potatoes
The bananas
</p>

Diff image

NickNick avatar Jan 31 '24 09:01 NickNick