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

Highlight diff #2335

Merged
merged 4 commits into from Jan 9, 2016
Merged

Highlight diff #2335

merged 4 commits into from Jan 9, 2016

Conversation

andreynering
Copy link
Contributor

cc @bkcsoft

Following up #2296

Not all lines are being highlighted, but not even GitHub or GitLab do it.

@bkcsoft
Copy link
Contributor

bkcsoft commented Jan 4, 2016 via email

@unknwon unknwon added status: needs feedback Tell me more about it and removed status: needs feedback Tell me more about it labels Jan 5, 2016
@unknwon unknwon added this to the 0.9.0 milestone Jan 5, 2016
@unknwon
Copy link
Member

unknwon commented Jan 5, 2016

Thanks! Will review after #2296

@bkcsoft
Copy link
Contributor

bkcsoft commented Jan 5, 2016

@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.
@andreynering
Copy link
Contributor Author

@unknwon @bkcsoft

I rebased with develop, improved my code and just updated the pull request.

Here's a picture for who's curious:

2

@unknwon
Copy link
Member

unknwon commented Jan 7, 2016

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"
Copy link
Member

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 unknwon added the status: needs feedback Tell me more about it label Jan 7, 2016
@andreynering
Copy link
Contributor Author

@unknwon I did the fixes.

return template.HTML(result)
}

func (diffSection *DiffSection) GetLeftLine(idx int, sliceIdx int) *DiffLine {
Copy link
Member

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?

Copy link
Contributor Author

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.

@andreynering
Copy link
Contributor Author

I added another commit to the PR. I think I finally got it working now. 😀

@unknwon
Copy link
Member

unknwon commented Jan 9, 2016

LGTM, I'll merge now but will have comment for questions.

@unknwon unknwon removed the status: needs feedback Tell me more about it label Jan 9, 2016
unknwon added a commit that referenced this pull request Jan 9, 2016
@unknwon unknwon merged commit bcf6aed into gogs:develop Jan 9, 2016
unknwon added a commit that referenced this pull request Jan 9, 2016
@andreynering andreynering deleted the highlight-diff branch January 9, 2016 14:00
ethantkoenig pushed a commit to ethantkoenig/gogs that referenced this pull request Sep 16, 2017
… conflicting accounts on multiple gitea installations (gogs#2335)

Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants