You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running into the same issue that @BlackKite84 was seeing. I have two divs that appear to have identical content (including whitespace). If I pass parameters via originalContainer and changedContainer, PrettyTextDiff appears to pass slightly different strings (different in their whitespace) to google-diff-match-patch. Here is the result of a call to .prettyTextDiff( ) when I use originalContainer and changedContainer parameters. Note the <br>'s that are inserted at the beginning and end of .immutable-clause-pretty-diff
And here is the result of a call to .prettyTextDiff( ) when I use originalContent and changedContent parameters with the trim( ) function, as suggested by @BlackKite84. It works as expected:
It appears that if there are matching newline characters inside the originalContent and changedContent divs, google-diff-match-patch passes the newline character back, but PrettyTextDiff converts said newline character to a <br>here
I'm not sure if it would break things for other users, but it seems like substituting <br>s for newline characters may not be necessary.
Activity
arnab commentedon May 20, 2015
Hi @BlackKite84 can you produce a jsfiddle with the problem?
BlackKite84 commentedon May 20, 2015
http://jsfiddle.net/pytm9ueL/1/
yes
arnab commentedon May 20, 2015
Huh, I am missing something here. You specified (in that jsfiddle):
originalContaineras.updateOriginalchangedContaineranddiffContaineras.updateChangeDog Days'')Questions:
diffContaineris same as thechangedContainer)?arnab commentedon May 20, 2015
Also, the "title" of this issue is set to
<br>. Could you please change that to the actual problem/question you are reporting/asking?BlackKite84 commentedon May 20, 2015
I overwrite the change Content with the diff (i will see only change and original)
http://jsfiddle.net/pytm9ueL/2/
A new line (
)
arnab commentedon May 20, 2015
Add
debug: trueto when you callprettyTextDiff: http://jsfiddle.net/pytm9ueL/4/This will show you what this library found. Looks like the underlying Google
diff-match-patchlibrary shows the"↵ "also as a diff.BlackKite84 commentedon May 20, 2015
and why "Enter" i use Tab
arnab commentedon May 20, 2015
Like I said, what you are seeing is coming from the underlying library. Please ask your question there: https://code.google.com/p/google-diff-match-patch/
[-]<br>[/-][+]Diffs of text containing tab characters?[/+]BlackKite84 commentedon May 20, 2015
I have Fix ist with
jbeyer05 commentedon Jun 24, 2019
I am running into the same issue that @BlackKite84 was seeing. I have two divs that appear to have identical content (including whitespace). If I pass parameters via originalContainer and changedContainer, PrettyTextDiff appears to pass slightly different strings (different in their whitespace) to google-diff-match-patch. Here is the result of a call to .prettyTextDiff( ) when I use originalContainer and changedContainer parameters. Note the
<br>'s that are inserted at the beginning and end of .immutable-clause-pretty-diffAnd here is the result of a call to .prettyTextDiff( ) when I use originalContent and changedContent parameters with the trim( ) function, as suggested by @BlackKite84. It works as expected:
jbeyer05 commentedon Jun 24, 2019
It appears that if there are matching newline characters inside the originalContent and changedContent divs, google-diff-match-patch passes the newline character back, but PrettyTextDiff converts said newline character to a
<br>hereI'm not sure if it would break things for other users, but it seems like substituting
<br>s for newline characters may not be necessary.parallels999 commentedon Oct 2, 2024
I think that any problems like
\t,\b, or whitespace would be solved by using<pre></pre>Example: https://jsfiddle.net/ybz8enwk
