diff --git a/src/selectors.cc b/src/selectors.cc index a64380406..c7e126b39 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -560,11 +560,11 @@ 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 - *(first-1) == '\n' and *(first-2) == '\n') + 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 - *(first-1) == '\n' and *first == '\n') + is_eol(*(first-1)) and is_eol(*first)) ++first; BufferIterator last = first; 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 000000000..957dd0c19 --- /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 000000000..139597f9c --- /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 000000000..ac6a6d5b2 --- /dev/null +++ b/test/regression/3489-crash-on-paragraph-begin/kak_selection_desc @@ -0,0 +1 @@ +2.1,1.1