return NULL;
}
-struct mark *doc_next_mark(struct doc *d, struct mark *m)
+struct mark *doc_next_mark(struct mark *m)
{
struct tlist_head *tl = &m->view;
return NULL;
}
+struct mark *doc_prev_mark(struct mark *m)
+{
+ struct tlist_head *tl = &m->view;
+
+ tlist_for_each_continue_reverse(tl, GRP_HEAD)
+ if (TLIST_TYPE(tl) == GRP_MARK)
+ return tlist_entry(tl, struct mark, view);
+ return NULL;
+}
+
struct mark *doc_first_mark_all(struct doc *d)
{
if (d->marks.first)
struct mark *doc_prev_mark_all(struct mark *m);
struct mark *doc_prev_mark_all_safe(struct doc *d, struct mark *m);
struct mark *doc_first_mark(struct doc *d, int viewnum);
-struct mark *doc_next_mark(struct doc *d, struct mark *m);
-struct mark *doc_prev_mark(struct doc *d, struct mark *m);
+struct mark *doc_next_mark(struct mark *m);
+struct mark *doc_prev_mark(struct mark *m);
void point_reset(struct point *p);
void mark_reset(struct doc *d, struct mark *m);
void __mark_reset(struct doc *d, struct mark *m, int new, int end);
if (!attr_find(*mark_attr(m), "lines"))
ret = 1;
while (1) {
- next = doc_next_mark(d, m);
+ next = doc_next_mark(m);
if (!next)
break;
if (doc_prior(d, next) == '\n' &&
/* Force and update to make sure spacing stays sensible */
if (need_recalc(d, m))
/* need to update this one */
- do_count(d, m, doc_next_mark(d, m), &l, &w, &c, 1);
+ do_count(d, m, doc_next_mark(m), &l, &w, &c, 1);
- m = doc_next_mark(d, m);
+ m = doc_next_mark(m);
}
if (!m) {
/* fell off the end, just count directly */
}
if (need_recalc(d, m))
/* need to update this one */
- do_count(d, m, doc_next_mark(d, m), &l, &w, &c, 1);
+ do_count(d, m, doc_next_mark(m), &l, &w, &c, 1);
/* 'm' is not before 'start', it might be after.
* if 'm' is not before 'end' either, just count from
lines = words = chars = 0;
else
do_count(d, start, m, &lines, &words, &chars, 0);
- while ((m2 = doc_next_mark(d, m)) != NULL &&
+ while ((m2 = doc_next_mark(m)) != NULL &&
(!end || mark_ordered(m2, end))) {
/* Need everything from m to m2 */
lines += attr_find_int(*mark_attr(m), "lines");
chars += attr_find_int(*mark_attr(m), "chars");
m = m2;
if (need_recalc(d, m))
- do_count(d, m, doc_next_mark(d, m), &l, &w, &c, 1);
+ do_count(d, m, doc_next_mark(m), &l, &w, &c, 1);
}
/* m is the last mark before end */
if (!end) {