Open pinheadmz opened 4 years ago
This is absolutely fantastic, thanks for your contribution.
Things have been a bit hectic lately, but just wanted to let you know that I'm not ignoring your contribution, I appreciate it, and will try to find time to review/release it soon...
It would be really great if this PR could be included!
@pinheadmz is there a way I can get this PR already, without having to wait for it getting merged in the base branch?
@NicoLugil to develop this patch, I cloned the plugin directly into sublime text. In OSX, the location is here:
/Users/<USERNAME>/Library/Application\ Support/Sublime\ Text\ 3/Packages
Using a terminal, cd
to that directory then clone my branch of this repo:
git clone https://github.com/pinheadmz/SublimeDiffView -b syncpanels1
I think that may be all you need to do. It's been a while since I worked on this, you may have to install some python dependencies for the plugin, I can't remember.
Closes https://github.com/CJTozer/SublimeDiffView/issues/62
This PR adds two features that I really wanted for this plugin, especially when reviewing large PRs involving large files:
Space out the lines in the left and right diff comparison views to resemble the GitHub "side-by-side" comparison. Meaning, if a new line is added on the right, a one-line gap is inserted on the left to keep the remaining portions of both views lined up.
Synchronize the scrolling between the left and right views. Once a diff hunk is in view, I may want to scroll through the rest of the file for reference and keeping the two views in sync vertically is a big help.
I achieved the diff spacing by adding phantoms to the regions in each view to push the remainder of the file down the corresponding amount of space. This introduced some interesting issues, which I believe are caused by how
open_file
returnsview
s. In many cases, the phantoms were re-drawn and so the spacing would get doubled or tripled every time I navigated away and back to a certain diff. I suspect the current implementation withview.old_regions
here is not actually preventing regions from being re-drawn either (but that wouldn't be noticeable):https://github.com/CJTozer/SublimeDiffView/blob/17afe53e4a96c80f0a43093f5ea21d61c42a090b/parser/file_diff.py#L74-L79
I tried a few workarounds for this but ended up deciding that the unpredictable behavior was due to
sublime.TRANSIENT
so I removed that. You might not love this because it pops up tabs now for the opened files but I'm ok with it.This is a working MVP for my use case, I'm happy to make revisions or rebase and separate out the commits however you like.
using phantoms to space out the side-by-side diffs
sync scrolling (right view controls left view, left view can not scroll on its own)