parent
ae2ed21e07
commit
148d6c205b
|
@ -344,6 +344,7 @@ find_surrounding(const Container& container, Iterator pos,
|
|||
pos = matches[0].second;
|
||||
|
||||
auto first = pos;
|
||||
auto last = pos;
|
||||
if (flags & ObjectFlags::ToBegin)
|
||||
{
|
||||
// When positionned onto opening and searching to opening, search the parent one
|
||||
|
@ -353,12 +354,17 @@ find_surrounding(const Container& container, Iterator pos,
|
|||
first = utf8::previous(first, container.begin());
|
||||
|
||||
if (auto res = find_opening(first+1, container, opening, closing, level, nestable))
|
||||
{
|
||||
first = (flags & ObjectFlags::Inner) ? res->second : res->first;
|
||||
if (flags & ObjectFlags::ToEnd) // ensure we find the matching end
|
||||
{
|
||||
last = res->second;
|
||||
level = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
auto last = pos;
|
||||
if (flags & ObjectFlags::ToEnd)
|
||||
{
|
||||
// When positionned onto closing and searching to closing, search the parent one
|
||||
|
@ -1030,6 +1036,7 @@ UnitTest test_find_surrounding{[]()
|
|||
|
||||
s = "begin foo begin bar end end";
|
||||
check_equal(s.begin() + 6, "begin", "end", ObjectFlags::ToBegin | ObjectFlags::ToEnd, 0, s);
|
||||
check_equal(s.begin() + 22, "begin", "end", ObjectFlags::ToBegin | ObjectFlags::ToEnd, 0, "begin bar end");
|
||||
}};
|
||||
|
||||
}
|
||||
|
|
1
test/regression/2030-custom-selection-nesting/cmd
Normal file
1
test/regression/2030-custom-selection-nesting/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
<a-a>caa,cc<ret><a-a>caa,cc<ret>
|
1
test/regression/2030-custom-selection-nesting/in
Normal file
1
test/regression/2030-custom-selection-nesting/in
Normal file
|
@ -0,0 +1 @@
|
|||
aa aa %(bb) cc cc
|
1
test/regression/2030-custom-selection-nesting/selections
Normal file
1
test/regression/2030-custom-selection-nesting/selections
Normal file
|
@ -0,0 +1 @@
|
|||
aa aa bb cc cc
|
Loading…
Reference in New Issue
Block a user