diff --git a/src/selectors.cc b/src/selectors.cc index 3775cd5e..a11a200d 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -359,7 +359,7 @@ find_surrounding(const Container& container, Iterator pos, first = (flags & ObjectFlags::Inner) ? res->second : res->first; if (flags & ObjectFlags::ToEnd) // ensure we find the matching end { - last = res->second; + last = res->first; level = 0; } } diff --git a/test/regression/2129-inside-parentheses/cmd b/test/regression/2129-inside-parentheses/cmd new file mode 100644 index 00000000..4509b477 --- /dev/null +++ b/test/regression/2129-inside-parentheses/cmd @@ -0,0 +1 @@ +b diff --git a/test/regression/2129-inside-parentheses/in b/test/regression/2129-inside-parentheses/in new file mode 100644 index 00000000..ea6dcaf3 --- /dev/null +++ b/test/regression/2129-inside-parentheses/in @@ -0,0 +1 @@ +((a+b)%(/)(a-b)) diff --git a/test/regression/2129-inside-parentheses/selections b/test/regression/2129-inside-parentheses/selections new file mode 100644 index 00000000..3f9324e8 --- /dev/null +++ b/test/regression/2129-inside-parentheses/selections @@ -0,0 +1 @@ +'(a+b)/(a-b)' diff --git a/test/regression/2367-surround-with-tight-nesting/cmd b/test/regression/2367-surround-with-tight-nesting/cmd new file mode 100644 index 00000000..d567e3bd --- /dev/null +++ b/test/regression/2367-surround-with-tight-nesting/cmd @@ -0,0 +1 @@ +r diff --git a/test/regression/2367-surround-with-tight-nesting/in b/test/regression/2367-surround-with-tight-nesting/in new file mode 100644 index 00000000..d728b88b --- /dev/null +++ b/test/regression/2367-surround-with-tight-nesting/in @@ -0,0 +1 @@ +%([)[a]b] [[c]d%(]) diff --git a/test/regression/2367-surround-with-tight-nesting/selections b/test/regression/2367-surround-with-tight-nesting/selections new file mode 100644 index 00000000..fb210438 --- /dev/null +++ b/test/regression/2367-surround-with-tight-nesting/selections @@ -0,0 +1 @@ +'[[a]b]' '[[c]d]'