mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-27 12:16:22 +03:00
parent
98a1afcab0
commit
266fe6f659
@ -494,7 +494,10 @@ select_sentence(const Context& context, const Selection& selection,
|
|||||||
|
|
||||||
auto& buffer = context.buffer();
|
auto& buffer = context.buffer();
|
||||||
BufferIterator first = buffer.iterator_at(selection.cursor());
|
BufferIterator first = buffer.iterator_at(selection.cursor());
|
||||||
|
BufferIterator last;
|
||||||
|
|
||||||
|
for (++count; count > 0; --count)
|
||||||
|
{
|
||||||
if (not (flags & ObjectFlags::ToEnd) and first != buffer.begin())
|
if (not (flags & ObjectFlags::ToEnd) and first != buffer.begin())
|
||||||
{
|
{
|
||||||
BufferIterator prev_non_blank = first-1;
|
BufferIterator prev_non_blank = first-1;
|
||||||
@ -504,7 +507,8 @@ select_sentence(const Context& context, const Selection& selection,
|
|||||||
first = prev_non_blank;
|
first = prev_non_blank;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferIterator last = first;
|
if (last == BufferIterator{})
|
||||||
|
last = first;
|
||||||
|
|
||||||
if (flags & ObjectFlags::ToBegin)
|
if (flags & ObjectFlags::ToBegin)
|
||||||
{
|
{
|
||||||
@ -548,6 +552,7 @@ select_sentence(const Context& context, const Selection& selection,
|
|||||||
--last;
|
--last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (flags & ObjectFlags::ToEnd) ? Selection{first.coord(), last.coord()}
|
return (flags & ObjectFlags::ToEnd) ? Selection{first.coord(), last.coord()}
|
||||||
: Selection{last.coord(), first.coord()};
|
: Selection{last.coord(), first.coord()};
|
||||||
}
|
}
|
||||||
|
1
test/normal/object/end-extending/sentence/count/cmd
Normal file
1
test/normal/object/end-extending/sentence/count/cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
2}s
|
1
test/normal/object/end-extending/sentence/count/in
Normal file
1
test/normal/object/end-extending/sentence/count/in
Normal file
@ -0,0 +1 @@
|
|||||||
|
%(a b) c. d e. f.
|
@ -0,0 +1 @@
|
|||||||
|
'a b c. d e. '
|
1
test/normal/object/end/sentence/count/cmd
Normal file
1
test/normal/object/end/sentence/count/cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
<a-;>2]s
|
1
test/normal/object/end/sentence/count/in
Normal file
1
test/normal/object/end/sentence/count/in
Normal file
@ -0,0 +1 @@
|
|||||||
|
%(a b) c. d e. f g.
|
@ -0,0 +1 @@
|
|||||||
|
'a b c. d e. '
|
1
test/normal/object/end/sentence/to-buffer-end/cmd
Normal file
1
test/normal/object/end/sentence/to-buffer-end/cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
9]s
|
3
test/normal/object/end/sentence/to-buffer-end/in
Normal file
3
test/normal/object/end/sentence/to-buffer-end/in
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
a b.
|
||||||
|
|
||||||
|
c d.
|
@ -0,0 +1 @@
|
|||||||
|
'a b.'
|
1
test/normal/object/start-extending/sentence/count/cmd
Normal file
1
test/normal/object/start-extending/sentence/count/cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
<a-;>2{s
|
1
test/normal/object/start-extending/sentence/count/in
Normal file
1
test/normal/object/start-extending/sentence/count/in
Normal file
@ -0,0 +1 @@
|
|||||||
|
a b. c d. e %(f g)
|
@ -0,0 +1 @@
|
|||||||
|
'c d. e f g'
|
1
test/normal/object/start/sentence/count/cmd
Normal file
1
test/normal/object/start/sentence/count/cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
2[s
|
1
test/normal/object/start/sentence/count/in
Normal file
1
test/normal/object/start/sentence/count/in
Normal file
@ -0,0 +1 @@
|
|||||||
|
a b. c d. e %(f)
|
@ -0,0 +1 @@
|
|||||||
|
'c d. e f'
|
1
test/normal/object/start/sentence/to-buffer-begin/cmd
Normal file
1
test/normal/object/start/sentence/to-buffer-begin/cmd
Normal file
@ -0,0 +1 @@
|
|||||||
|
9[s
|
3
test/normal/object/start/sentence/to-buffer-begin/in
Normal file
3
test/normal/object/start/sentence/to-buffer-begin/in
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
a b.
|
||||||
|
|
||||||
|
c d. %(e) f.
|
@ -0,0 +1,3 @@
|
|||||||
|
'a b.
|
||||||
|
|
||||||
|
c d.'
|
Loading…
Reference in New Issue
Block a user