aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-03-22 09:48:08 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-03-22 10:19:13 +0100
commitfe5ec23a644ac12c6cf7ac3ec1618094db705018 (patch)
tree7abfd904f72e166ac716f14fd9553e7ffa922796
parentad857484fe02d39d08b62c16c32ad2bb4aeba30d (diff)
downloadvis-fe5ec23a644ac12c6cf7ac3ec1618094db705018.tar.gz
vis-fe5ec23a644ac12c6cf7ac3ec1618094db705018.tar.xz
vis: fix wrap around with <C-n>
Do not create an invalid cursor when no further match exists.
-rw-r--r--main.c2
1 files changed, 2 insertions, 0 deletions
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);