decomp.me
decomp.me copied to clipboard
Three-way diffs
Easiest done JS-side. I guess we'll want to diff against the asm of the code that's been saved?
Easiest done JS-side.
This would require writing the diffing algorithm in JS too, no? Right now the frontend literally just spits out the HTML that diff.py on the server gives it, with no idea about the contents.
Yep. But we can make do with a very simple algorithm:
- line up the LHS's of the two diffs with each other
- for chunks between lined-up parts, with diff lines that lack LHS, line both chunks up top-to-bottom
- to check whether two RHS's are equal, just do a string comparison
I'm hoping to make the last step a bit more complex on diff.py's side so it compares branch targets in a better way; if I do I'll make sure the HTML row gets an attribute with the compare key.
Oh, I see... you mean remember the very first diff.py result and compare against that! I assumed something a little crazier (that is, running objdump in the browser) :shipit:
I like this, sounds not-too-difficult to do.
yep
the very first diff.py result
or rather, the diff.py result of the last-saved scratch version. So you have a chance to update what you're interdiffing against, similar to how you'd restart diff.py regularly when using -b.
Ah, I see. Comparing it against the saved version is better, yes. If we ever added a kind of version history feature it would work with that, too, which would be awesome.
The frontend supports three-way diffs already; the server just needs to return JSON with previous
keys.