Merge remote-tracking branch 'krobelus/fix-_-at_multibyte_chars'
This commit is contained in:
commit
d39930cd10
|
@ -1768,6 +1768,7 @@ void spaces_to_tabs(Context& context, NormalParams params)
|
||||||
|
|
||||||
void trim_selections(Context& context, NormalParams)
|
void trim_selections(Context& context, NormalParams)
|
||||||
{
|
{
|
||||||
|
using Utf8It = utf8::iterator<BufferIterator>;
|
||||||
auto& buffer = context.buffer();
|
auto& buffer = context.buffer();
|
||||||
ScopedSelectionEdition selection_edition{context};
|
ScopedSelectionEdition selection_edition{context};
|
||||||
auto& selections = context.selections();
|
auto& selections = context.selections();
|
||||||
|
@ -1776,8 +1777,8 @@ void trim_selections(Context& context, NormalParams)
|
||||||
for (int i = 0; i < (int)selections.size(); ++i)
|
for (int i = 0; i < (int)selections.size(); ++i)
|
||||||
{
|
{
|
||||||
auto& sel = selections[i];
|
auto& sel = selections[i];
|
||||||
auto beg = buffer.iterator_at(sel.min());
|
auto beg = Utf8It{buffer.iterator_at(sel.min()), buffer};
|
||||||
auto end = buffer.iterator_at(sel.max());
|
auto end = Utf8It{buffer.iterator_at(sel.max()), buffer};
|
||||||
while (beg != end and is_blank(*beg))
|
while (beg != end and is_blank(*beg))
|
||||||
++beg;
|
++beg;
|
||||||
while (beg != end and is_blank(*end))
|
while (beg != end and is_blank(*end))
|
||||||
|
@ -1787,8 +1788,8 @@ void trim_selections(Context& context, NormalParams)
|
||||||
to_remove.push_back(i);
|
to_remove.push_back(i);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sel.min() = beg.coord();
|
sel.min() = beg.base().coord();
|
||||||
sel.max() = end.coord();
|
sel.max() = end.base().coord();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
test/regression/4887-torn-utf8-sequence/cmd
Normal file
1
test/regression/4887-torn-utf8-sequence/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
:exec %{<percent>cç<lt>esc>x_<semicolon>iab<lt>esc>}<ret>
|
0
test/regression/4887-torn-utf8-sequence/in
Normal file
0
test/regression/4887-torn-utf8-sequence/in
Normal file
1
test/regression/4887-torn-utf8-sequence/out
Normal file
1
test/regression/4887-torn-utf8-sequence/out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
abç
|
Loading…
Reference in New Issue
Block a user