| 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 |
|
} |