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
Highlight diff #2335
Highlight diff #2335
Conversation
I'll have a look later on but I like the idea :)
|
Thanks! Will review after #2296 |
@andreynering you'll have to rebase on #2296 again :) |
This makes the code more strict since you can't assign or compare values of different types without proper cast.
Awesome, I'll checkout locally and test. |
@@ -23,32 +25,37 @@ import ( | |||
"github.com/gogits/gogs/modules/base" | |||
"github.com/gogits/gogs/modules/log" | |||
"github.com/gogits/gogs/modules/process" | |||
"github.com/sergi/go-diff/diffmatchpatch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this line after line 20.
@unknwon I did the fixes. |
return template.HTML(result) | ||
} | ||
|
||
func (diffSection *DiffSection) GetLeftLine(idx int, sliceIdx int) *DiffLine { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what this does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
To compute the diff I must have two line strings, the deleted and the added one. GetLeftLine
try to get the deleted one when the actual is an add. GetRightLine
is the oposite. See.
Unfortunaly, this isn't working when the left index is different of the right index. Example: left is 33 and right 34 for the same line.
I tried to fix that, but it's tricky. Any help would be appreciated.
I added another commit to the PR. I think I finally got it working now. 😀 |
LGTM, I'll merge now but will have comment for questions. |
… conflicting accounts on multiple gitea installations (gogs#2335) Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
cc @bkcsoft
Following up #2296
Not all lines are being highlighted, but not even GitHub or GitLab do it.