vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 499be2909e03338bcc9bfd5dae31f79d6ca56289
parent 13ed621e7c0b66ea7d1496956ad8306d7a4bd7e7
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue,  4 Apr 2017 08:14:03 +0200

vis: automatically dispose invalid cursors

Diffstat:
Mvis.c | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/vis.c b/vis.c @@ -838,7 +838,14 @@ void vis_do(Vis *vis) { for (Cursor *cursor = view_cursors(view), *next; cursor; cursor = next) { next = view_cursors_next(cursor); + size_t pos = view_cursors_pos(cursor); + if (pos == EPOS) { + if (!view_cursors_dispose(cursor)) + view_cursors_to(cursor, 0); + continue; + } + Register *reg = multiple_cursors ? view_cursors_register(cursor) : a->reg; if (!reg) reg = &vis->registers[file->internal ? VIS_REG_PROMPT : VIS_REG_DEFAULT];