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

Diff highlighting doesn't always include all changes #19508

Closed
Gusted opened this issue Apr 26, 2022 · 1 comment · Fixed by #19958
Closed

Diff highlighting doesn't always include all changes #19508

Gusted opened this issue Apr 26, 2022 · 1 comment · Fixed by #19958
Labels

Comments

@Gusted
Copy link
Contributor

Gusted commented Apr 26, 2022

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

@wxiaoguang
Copy link
Contributor

@Gusted I checked https://try.gitea.io/Gusted/Test-repo/pulls/3/files , it's better than before.

image

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants