return ret;
}
-static void do_doc_del_view(struct doc *d, struct command *c)
+static void do_doc_del_view_notifier(struct doc *d, struct command *c)
{
/* This view should only have points on the list, not typed
* marks. Just delete everything and clear the 'notify' pointer
}
}
+static void do_doc_del_view(struct doc *d, int i)
+{
+ /* This view should only have points on the list, not typed
+ * marks. Just delete everything and clear the 'notify' pointer
+ */
+ if (i < 0 || i >= d->nviews)
+ return;
+ d->views[i].notify = NULL;
+ d->views[i].state = 0;
+ while (!tlist_empty(&d->views[i].head)) {
+ struct tlist_head *tl = d->views[i].head.next;
+ if (TLIST_TYPE(tl) != GRP_LIST)
+ abort();
+ tlist_del_init(tl);
+ }
+}
+
static int do_doc_find_view(struct doc *d, struct command *c)
{
int i;
}
if (strcmp(ci->key, "doc:del-view") == 0) {
- if (!ci->comm2)
+ if (ci->numeric >= 0)
+ do_doc_del_view(dd->doc, ci->numeric);
+ else if (ci->comm2)
+ do_doc_del_view_notifier(dd->doc, ci->comm2);
+ else
return -1;
- do_doc_del_view(dd->doc, ci->comm2);
return 1;
}
return ret - 1;
}
-static inline void doc_del_view(struct pane *p, struct command *c)
+static inline void doc_del_view(struct pane *p, int num)
{
struct cmd_info ci = {0};
ci.focus = p;
ci.key = "doc:del-view";
+ ci.numeric = num;
+ key_handle(&ci);
+}
+
+static inline void doc_del_view_notifier(struct pane *p, struct command *c)
+{
+ struct cmd_info ci = {0};
+ ci.focus = p;
+ ci.key = "doc:del-view";
+ ci.numeric = -1;
ci.comm2 = c;
key_handle(&ci);
}
return 0;
while ((m = vmark_first(ci->home, i)) != NULL)
mark_free(m);
- doc_del_view(ci->home, ci->comm);
+ doc_del_view_notifier(ci->home, ci->comm);
}
return 0;
}