xaizek / zograscope (License: AGPLv3 only) (since 2018-12-07)
Mainly a syntax-aware diff that also provides a number of additional tools.
Commit 5f1bc1fe40b57677ecbf75e22bf5671d6467763d

Fix moved color taking precedence over renamed one
After a change in 45886d9ceff669995726196950e889d0e6a6a798:

Color background of moved diffable as moved

Otherwise they stand out among other moved modes.
Author: xaizek
Author date (UTC): 2022-07-25 13:23
Committer name: xaizek
Committer date (UTC): 2022-07-25 13:23
Parent(s): 31813a3284a07a572c246ba19b5046e015c78f3d
Signing key: 99DC5E4DB05F6BE2
Tree: f43541627ea1b20e786683b510a91982601d83df
File Lines added Lines deleted
src/Highlighter.cpp 3 3
tests/Highlighter.cpp 37 0
File src/Highlighter.cpp changed (mode: 100644) (index 5a26594..5a37651)
... ... Highlighter::diffSpelling(const Node &node, bool moved)
559 559
560 560 // Unchanged parts are highlighted using this color group. // Unchanged parts are highlighted using this color group.
561 561 ColorGroup def = ColorGroup::None; ColorGroup def = ColorGroup::None;
562 if (moved) {
563 def = ColorGroup::Moved;
564 } else if (!transparentDiffables && surround) {
562 if (!transparentDiffables && surround) {
565 563 def = ColorGroup::PieceUpdated; def = ColorGroup::PieceUpdated;
564 } else if (moved) {
565 def = ColorGroup::Moved;
566 566 } }
567 567
568 568 for (const auto &x : diff.getSes().getSequence()) { for (const auto &x : diff.getSes().getSequence()) {
File tests/Highlighter.cpp changed (mode: 100644) (index 2f43dd8..d7ed0f4)
... ... TEST_CASE("Non-transparent diffables have background filled", "[highlighter]")
148 148 newHi.setTransparentDiffables(false); newHi.setTransparentDiffables(false);
149 149 CHECK(newHi.print() == "// aa bb {+dd+}"); CHECK(newHi.print() == "// aa bb {+dd+}");
150 150 } }
151
152 TEST_CASE("Rename highligh has priority over move", "[highlighter]")
153 {
154 Tree oldTree = parseC(R"(
155 void f() {
156 int var;
157 if (condition) {
158 }
159 }
160 )", true);
161 Tree newTree = parseC(R"(
162 void f() {
163 if (condition) {
164 int varr;
165 }
166 }
167 )", true);
168
169 TimeReport tr;
170 compare(oldTree, newTree, tr, true, false);
171
172 TermHighlighter oldHi(oldTree, true);
173 CHECK(oldHi.print() == R"(
174 void f() {
175 {:int:}{: :}{~var~}{:;:}
176 if (condition) {
177 }
178 })");
179
180 TermHighlighter newHi(newTree, false);
181 CHECK(newHi.print() == R"(
182 void f() {
183 if (condition) {
184 {:int:}{: :}{~var~}{+r+}{:;:}
185 }
186 })");
187 }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/zograscope

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/zograscope

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master