Qeole / colorediffs

Thunderbird extension to colorize code diffs in messages.
Mozilla Public License 2.0
25 stars 5 forks source link

Incorrect display diff of xml file #99

Closed iiey closed 3 years ago

iiey commented 3 years ago

Problem: incorrect parsing tags.

+        <geometry>
+            <x>0</x>
+            <y>0</y>
+            <width>480</width>
+            <height>800</height>
+        </geometry>

will be showed as follow: diff_xml or diff_xml2

Reproduction Steps:

Expected Behaviours: content of diff should always be correctly display regardless rendering methods

Qeole commented 3 years ago

Right, looks like a bug indeed, thanks for the report.

It looks like the XML tags are interpreted as HTML, I remember we set an innerHTML somewhere in the add-on, I suspect this is where it happens (looks at the code: we have node.innerHTML = node.textContent.replace(/( +|\t+)/g, replacer); for replacing spaces by visible characters).

Assuming that replacing the spaces worked correctly, the revert back to the original state should work as well, I don't think this is a separate bug.

I'll look into it, it may take a few days.

Qeole commented 3 years ago

Looks like the fix is not too complicated. Would you have a chance to build and try the add-on from branch pr/escape_html? If it works well for you as well, I'll merge and upload a new version to ATN. No worries if you cannot try.

iiey commented 3 years ago

Hey Qeole,

I did try your pr branch escape_html (v2.1.1) and it turns out to work correctly as expected until now no side effects.

diff_xml_fix

Thank you very much for the quick fix!

Qeole commented 3 years ago

Awesome, thanks for checking! I'll try to merge & update tonight if I can.

Qeole commented 3 years ago

Now up on ATN.