- [ ] catching doc:replace in a pane doesn't catch doc:insert-file.
I need a simple way to intercept any change.
- [X] switch-buffer in pop-up window - shouldn't kill the popup (does it?)
-- [ ] explicitly guard against infinite loops in consistency checks
+- [X] explicitly guard against infinite loops in consistency checks
- [ ] skip consistency checks after several with no stop for input.
- [ ] unwanted docs too easily appear high in recent-list - *Output*
- [ ] design a way for a keystroke to interrupt a long-running function.
struct mark *m, *m2 = NULL;
int seq = 0;
int i;
+ int max = 1000;
static bool warned = False;
hlist_for_each_entry(m, &d->marks, all) {
warned = True;
}
m2 = m;
+ if (max-- < 0)
+ break;
}
for (i = 0; d->views && i < d->nviews; i++)
if (d->views[i].owner == NULL) {
if (m->seq < seq)
abort();
seq = m->seq + 1;
+ if (max-- < 0)
+ break;
}
}
}
struct doc *d = m1->owner->data;
int found = 0;
int ret;
+ int max = 1000;
if (m1 == m2) {
- for (m = mark_first(d); m; m = mark_next(m))
+ for (m = mark_first(d); m; m = mark_next(m)) {
if (m1 == m)
return True;
+ if (max-- < 0)
+ break;
+ }
LOG("marks_validate: marks not found");
return False;
}
m = m1; m1 = m2; m2 = m;
}
- for (m = mark_first(d); m; m = mark_next(m))
+ for (m = mark_first(d); m; m = mark_next(m)) {
if (m == m1 || m == m2)
found += 1;
+ if (max-- < 0)
+ break;
+ }
if (found != 2) {
LOG("log_val_marks not both found, only %d", found);
return False;
static void mp_check_consistent(struct mp_info *mpi safe)
{
-// struct mark *m;
struct doc *d = &mpi->doc;
-// int s = -1;
-
- doc_check_consistent(d);
#if 0
+ struct mark *m;
+ int s = -1;
+ int max = 1000;
+
for (m = mark_first(d); m; m = mark_next(m)) {
if (!m->ref.m || m->ref.m->seq <= s) {
for (m = mark_first(d); m;
abort();
}
s = m->ref.m->seq;
+ if (max-- < 0)
+ break;
}
- doc_check_consistent(d);
#endif
+ doc_check_consistent(d);
}
static void change_part(struct mp_info *mpi safe, struct mark *m safe,
struct text_chunk *c;
struct mark *m, *prev;
struct doc *d = &t->doc;
- int loops;
+ int loops = 10000;
list_for_each_entry(c, &t->text, lst) {
check_allocated(t, c->txt, c->end);
if (c->start >= c->end)
abort();
+ if (loops-- < 0)
+ break;
}
list_for_each_entry(c, &t->text, lst) {
struct text_chunk *c2;
list_for_each_entry(c2, &t->text, lst) {
+ if (loops -- < 0)
+ break;
if (c2 == c ||
c2->txt != c->txt)
continue;
continue;
abort();
}
+ if (loops-- < 0)
+ break;
}
/* This test is quadratic in the number of marks, so let's
* give up rather then annoy the users.
*/
- loops = 10000;
for (m = mark_first(d); m; m = mark_next(m))
text_ref_consistent(t, &m->ref, &loops);
}
}
prev = m;
+ if (loops-- < 0)
+ break;
}
doc_check_consistent(d);
}