From fe5ec23a644ac12c6cf7ac3ec1618094db705018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 22 Mar 2017 09:48:08 +0100 Subject: vis: fix wrap around with Do not create an invalid cursor when no further match exists. --- main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index f9d1575..1b39ef7 100644 --- a/main.c +++ b/main.c @@ -1369,6 +1369,8 @@ static const char *cursors_select_next(Vis *vis, const char *keys, const Arg *ar sel = view_cursors_selection_get(view_cursors(view)); word = text_object_word_find_prev(txt, sel.start, buf); + if (!text_range_valid(&word)) + goto out; size_t pos = text_char_prev(txt, word.end); if ((cursor = view_cursors_new(view, pos))) { view_cursors_selection_set(cursor, &word); -- cgit v1.2.3