Skip to content

Diffs of text containing tab characters? #11

Open

Description

@BlackKite84

on Diff by Two Table withs Tab's the output has a
what does not belong there

output (updateChange) the
before Dog Days is too much

<tr>
                        <td class="columnText updateOriginal" style="width: 50%;">
                            Dog Days''                      </td>
                        <td class="columnText updateChange" style="width: 50%;"><span><br>                          Dog Days''                      </span></td>
                    </tr>

on view in browser i See a new line, the Text is not symmetric on line beginning

Activity

  1. arnab commented on May 20, 2015

    @arnab
    Owner

    Hi @BlackKite84 can you produce a jsfiddle with the problem?

  2. BlackKite84 commented on May 20, 2015

    @BlackKite84
    Author
  3. arnab commented on May 20, 2015

    @arnab
    Owner

    Huh, I am missing something here. You specified (in that jsfiddle):

    • the originalContainer as .updateOriginal
    • but both the changedContainer and diffContainer as .updateChange
    • text contents of both original and changed container look the same to me (Dog Days'')

    Questions:

    • Where do you expect to see the diff (since the diffContainer is same as the changedContainer)?
    • What do you expect to see as the diff (since the text looks the same to me)?
  4. arnab commented on May 20, 2015

    @arnab
    Owner

    Also, the "title" of this issue is set to <br>. Could you please change that to the actual problem/question you are reporting/asking?

  5. BlackKite84 commented on May 20, 2015

    @BlackKite84
    Author

    unbenannt

    I overwrite the change Content with the diff (i will see only change and original)

    http://jsfiddle.net/pytm9ueL/2/

    A new line (
    )

  6. arnab commented on May 20, 2015

    @arnab
    Owner

    Add debug: true to when you call prettyTextDiff: http://jsfiddle.net/pytm9ueL/4/

    This will show you what this library found. Looks like the underlying Google diff-match-patch library shows the "↵ " also as a diff.

  7. BlackKite84 commented on May 20, 2015

    @BlackKite84
    Author

    and why "Enter" i use Tab

  8. arnab commented on May 20, 2015

    @arnab
    Owner

    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/

  9. changed the title [-]<br>[/-] [+]Diffs of text containing tab characters?[/+] on May 20, 2015
  10. BlackKite84 commented on May 20, 2015

    @BlackKite84
    Author

    I have Fix ist with

            } else {
              original = $(settings.originalContainer, this).text().trim();
              changed = $(settings.changedContainer, this).text().trim();
            }
    
  11. jbeyer05 commented on Jun 24, 2019

    @jbeyer05

    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

    Screen Shot 2019-06-24 at 7 28 19 PM

    Screen Shot 2019-06-24 at 7 28 42 PM

    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:

    Screen Shot 2019-06-24 at 7 30 41 PM

    Screen Shot 2019-06-24 at 7 30 53 PM

  12. jbeyer05 commented on Jun 24, 2019

    @jbeyer05

    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.

  13. parallels999 commented on Oct 2, 2024

    @parallels999

    I think that any problems like \t, \b, or whitespace would be solved by using <pre></pre>

    Example: https://jsfiddle.net/ybz8enwk
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions