We’re working on a CodeMirror side-by-side diff viewer similar to github’s view which we’re hoping to open source
The way we’re approaching this is by having an editor on the left and an editor on the right. Coloring lines is pretty straight forward, a simple line decoration does the job.
Another feature, if there’s a diff that makes one side longer than the other we need to pad the shorter side with empty lines. Our first pass was to use a widget that adds a dom node to pad the line. This kind of works but it has shortcomings:
- Being inside
cm-linemeans that the padding will inherit things like the background color from the line node, and getting around that is quite annoying
- If the line difference between both sides is at the very first line then we end up with the
1in the gutter far from the content
Is it possible to add dom nodes/breaks between
cm-lines instead of inside using decorations, or some other non-hacky method?