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

Side by side viewer #86

Closed
HarrisonMc555 opened this issue Jan 16, 2020 · 16 comments · Fixed by #243
Closed

Side by side viewer #86

HarrisonMc555 opened this issue Jan 16, 2020 · 16 comments · Fixed by #243

Comments

@HarrisonMc555
Copy link

Are there any plans to support side-by-side viewing?

@dandavison
Copy link
Owner

Can you expand on what this feature would be? I don't think it's been discussed yet. So far, delta is based around parsing default git output and unified diff output (which is very similar).

@HarrisonMc555
Copy link
Author

Lots of IDEs and GUI diff tools show differences side-by-side, instead of on different lines in a unified output like diff (and git diff) do by output. In addition, there are several command-line tools, such as sdiff and icdiff.

Do you think you would ever consider something like that? It may be out of the scope of this project, which I would completely understand. But I figured I would ask 😄

@dandavison
Copy link
Owner

dandavison commented Jan 17, 2020

Hi @HarrisonMc555, thanks! OK, so, delta doesn't have access to the original files being compared: what delta is is a tool for applying syntax highlighting to the output of diff programs (such as git and diff -u). In addition to simple syntax highlighting, it tries to do some fancy string-comparison edit inference, and restructures the git output a bit for readability.

So delta itself would not generate the side-by-side view (it can't, it doesn't have access to the original files). Delta could however process the output of a program such as sdiff or icdiff, to add syntax highlighting etc. (Git can be configured to use an arbitrary executable for its diffs as explained in this SO post). This would require writing a new module for parsing those new sorts of inputs, so it would be quite a major addition, and I don't think I will be doing it personally.

OK, here's a question. I wonder whether, rather than using delta, there's a solution that uses bat to do the syntax highlighting in combination with sdiff or icdiff? These naive attempts didn't seem to work, but do you think something in this direction could work?

sdiff  <(bat --plain --color=always a.py) <(bat --plain --color=always b.py)
icdiff <(bat --plain --color=always a.py) <(bat --plain --color=always b.py)

image

Ref jeffkaufman/icdiff#133

@HarrisonMc555
Copy link
Author

Thanks for your response! I'll have to think about it for a bit. Thanks for your help!

@dandavison
Copy link
Owner

No problem, I'll close this for now, but feel free to add any further thoughts.

@Dentrax
Copy link

Dentrax commented Feb 19, 2020

@dandavison I strongly agree @HarrisonMc555 's idea. This feature would be so awesome with this amazing tool. icdiff have this side-by-side feature, we can also add a option like that called: --side-by-side, which would be so great. ;)

@dandavison
Copy link
Owner

Thanks @Dentrax and @HarrisonMc555. I think I said something wrong above. It's possible for delta to construct a side-by-side view without access to the original files. I agree that this is a feature that would very much make sense.

@dandavison dandavison reopened this Apr 27, 2020
@panchalkalpesh
Copy link

+1 👍
We (developers) often have a wider screen which can accommodate side-by-side view.
Definitely a nice feature to have as it increases the usability of this tool.

@Dentrax Thanks for sharing, quite interesting.

@mscottnelson
Copy link

@dandavison would you like any help with this issue? not making any promises but I'd be interested in looking into it

@dandavison
Copy link
Owner

dandavison commented Jun 17, 2020

@mscottnelson thanks, that would be great! So I'll give you a bit of time to take a look at what needs to be done -- I won't do anything in this area without pinging you on this ticket first.

I'm currently working on getting the next release out (0.2.0). But let's not try to include this feature in that release -- we can release this when it's ready. I'm excited about this feature, but there's also no shortage of other delta improvements for me to work on, so very happy for others to take features like this. I believe that the recent changes in master have put us in a decent position to implement this. For example, line numbers have been added to delta by @clnoll in #190 (and open PR #219), and they have a left and right column of numbers that should fit naturally into the left and right split in side-by-side view.

@dandavison
Copy link
Owner

@mscottnelson are you still thinking of working on this or should we consider it open again?

@dandavison
Copy link
Owner

dandavison commented Jul 8, 2020

@mscottnelson I'm (probably!) going to have a go at this. Let me know if you've already started work on it. doing this.

dandavison added a commit that referenced this issue Jul 9, 2020
dandavison added a commit that referenced this issue Jul 9, 2020
@mscottnelson
Copy link

@dandavison Great! sorry for the poor communication. Thanks for being so awesome/proactive!

dandavison added a commit that referenced this issue Jul 10, 2020
dandavison added a commit that referenced this issue Jul 10, 2020
dandavison added a commit that referenced this issue Jul 10, 2020
dandavison added a commit that referenced this issue Jul 10, 2020
dandavison added a commit that referenced this issue Jul 10, 2020
dandavison added a commit that referenced this issue Jul 10, 2020
dandavison added a commit that referenced this issue Jul 10, 2020
dandavison added a commit that referenced this issue Jul 10, 2020
dandavison added a commit that referenced this issue Jul 11, 2020
dandavison added a commit that referenced this issue Jul 11, 2020
dandavison added a commit that referenced this issue Jul 11, 2020
@Dentrax
Copy link

Dentrax commented Jul 11, 2020

Thank you so much for such a great job! @dandavison

@dandavison
Copy link
Owner

dandavison commented Jul 11, 2020

Side-by-side diff view has been released (delta 0.3.0). It has a section in the README, but basically you use

[delta]
    side-by-side = true

or the equivalent command-line flags -s or --side-by-side.

image
image

It can be combined with any other options, such as diff-highlight or diff-so-fancy emulation.

cc @Amorymeltzer, @Avi-D-coder, @Kr1ss-XD, @marcoieni, @RobbieClarken, @Valloric, @crash-g, @jeffkaufman, @jwatt, @kenchan0130, @kyohsuke, @lightspeedbriefs, @madnight, @maricn, @mosic, @mscottnelson, @navarroaxel, @nemonweb, @panchalkalpesh, @softoika, @wataash, @zdenekkostal

(Thanks @Dentrax!)

@navarroaxel
Copy link
Contributor

This feature really rocks! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants