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

Implement Split Diff-View #2296

Merged
merged 5 commits into from Jan 6, 2016
Merged

Implement Split Diff-View #2296

merged 5 commits into from Jan 6, 2016

Conversation

bkcsoft
Copy link
Contributor

@bkcsoft bkcsoft commented Dec 28, 2015

Opened up a new PR since the previous one ( #2288) was for the wrong branch.

Changed the name from Unified => Split and rebased on develop

This is still a WIP so don't merge it yet, it's just here to show that I'm still working on it...

Stuff that still needs fixing before considering merging:

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 1, 2016

@andreynering could you pull the latest and see if the problem is still there?
technically it was still side-by-side, just that the line was to wide and made it scroll (almost) forever ^.^ anyhow, I've made it line-wrap instead since it makes more sense for split-views :)

2016-01-01-233550_1600x900_scrot

2016-01-01-233558_1600x900_scrot

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 1, 2016

Now working as intended

@unknwon thoughts?

@unknwon
Copy link
Member

unknwon commented Jan 2, 2016

I think the button should be called Unified instead of inline.

@andreynering
Copy link
Contributor

@bkcsoft Did you commit this change? Because for me it is as before.

I think you should rebase (or squash?) your commits, since some commits from @unknwon is showing in this pull requests.

But I'd say this is working as expected.

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 2, 2016

@unknwon yeah, I think that makes most sense on second thought

@andreynering I've commited the changes, which web-browser are you testing in? (I'm currently only testing on firefox)
about the leaking commits, I rebased on develop and that seems to have borken something -. - I'll see if I can make it cleaner

@andreynering
Copy link
Contributor

Which web-browser are you testing in?

Chrome

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 2, 2016

@andreynering yeah, not getting that on firefox or chrome. sure you checked it out cleanly and built it correctly? (make build and all that...)

@unknwon Renamed and cleaned up a bit :)

@andreynering
Copy link
Contributor

@bkcsoft I tried in Firefox and it's OK. In Chrome it's still as before.

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 3, 2016

@andreynering which version if chrome? Since I canct reproduce it :/

@andreynering
Copy link
Contributor

47.0.2526.106

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 3, 2016

I'll have a look later today :)

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 3, 2016

@andreynering currently testing in "Google Chrome 47.0.2526.80" and it "Works On My Machine" ^.^
Can't really see how .80 and .106 breaks it, I'll try 48.x or 49.x and see if it's still working there :)

@unknwon
Copy link
Member

unknwon commented Jan 3, 2016

Thanks @bkcsoft !

