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

[Proposal] Future improvments for code hightlight diff #20467

Closed
wxiaoguang opened this issue Jul 24, 2022 · 2 comments
Closed

[Proposal] Future improvments for code hightlight diff #20467

wxiaoguang opened this issue Jul 24, 2022 · 2 comments

Comments

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jul 24, 2022

Follows

Background

Gitea's code diff is based on highlighted code at the moment. #19958 only does some improvements, there are still some bad cases for rendering if the diff breaks in a highlighted span. See the screenshot, the diff result is inconsistent.

image

image

(more hints, in the second screenshot, the color of bbbb is different, it's also caused by that the diff breaks in the span)

Possible solutions

Use "semantic change expanding" algorithm

Expand the spans with semantics to other diff sections?

Use a general token parser

More aggressively, use placeholders for all tokens (make aaaabbbb a token), then there will be no break in tokens?

Some other diff algorithms

(TODO)

Some references

@silverwind
Copy link
Member

Regarding diff algorithms, there's also histogram which is an improvement over patience. This article gives a good summary. I think we may opt to use these newer diff algorithms by default in the future.

@wxiaoguang
Copy link
Contributor Author

I am not working on this, so close it. Feel free to take it.

@wxiaoguang wxiaoguang closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2022
@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants