Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line similarity matching doesn't work well in some cases #541

Open
rg11175 opened this issue Aug 28, 2024 · 0 comments
Open

Line similarity matching doesn't work well in some cases #541

rg11175 opened this issue Aug 28, 2024 · 0 comments

Comments

@rg11175
Copy link

rg11175 commented Aug 28, 2024

Step 0: Describe your environment

  • OS: Windows11
  • diff2html version: 3.4.22
  • Using diff2html directly or using diff2html-ui helper: using diff2html-ui

Step 1: Describe the problem:

for some cases, the line similarity matching logic is not correct to my compared files, look at the example below:
image

You can see that diff2html has matched line number 7787 on the left with line number 7792 on the right, while I expect it to match line 7787 on the right with line 7791 on the left, the match as it currently stands is incorrect to me

here is my code:

`
const configuration: Diff2HtmlUIConfig = {
drawFileList: false,
fileListToggle: false,
fileListStartVisible: false,
outputFormat: 'side-by-side',
fileContentToggle: false,
renderNothingWhenEmpty: true,
matching: 'words',
matchWordsThreshold: 1,
stickyFileHeaders: true,
highlightLanguages: new Map<string, string>(),
// TBD: abap format - check with Yuri how to implement,
rawTemplates: {
'tag-file-changed': '',
'icon-file': '',
},
compiledTemplates: {
'generic-file-path': Hogan.compile(
'

{{ fileDiffName }}

'
) as Hogan.Template,
},
};

        const diffText = diff.createTwoFilesPatch(
          'file',
          'file',
          this.oldText,
          this.newText
        );

        const diff2htmlUi = new Diff2HtmlUI(
          targetElement,
          diffText,
          configuration
        );
        diff2htmlUi.draw();
        diff2htmlUi.highlightCode();

`

@github-staff github-staff deleted a comment from ViniciusSCG Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@rg11175 and others