summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpotatoalienof13 <potatoalienof13@gmail.com>2022-12-17 15:29:56 -0500
committerpotatoalienof13 <potatoalienof13@gmail.com>2022-12-25 17:57:28 -0500
commit1a4737cd20fcb6b7056398d1a0fa583a6e1542e7 (patch)
tree38e0b5d8f8667bbd6ed86c750ffc2bbf80083a1a /src
parent86bd4efd258a3e51245f5a6fcca9ee19790dee6e (diff)
<a-t> should not succeed when run on the first character of a file.
Diffstat (limited to 'src')
-rw-r--r--src/selectors.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/selectors.cc b/src/selectors.cc
index 3d9b453d..febcde78 100644
--- a/src/selectors.cc
+++ b/src/selectors.cc
@@ -420,6 +420,15 @@ select_to_reverse(const Context& context, const Selection& selection,
Codepoint c, int count, bool inclusive)
{
auto& buffer = context.buffer();
+
+ // if we are selecting backwards from the beginning of the buffer,
+ // there is nothing more that can be selected.
+ // Unless its inclusive, in which its possible that the current
+ // location of the cursor contains the Codepoint being looked for.
+ if(!inclusive && selection.cursor() == buffer.begin()){
+ return {};
+ }
+
Utf8Iterator begin{buffer.iterator_at(selection.cursor()), buffer};
Utf8Iterator end = begin;
do