aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-04-04 08:14:03 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-04-04 08:14:03 +0200
commitdd730eb1feb46e9688350b0ff401694653f90554 (patch)
tree659630ee90a50c81ed9d826bb944187b3ebf0c61 /vis.c
parent2cfaf219558dd730478e4c5e27376091b617a50f (diff)
downloadvis-dd730eb1feb46e9688350b0ff401694653f90554.tar.gz
vis-dd730eb1feb46e9688350b0ff401694653f90554.tar.xz
vis: automatically dispose invalid cursors
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vis.c b/vis.c
index c530628..51cd9da 100644
--- 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];