diff --git a/src/selectors.cc b/src/selectors.cc index 92db5bdc..a6438040 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -515,7 +515,7 @@ select_sentence(const Context& context, const Selection& selection, char prev = *(first-1); if (not is_horizontal_blank(cur)) saw_non_blank = true; - if (is_eol(prev) and is_eol(cur)) + if (is_eol(prev) and is_eol(cur) and first + 1 != buffer.end()) { ++first; break; diff --git a/test/regression/3472-crash-on-to-sentence-start/cmd b/test/regression/3472-crash-on-to-sentence-start/cmd new file mode 100644 index 00000000..b2903486 --- /dev/null +++ b/test/regression/3472-crash-on-to-sentence-start/cmd @@ -0,0 +1 @@ +j[s diff --git a/test/regression/3472-crash-on-to-sentence-start/in b/test/regression/3472-crash-on-to-sentence-start/in new file mode 100644 index 00000000..442406aa --- /dev/null +++ b/test/regression/3472-crash-on-to-sentence-start/in @@ -0,0 +1,2 @@ +a + diff --git a/test/regression/3472-crash-on-to-sentence-start/kak_selection_desc b/test/regression/3472-crash-on-to-sentence-start/kak_selection_desc new file mode 100644 index 00000000..ac6a6d5b --- /dev/null +++ b/test/regression/3472-crash-on-to-sentence-start/kak_selection_desc @@ -0,0 +1 @@ +2.1,1.1