1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-24 20:13:00 +03:00

Fix LineRangeSet::udpate not updating some traling ranges correctly

Fixes #2499
This commit is contained in:
Maxime Coste 2018-10-21 11:49:30 +11:00
parent da13b5f814
commit a383ce3045
4 changed files with 23 additions and 2 deletions

View File

@ -1802,7 +1802,7 @@ struct LineRangeSet : private Vector<LineRange, MemoryDomain::Highlight>
const auto diff = (modif_beg-1)->diff(); const auto diff = (modif_beg-1)->diff();
it->begin += diff; it->begin += diff;
it->end += diff; it->end += diff;
break; continue;
} }
const auto diff = modif_beg->new_line - modif_beg->old_line; const auto diff = modif_beg->new_line - modif_beg->old_line;
@ -2445,8 +2445,9 @@ UnitTest test_line_range_set{[]{
ranges.add_range({0, 1}, expect({{0, 1}})); ranges.add_range({0, 1}, expect({{0, 1}}));
ranges.add_range({5, 10}, expect({{5, 10}})); ranges.add_range({5, 10}, expect({{5, 10}}));
ranges.add_range({15, 20}, expect({{15, 20}})); ranges.add_range({15, 20}, expect({{15, 20}}));
ranges.add_range({25, 30}, expect({{25, 30}}));
ranges.update(ConstArrayView<LineModification>{{2, 2, 3, 0}}); ranges.update(ConstArrayView<LineModification>{{2, 2, 3, 0}});
kak_assert((ranges.view() == ConstArrayView<LineRange>{{0, 1}, {2, 7}, {12, 17}})); kak_assert((ranges.view() == ConstArrayView<LineRange>{{0, 1}, {2, 7}, {12, 17}, {22, 27}}));
} }
}}; }};

View File

@ -0,0 +1 @@
jjjJJ<a-x><c-l>d<c-l>

View File

@ -0,0 +1,16 @@
<html>
<head></head>
<body>
<div>
<input name="bar"/>
</div>
<div id="foo" class="bar">
Test 1
</div>
<div id="baz" class="fiz">
Test 2
</div>
</body>
</html>

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/base/html.kak"
set buffer filetype html