diff --git a/src/selectors.hh b/src/selectors.hh index 462b188f..f9be9247 100644 --- a/src/selectors.hh +++ b/src/selectors.hh @@ -94,9 +94,8 @@ Selection select_to_previous_word(const Buffer& buffer, const Selection& selecti skip_while_reverse(begin, buffer.begin(), [](Codepoint c){ return is_eol(c); }); Utf8Iterator end = begin; - skip_while_reverse(end, buffer.begin(), is_horizontal_blank); - bool with_end = false; + bool with_end = skip_while_reverse(end, buffer.begin(), is_horizontal_blank); if (word_type == Word and is_punctuation(*end)) with_end = skip_while_reverse(end, buffer.begin(), is_punctuation); diff --git a/test/regression/844-prev-word-at-buffer-start/cmd b/test/regression/844-prev-word-at-buffer-start/cmd new file mode 100644 index 00000000..e0b3f1b0 --- /dev/null +++ b/test/regression/844-prev-word-at-buffer-start/cmd @@ -0,0 +1 @@ +bb diff --git a/test/regression/844-prev-word-at-buffer-start/in b/test/regression/844-prev-word-at-buffer-start/in new file mode 100644 index 00000000..ce10d429 --- /dev/null +++ b/test/regression/844-prev-word-at-buffer-start/in @@ -0,0 +1 @@ + %(word) diff --git a/test/regression/844-prev-word-at-buffer-start/selections b/test/regression/844-prev-word-at-buffer-start/selections new file mode 100644 index 00000000..1a4baf53 --- /dev/null +++ b/test/regression/844-prev-word-at-buffer-start/selections @@ -0,0 +1 @@ +