You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
(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?
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.
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.
(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
[diff].algorithm = patience
The text was updated successfully, but these errors were encountered: