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

Word diffing #56

Open
rwarren opened this issue Oct 4, 2018 · 4 comments
Open

Word diffing #56

rwarren opened this issue Oct 4, 2018 · 4 comments

Comments

@rwarren
Copy link

rwarren commented Oct 4, 2018

diff-match-patch supports word diffing and not just line diffing:

https://github.com/google/diff-match-patch/wiki/Line-or-Word-Diffs

Any plan to implement visualizations for word diffing, and not just line diffing?

@JackuB
Copy link
Collaborator

JackuB commented Oct 8, 2018

Yea, had a local branch where I was playing with it, but word diff is really good when you are just reading it. Once you start editing it, you get colors flashing all over the place after every keystroke, because the changes can switch between "just a few characters on this line changed" to "this whole block is different".

If something, this might be cool with 2 editors on sides and a diff view (like GitHub's unified) in the middle. If anyone have any ideas/proposal how to solve that throw it here - but tbh I haven't spent too much time on that yet. First I'd like to solve the UI here #48 then we can think about adding a 3rd panel with word diff/3way merge.

@rwarren
Copy link
Author

rwarren commented Nov 7, 2018

Although 3way diff/merge support would certainly be awesome, just having a simple two file diff with word diffing would be excellent.

A lot of editor use cases (like mine) can definitely benefit from a basic diffing view (with word diffs) between versions, without the need for full 3way. Right now, in order to get word-level diffing, we need to jump to a different UX with something like diff2html. It would obviously be better to be able to keep the appearances the same in the UI and use Ace for all of 1) file editing, 2) file viewing, and 3) file diffing.

As for the comment about "colors flashing all over the place", I don't understand why this would happen for a single line edit. Is this some weird artifact of the way diff-match-patch does things? For comparison, I often use Meld for live editing and if you experiment with that UI (new file comparison -> blank comparison) there is no crazy flashing. It works well: New characters are highlighted as you type on one side, and deleted characters are highlighted on the other side as you delete.

Aside from the fact that read-only diff viewing support would be great in Ace (avoiding the flashing issue), if the diff engine is causing weird line/block issues while editing, an easy way out of this that might work is to simply disable diff highlighting while editing a line, and re-enable highlighting when you leave the line. Just an idea.

@rwarren
Copy link
Author

rwarren commented Nov 7, 2018

I understand the line vs block flashing now after experimenting with this demo page. That is admittedly weird. I wonder if the same would happen with word diffing? Seems like a diff-match-patch quirk.

@kunalkakade
Copy link

any update on the word diff ?

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

No branches or pull requests

3 participants