1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-23 15:23:29 +03:00

Support count argument for [s and ]s

Part of #795
This commit is contained in:
Johannes Altmanninger 2020-07-19 21:48:52 +02:00
parent 98a1afcab0
commit 266fe6f659
19 changed files with 73 additions and 44 deletions

View File

@ -494,7 +494,10 @@ select_sentence(const Context& context, const Selection& selection,
auto& buffer = context.buffer();
BufferIterator first = buffer.iterator_at(selection.cursor());
BufferIterator last;
for (++count; count > 0; --count)
{
if (not (flags & ObjectFlags::ToEnd) and first != buffer.begin())
{
BufferIterator prev_non_blank = first-1;
@ -504,7 +507,8 @@ select_sentence(const Context& context, const Selection& selection,
first = prev_non_blank;
}
BufferIterator last = first;
if (last == BufferIterator{})
last = first;
if (flags & ObjectFlags::ToBegin)
{
@ -548,6 +552,7 @@ select_sentence(const Context& context, const Selection& selection,
--last;
}
}
}
return (flags & ObjectFlags::ToEnd) ? Selection{first.coord(), last.coord()}
: Selection{last.coord(), first.coord()};
}

View File

@ -0,0 +1 @@
2}s

View File

@ -0,0 +1 @@
%(a b) c. d e. f.

View File

@ -0,0 +1 @@
'a b c. d e. '

View File

@ -0,0 +1 @@
<a-;>2]s

View File

@ -0,0 +1 @@
%(a b) c. d e. f g.

View File

@ -0,0 +1 @@
'a b c. d e. '

View File

@ -0,0 +1 @@
9]s

View File

@ -0,0 +1,3 @@
a b.
c d.

View File

@ -0,0 +1 @@
'a b.'

View File

@ -0,0 +1 @@
<a-;>2{s

View File

@ -0,0 +1 @@
a b. c d. e %(f g)

View File

@ -0,0 +1 @@
'c d. e f g'

View File

@ -0,0 +1 @@
2[s

View File

@ -0,0 +1 @@
a b. c d. e %(f)

View File

@ -0,0 +1 @@
'c d. e f'

View File

@ -0,0 +1 @@
9[s

View File

@ -0,0 +1,3 @@
a b.
c d. %(e) f.

View File

@ -0,0 +1,3 @@
'a b.
c d.'