diff --git a/src/selectors.cc b/src/selectors.cc index d4246ee5..f6ca36ca 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -60,7 +60,7 @@ bool skip_while(BufferIterator& it, T condition) { while (not it.is_end() and condition(*it)) ++it; - return condition(*it); + return not it.is_end() and condition(*it); } template @@ -68,7 +68,7 @@ bool skip_while_reverse(BufferIterator& it, T condition) { while (not it.is_begin() and condition(*it)) --it; - return condition(*it); + return not it.is_end() and condition(*it); } SelectionAndCaptures select_to_next_word(const Selection& selection)