From 1a4737cd20fcb6b7056398d1a0fa583a6e1542e7 Mon Sep 17 00:00:00 2001 From: potatoalienof13 Date: Sat, 17 Dec 2022 15:29:56 -0500 Subject: [PATCH] should not succeed when run on the first character of a file. --- src/selectors.cc | 9 +++++++++ 1 file changed, 9 insertions(+) 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