summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibDiff
AgeCommit message (Collapse)Author
2022-12-20LibDiff: Make Diff::generate_only_additions take text as StringViewKarol Kosek
2022-12-06Everywhere: Rename to_{string => deprecated_string}() where applicableLinus Groh
This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
2022-11-01Everywhere: Explicitly link all binaries against the LibC targetTim Schumacher
Even though the toolchain implicitly links against -lc, it does not know where it should get LibC from except for the sysroot. In the case of Clang this causes it to pick up the LibC stub instead, which might be slightly outdated and feature missing symbols. This is currently not an issue that manifests because we pass through the dependency on LibC and other libraries by accident, which causes CMake to link against the LibC target (instead of just the library), and thus points the linker at the build output directory. Since we are looking to fix that in the upcoming commits, let's make sure that everything will still be able to find the proper LibC first.
2022-10-24AK+Everywhere: Turn bool keep_empty to an enum in split* functionsdemostanis
2022-04-01Everywhere: Run clang-formatIdan Horowitz
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-12-31LibDiff: Fix error when parsing a 'new' hunk locationConor Byrne
If the location started at 0, and / or the length was 0, it would originally turn out to be a location of { -1, -1 } when LibDiff was finished parsing, which was incorrect. To fix this, we only subtract 1 if `start` or `length` isn't 0.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-10AK+Everywhere: Stop including Vector.h from StringView.hAndreas Kling
Preparation for using Error.h from Vector.h. This required moving some things out of line.
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.
2021-05-24AK+Everywhere: Consolidate String::index_of() and String::find()Andreas Kling
We had two functions for doing mostly the same thing. Combine both of them into String::find() and use that everywhere. Also add some tests to cover basic behavior.
2021-05-07LibDiff: Convert StringBuilder::appendf() => AK::FormatAndreas Kling
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-25Everywhere: Debug macros instead of constexpr.asynts
This was done with the following script: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
2021-01-22Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling