From a383ce3045f7f397ae6f0f34cb5642513a679958 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 21 Oct 2018 11:49:30 +1100 Subject: [PATCH] Fix LineRangeSet::udpate not updating some traling ranges correctly Fixes #2499 --- src/highlighters.cc | 5 +++-- test/regression/2499-html-regions-assert/cmd | 1 + test/regression/2499-html-regions-assert/in | 16 ++++++++++++++++ test/regression/2499-html-regions-assert/rc | 3 +++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 test/regression/2499-html-regions-assert/cmd create mode 100644 test/regression/2499-html-regions-assert/in create mode 100644 test/regression/2499-html-regions-assert/rc diff --git a/src/highlighters.cc b/src/highlighters.cc index 2a67375c1..bcc526f30 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1802,7 +1802,7 @@ struct LineRangeSet : private Vector const auto diff = (modif_beg-1)->diff(); it->begin += diff; it->end += diff; - break; + continue; } 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({5, 10}, expect({{5, 10}})); ranges.add_range({15, 20}, expect({{15, 20}})); + ranges.add_range({25, 30}, expect({{25, 30}})); ranges.update(ConstArrayView{{2, 2, 3, 0}}); - kak_assert((ranges.view() == ConstArrayView{{0, 1}, {2, 7}, {12, 17}})); + kak_assert((ranges.view() == ConstArrayView{{0, 1}, {2, 7}, {12, 17}, {22, 27}})); } }}; diff --git a/test/regression/2499-html-regions-assert/cmd b/test/regression/2499-html-regions-assert/cmd new file mode 100644 index 000000000..6ce83ed74 --- /dev/null +++ b/test/regression/2499-html-regions-assert/cmd @@ -0,0 +1 @@ +jjjJJd diff --git a/test/regression/2499-html-regions-assert/in b/test/regression/2499-html-regions-assert/in new file mode 100644 index 000000000..425f0a96e --- /dev/null +++ b/test/regression/2499-html-regions-assert/in @@ -0,0 +1,16 @@ + + + +
+ +
+ +
+ Test 1 +
+ +
+ Test 2 +
+ + diff --git a/test/regression/2499-html-regions-assert/rc b/test/regression/2499-html-regions-assert/rc new file mode 100644 index 000000000..5756ea1a4 --- /dev/null +++ b/test/regression/2499-html-regions-assert/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/base/html.kak" +set buffer filetype html