Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Issue: Code breaking when there is no change in a line #141

Description

@ravellaabhinav

Suppose if there are 5lines of code to check difference and there are changes in Line:1,2,5. The library is helping to print the difference with line number for line:1,2 and when there is a break in line number i.e.,line5 here line number is not getting printed instead char count number is being printed

Error:


image

Activity

  1. dmsnell commented on Apr 25, 2023

    @dmsnell

    @ravellaabhinav I'm having trouble undestanding what the issue is. From your screenshot, it looks like the library is providing the right indications of what changed in the text.

    What is your specific question? What specifically are you seeing as broken? What specific output would you have expected differently?

  2. ravellaabhinav commented on Apr 25, 2023

    @ravellaabhinav
    Author

    @dmsnell, can you see in screenshot that it is showing 85 as line number in the difference, but there are only 7lines in the input

  3. dmsnell commented on Apr 25, 2023

    @dmsnell

    aha, thanks @ravellaabhinav - that's clear now, and I missed that.

    what tool are you using there? the library itself doesn't really report line numbers, so that's why I was confused.

  4. ravellaabhinav commented on Apr 25, 2023

    @ravellaabhinav
    Author

    @dmsnell: That's my UI and nothing much.


    I used the same logic:

    function diff_lineMode(text1, text2) { var dmp = new diff_match_patch(); var a = dmp.diff_linesToChars_(text1, text2); var lineText1 = a.chars1; var lineText2 = a.chars2; var lineArray = a.lineArray; var diffs = dmp.diff_main(lineText1, lineText2, false); dmp.diff_charsToLines_(diffs, lineArray); return diffs; }

  5. dmsnell commented on Apr 25, 2023

    @dmsnell

    @ravellaabhinav this is a bit beyond me, and I'm guessing if you could share the code powering that UI it might help.

    do you think it's possible there's a mismatch between what diff-match-patch is reporting and what is being interpreted as line counts?

    what is the output of the call to diff-match-patch in the example behind the screenshot? can you paste the output directly here?

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions