int i;
for (ret = 0; ret < d->nviews; ret++)
- if (d->views[ret].notify == NULL)
+ if (d->views[ret].state == 0)
break;
if (ret == d->nviews) {
/* Resize the view list */
NULL, dd->doc->name, 0);
if (strcmp(ci->key, "doc:add-view") == 0) {
- if (!ci->comm2)
- return -1;
return 1 + do_doc_add_view(dd->doc, ci->comm2);
}
d->deleting = 0;
for (i = 0; i < d->nviews; i++)
- if (d->views[i].notify)
+ if (d->views[i].state)
/* still in use */
return -1;
if (d == d->ed->docs)
lnk = m->mdata;;
for (i = 0; i < lnk->size; i++)
- if (d->views[i].notify) {
+ if (d->views[i].state) {
if (!new)
tlist_del(&lnk->lists[i]);
if (end)
{
struct mark *ret;
- if (view == MARK_POINT || view >= d->nviews || d->views[view].notify == NULL)
+ if (view == MARK_POINT || view >= d->nviews || d->views[view].state != 1)
return NULL;
ret = calloc(sizeof(*ret), 1);
ret->viewnum = view;
struct tlist_head *tl = &lnk->lists[i];
struct command *c = d->views[i].notify;
- if (!c)
+ if (!c || d->views[i].state == 0)
continue;
ci.comm = c;
while (TLIST_TYPE(tl) == GRP_LIST)
continue;
done[i] = 1;
remaining -= 1;
- if (!c)
+ if (!c || d->views[i].state == 0)
continue;
while (TLIST_TYPE(tl) == GRP_LIST)
tl = TLIST_PTR(tl->prev);
struct command *c = d->views[m->viewnum].notify;
done[m->viewnum] = 1;
remaining -= 1;
- if (c) {
+ if (c && d->views[m->viewnum].state) {
ci.mark = m;
ci.comm = c;
c->func(&ci);
struct command *c = d->views[i].notify;
if (done[i])
continue;
- if (!c)
+ if (!c || d->views[i].state == 0)
continue;
ci.mark = NULL;
ci.comm = c;
seq = m->seq + 1;
}
for (i = 0; i < d->nviews; i++)
- if (d->views[i].notify == NULL) {
+ if (d->views[i].state == 0) {
if (!tlist_empty(&d->views[i].head)) abort();
} else {
struct tlist_head *tl;
struct docview {
struct tlist_head head;
struct command *notify;
- short state; /* 0 = unused, 1 = active, 2 = being deleted */
+ short state; /* 0 = unused, 1 = active, 2 = being deleted */
} *views;
struct attrset *attrs;
int nviews;