search: fix distance to prev word calculation when final cursor was 0

This commit is contained in:
Daniel Eklöf 2019-08-30 19:42:48 +02:00
parent e8d187e4f3
commit 42714c51a9
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -267,7 +267,7 @@ distance_prev_word(const struct terminal *term)
}
assert(cursor == 0 || iswspace(term->search.buf[cursor]));
if (iswspace(term->search.buf[cursor]))
if (cursor > 0 && iswspace(term->search.buf[cursor]))
cursor++;
return term->search.cursor - cursor;