Just get back from trip. Will start reviewing today. (I'm on +8 CST right now)

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 3, 2016

@andreynering odd, I tried it in "Google Chrome 47.0.2526.80" and there it worked as expected, but in "Google Chrome 47.0.2526.106" I see what you're seeing...

Anyhow, the issue is with word-wrapping... I wrap on whitespace, but there's no whitespace to wrap on :/

@andreynering
Copy link
Contributor

I am playing a little here, trying to highlight what changed in each line, like GitHub and GitLab do:

1

2

3

There are some few bugs, but I hope I can get this working 100%.

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 4, 2016

@andreynering well, I can make it either break in the middle of words, OR break on whitespace... apparently not both -.-

about highlighting changes, that might be really hard... for simple stuff it easy enough:

- foo()
+ bar()

but for a bit more complex stuff it is harder:

- foo()
- bar(1)
+ foo()
+ baz()
+ bar(2)

^ this one should highlight only the numbers (and perhaps baz()) 😄

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 4, 2016

@andreynering well, I can make it either break in the middle of words, OR break on whitespace... apparently not both -.-

unless one uses an undocumented css-value... namely word-break: break-word...
I'll commit and push the fix so you can try it 😄

@andreynering
Copy link
Contributor

I will try to get it right and maybe send a PR, but will wait this one be
merged first.

I am using a third party package that does the diff of the strings.

Em dom, 3 de jan de 2016 22:14, Kim Carlbäcker notifications@github.com
escreveu:

@andreynering https://github.com/andreynering well, I can make it
either break in the middle of words, OR break on whitespace... apparently
not both -.-

about highlighting changes, that might be really hard... for simple
stuff it easy enough:

  • foo()
  • bar()

but for a bit more complex stuff it is harder:

  • foo()
  • bar(1)
  • foo()
  • baz()
  • bar(2)

^ this one should highlight only the numbers (and perhaps baz()) [image:
😄]


Reply to this email directly or view it on GitHub
#2296 (comment).

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 4, 2016

@andreynering yeah, I looked at diff-packages when I started this but it seemed like they wanted rad .patch-files (which I didn't wanna push to the frontend...) so I gave up on that...

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 4, 2016

Verified to work in the following browsers:
Chrome stable 47.0.2526.106
Firefox 43.0.1
Microsoft Edge 20.10240.16384.0 (that version-number xD
Internet Explorer 11.0.10240.16431
Opera 33.0.1990,115

@andreynering
Copy link
Contributor

@bkcsoft It's OK now. 👍

@andreynering andreynering mentioned this pull request Jan 4, 2016
@unknwon
Copy link
Member

unknwon commented Jan 5, 2016

Oops! There are conflicts on bindata.go

@unknwon unknwon added the status: needs feedback Tell me more about it label Jan 5, 2016
@unknwon
Copy link
Member

unknwon commented Jan 5, 2016

PS: A rebase is recommended to keep commit history clean.

@@ -168,6 +168,7 @@ func Diff(ctx *middleware.Context) {
}
}

ctx.Data["Style"] = ctx.Query("style") == "split"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be IsSplitStyle since it's a bool value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it should be IsSplitStyle

prev.children().eq(2).html($(this).children().eq(2).html());
prev.children().eq(3).addClass('add-code');
prev.children().eq(2).addClass('add-code');
// prev.children().eq(2).attr('style', 'background-color: #eaffea !important');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on with commented out lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old code, I'll fix that

@unknwon
Copy link
Member

unknwon commented Jan 5, 2016

Thanks agin for the PR!

I checked out locally and works great AFA I can tell.

Some comments are made, also I see a lot duplicated content between diff_box_split.tmpl and diff_box_unified.tmpl, is it worth doing it or should we reduce the duplicated part?

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 5, 2016

@unknwon I've missed to remove to old code, I'll remove that and squash some commits to make it cleaner. Also resolve the bindata.go-issue

About the duplicate code, I made that decision because it'll only do 1 bool-check (and not 1 per line). My reasoning for that is that it should be faster to render, I can do some benchmarks if you'd like to see how much slower it'd be to do it inline. (just need to find a big commit first 😄)

@unknwon
Copy link
Member

unknwon commented Jan 5, 2016

About the duplicate code, I made that decision because it'll only do 1 bool-check (and not 1 per line). My reasoning for that is that it should be faster to render, I can do some benchmarks if you'd like to see how much slower it'd be to do it inline. (just need to find a big commit first 😄)

I don't mean to check bool per line, but reduce the check to a smaller range of content. As you can see, things are getting different inside tbody tag: https://github.com/gogits/gogs/pull/2296/files#diff-9d1f05e66c594694d453ec18a343782dR35

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 5, 2016

doing it on the tbody-tag would make it check IsSplitStyle on each listed file. but if that's acceptable I'll do that :)

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 5, 2016

merging them and having it check per-file (on tbody) didn't even make a dent in the render-time even for some of the larger commits I could find 😄

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 5, 2016

Oh, I completely forgot to mention that this PR also includes the fold-icon (opticon-fold)
Which is what this is doing: https://github.com/gogits/gogs/pull/2296/files#diff-f0b73ac65b702903d90a117166a9b06bR75 (down to row 88)

Like this:
fold-icon

Not sure if I should leave it there or have it in a separate PR?

@unknwon
Copy link
Member

unknwon commented Jan 6, 2016

Never mind, I'll do that after merge.

And you need at least comment out fold icon, it's not working yet.

@bkcsoft
Copy link
Contributor Author

bkcsoft commented Jan 6, 2016

Already pushed the template-merging :)

The icon is more of a visual thing for me. but I'll remove it and see if I can make it work in a separate PR :)

@unknwon
Copy link
Member

unknwon commented Jan 6, 2016

Oh, I see. I'll checkout again later today. 😀

@unknwon unknwon removed the status: needs feedback Tell me more about it label Jan 6, 2016
@unknwon
Copy link
Member

unknwon commented Jan 6, 2016

LGTM.

unknwon added a commit that referenced this pull request Jan 6, 2016
@unknwon unknwon merged commit 2481fe2 into gogs:develop Jan 6, 2016
@unknwon unknwon mentioned this pull request Jan 6, 2016
@bkcsoft bkcsoft deleted the feature/split-diff branch January 20, 2016 16:26
@mastorm
Copy link

mastorm commented Feb 21, 2017

Is there a flag to enable split-view by default?

@unknwon
Copy link
Member

unknwon commented Feb 21, 2017

@mastorm currently, no..

ethantkoenig pushed a commit to ethantkoenig/gogs that referenced this pull request Sep 16, 2017
* only update needed columns when update user

* fix missing update_unix column
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 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

4 participants