Skip to content

Diff highlighting doesn't always include all changes #19508

Closed
@Gusted

Description

@Gusted

Description

Currently when Gitea is highlighting a diff, it's possible that not all code is correctly "diffed", this means that part of added code isn't included in the added-code span, but rather outside of it.

This is caused by broken spans! Gitea is diffing the code after it has been highlighted by chroma. This means we're diffing with HTML code, this causes that certain HTML elements are being split apart from each other, one part could live in the "equal" part and the other part in the "insert" this causes Broken spans, @zeripath has made a excellent attempt at fixing most cases of this broken spans, but there are still cases where this code fails to fix the broken spans:

https://try.gitea.io/Gusted/Test-repo/pulls/3/files

You can clearly see here that the ), xdg' part also should be included into the inserted code part. But because of certain set of conditions we're not fixing all broken spans in this case.

Gitea Version

03eba32

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

N/A

Screenshots

Actual:
image

Expected:
image

Git Version

N/A

Operating System

N/A

How are you running Gitea?

https://try.gitea.io/Gusted/Test-repo/pulls/3/files

Database

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions