vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 4d69468443ccad7636794041147f622464d5910f parent b60df84d8b3542ddf144d4faf49fe1e60cfb4557 Author: Marc André Tanner <mat@brain-dump.org> Date: Wed, 22 Mar 2017 09:48:08 +0100 vis: fix wrap around with <C-n> Do not create an invalid cursor when no further match exists. Diffstat:
| M | main.c | | | 2 | ++ |
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git 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);