diff --git a/src/selectors.cc b/src/selectors.cc index baa2d9ac..c7e126b3 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -560,7 +560,7 @@ select_paragraph(const Context& context, const Selection& selection, BufferIterator first = buffer.iterator_at(selection.cursor()); if (not (flags & ObjectFlags::ToEnd) and first.coord() > BufferCoord{0,1} and - is_eol(*(first-1)) and is_eol(*(first-2))) + is_eol(*(first-1)) and first-1 != buffer.begin() and is_eol(*(first-2))) --first; else if ((flags & ObjectFlags::ToEnd) and first != buffer.begin() and (first+1) != buffer.end() and diff --git a/test/regression/3489-crash-on-paragraph-begin/cmd b/test/regression/3489-crash-on-paragraph-begin/cmd new file mode 100644 index 00000000..957dd0c1 --- /dev/null +++ b/test/regression/3489-crash-on-paragraph-begin/cmd @@ -0,0 +1 @@ +jp diff --git a/test/regression/3489-crash-on-paragraph-begin/in b/test/regression/3489-crash-on-paragraph-begin/in new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/test/regression/3489-crash-on-paragraph-begin/in @@ -0,0 +1,2 @@ + + diff --git a/test/regression/3489-crash-on-paragraph-begin/kak_selection_desc b/test/regression/3489-crash-on-paragraph-begin/kak_selection_desc new file mode 100644 index 00000000..ac6a6d5b --- /dev/null +++ b/test/regression/3489-crash-on-paragraph-begin/kak_selection_desc @@ -0,0 +1 @@ +2.1,1.1