summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibDiff/Generator.cpp
AgeCommit message (Collapse)Author
2022-03-08LibDiff: Generate hunks for new/deleted filesDaniel Bertalan
Previously we would fail to generate any hunks if the old or the new file was empty. We now do, with the original/target line index set to 0, as specified by POSIX.
2022-02-09LibDiff: Flush leftover hunks at the endItamar
This change makes sure that we arrive at the end of the "DP-matrix" and flush any leftover hunks to get a complete diff result.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-09-24LibDiff: Coalesce adjacent changes into the same HunkMustafa Quraish
Now we keep track of the "current" hunk, and only create a new one if there's at least a single unmodified lines between changes.
2021-09-24LibDiff: Perform diffing-algorithm in reverse orderMustafa Quraish
Previously the algorithm was being performed from the start of the string to the end, which was a little more convenient when writing the code, but made it more annoying to be able to properly talk about the "start" of where the changes were happening, since we can only re-construct the changes in reverse order of the initial traversal. Basically, doing the initial pass in reverse lets us reconstruct the hunks in the correct order to begin with, and not have to worry about reversing the hunks / lines within the hunks
2021-09-17LibDiff: Add new API to generate hunks from two pieces of textMustafa Quraish
For now this is just a standard implementation of the longest common subsequence algorithm over the lines, except that it doesn't do any coalescing of the lines. This isn't really ideal since we get a single Hunk per changed line, and is definitely something to improve in the future.