return p->m.ref;
}
-struct mark *mark_of_point(struct point *p)
-{
- return &p->m;
-}
-
struct mark *doc_first_mark(struct doc *d, int view)
{
struct tlist_head *tl;
tl = &pt->lists[view];
m = __vmark_prev(tl);
- if (m && mark_same(pt->doc, m, mark_of_point(pt)))
+ if (m && mark_same(pt->doc, m, &pt->m))
return m;
tl = &pt->lists[view];
m = __vmark_next(tl);
- if (m && mark_same(pt->doc, m, mark_of_point(pt)))
+ if (m && mark_same(pt->doc, m, &pt->m))
return m;
return NULL;
}
ci.x = ci.y = -1;
ci.pointp = p->owner;
if (!m)
- m = mark_of_point(p);
+ m = &p->m;
for (i = 0; i < p->size; i++) {
struct tlist_head *tl = &p->lists[i];
struct command *c = d->views[i].notify;
while (TLIST_TYPE(tl) != GRP_HEAD) {
if (TLIST_TYPE(tl) == GRP_MARK) {
ci.mark = tlist_entry(tl, struct mark, view);
- if (mark_same(d, ci.mark, mark_of_point(p)))
+ if (mark_same(d, ci.mark, &p->m))
c->func(&ci);
else
break;
struct tlist_head lists[];
};
-struct mark *mark_of_point(struct point *p);
struct mark *mark_dup(struct mark *m, int notype);
void mark_free(struct mark *m);
struct mark *doc_new_mark(struct doc *d, int view);
where = 1;
first = 0;
} else
- where = text_locate(t, &mark_of_point(p)->ref, &end);
+ where = text_locate(t, &p->m.ref, &end);
if (!where)
break;
if (where == 1) {
do {
- i = text_advance_towards(t, &mark_of_point(p)->ref, &end);
+ i = text_advance_towards(t, &p->m.ref, &end);
if (i == 0)
break;
- while ((m = doc_next_mark_all(d, mark_of_point(p))) != NULL &&
- m->ref.c == mark_of_point(p)->ref.c &&
- m->ref.o < mark_of_point(p)->ref.o)
- mark_forward_over(mark_of_point(p), m);
+ while ((m = doc_next_mark_all(d, &p->m)) != NULL &&
+ m->ref.c == p->m.ref.c &&
+ m->ref.o < p->m.ref.o)
+ mark_forward_over(&p->m, m);
} while (i == 2);
} else {
do {
- i = text_retreat_towards(t, &mark_of_point(p)->ref, &end);
+ i = text_retreat_towards(t, &p->m.ref, &end);
if (i == 0)
break;
- while ((m = doc_prev_mark_all(d, mark_of_point(p))) != NULL &&
- m->ref.c == mark_of_point(p)->ref.c &&
- m->ref.o > mark_of_point(p)->ref.o)
- mark_backward_over(mark_of_point(p), m);
+ while ((m = doc_prev_mark_all(d, &p->m)) != NULL &&
+ m->ref.c == p->m.ref.c &&
+ m->ref.o > p->m.ref.o)
+ mark_backward_over(&p->m, m);
} while (i == 2);
}
- if (!text_ref_same(t, &mark_of_point(p)->ref, &end))
+ if (!text_ref_same(t, &p->m.ref, &end))
/* eek! */
break;
/* point is now at location of undo */
- m = mark_of_point(p);
+ m = &p->m;
hlist_for_each_entry_continue_reverse(m, &t->doc.marks, all)
if (text_update_prior_after_change(t, &m->ref,
&start, &end) == 0)
break;
- m = mark_of_point(p);
+ m = &p->m;
hlist_for_each_entry_continue(m, all)
if (text_update_following_after_change(t, &m->ref,
&start, &end) == 0)
break;
- early = doc_prev_mark_all(d, mark_of_point(p));
+ early = doc_prev_mark_all(d, &p->m);
if (early && !text_ref_same(t, &early->ref, &start))
early = NULL;
{
struct doc *d = pos->doc;
struct text *t = container_of(d, struct text, doc);
- struct mark *pm = mark_of_point(pos);
+ struct mark *pm = &pos->m;
struct mark *early = NULL;
/* First delete, then insert */
point_to_mark(pos, end);
} else
myend = mark_dup(end, 1);
- l = count_bytes(t, mark_of_point(pos), myend);
+ l = count_bytes(t, &pos->m, myend);
mark_free(myend);
text_del(t, &pm->ref, l, first);
int offset = m->ref.o;
if (o >= 0 && b.len >= o)
break;
- if (o == -1 && mark_same(d, m, mark_of_point(*ptp)))
+ if (o == -1 && mark_same(d, m, &(*ptp)->m))
break;
ch = mark_next(d, m);
if (ch == WEOF)
struct stk *s;
char *str;
- if (esi->s && mark_same(d, esi->s->m, mark_of_point(esi->end))) {
+ if (esi->s && mark_same(d, esi->s->m, &esi->end->m)) {
/* already pushed and didn't find anything new */
return 1;
}
s->next = esi->s;
esi->s = s;
if (esi->matched)
- esi->start = mark_dup(mark_of_point(esi->end), 1);
+ esi->start = mark_dup(&esi->end->m, 1);
else {
esi->start = mark_dup(s->m, 1);
mark_reset(d, esi->start);
do {
/* TEMP HACK - please fix */
d->ops->set_attr(esi->end, "highlight", NULL);
- wch = mark_next(d, mark_of_point(esi->end));
+ wch = mark_next(d, &esi->end->m);
if (wch == WEOF)
return 1;
if (wch == '\n') {
/* Sending this will cause a call-back to
* close everything down.
*/
- mark_prev(d, mark_of_point(esi->end));
+ mark_prev(d, &esi->end->m);
return 1;
}
/* FIXME utf-8! and quote regexp chars */
}
esi->target = ci2.focus;
point_dup(esi->target->point, &esi->end);
- esi->start = mark_dup(mark_of_point(esi->end), 1);
+ esi->start = mark_dup(&esi->end->m, 1);
esi->s = NULL;
esi->matched = 0;
esi->search = ci->focus;
/* FIXME optimise this away most of the time */
count_calculate(d, NULL, NULL);
- count_calculate(d, NULL, mark_of_point(pt));
+ count_calculate(d, NULL, &pt->m);
if (ci->mark)
count_calculate(d, NULL, ci->mark);
return 1;
ci2.pointp = ci->pointp;
key_lookup(pt->doc->ed->commands, &ci2);
- ln = attr_find_int(*mark_attr(mark_of_point(pt)), "lines");
+ ln = attr_find_int(*mark_attr(&pt->m), "lines");
l = attr_find_int(pt->doc->attrs, "lines");
w = attr_find_int(pt->doc->attrs, "words");
c = attr_find_int(pt->doc->attrs, "chars");
int rpt = RPT_NUM(ci);
if (ci->mark == NULL)
- ci->mark = mark_of_point(pt);
+ ci->mark = &pt->m;
while (rpt > 0 && ch != WEOF) {
while ((ch = mark_next(pt->doc, ci->mark)) != WEOF)
;
ci2.focus = p;
ci2.key = "Move-View-Small";
ci2.numeric = RPT_NUM(ci);
- ci2.mark = mark_of_point(*ci->pointp);
+ ci2.mark = &(*ci->pointp)->m;
ci2.pointp = ci->pointp;
if (ci->hy == mid-1) {
ci2.focus = ci->focus;
ci2.key = mv->type;
ci2.numeric = mv->direction * RPT_NUM(ci);
- ci2.mark = mark_of_point(pt);
+ ci2.mark = &pt->m;
ci2.pointp = ci->pointp;
ret = key_handle_focus(&ci2);
ci2.key = "Replace";
ci2.numeric = 1;
ci2.extra = ci->extra;
- ci2.mark = mark_of_point(*ci->pointp);
+ ci2.mark = &(*ci->pointp)->m;
strncpy(str,ci->key+4, sizeof(str));
str[4] = 0;
ci2.str = str;
ci2.key = "Replace";
ci2.numeric = 1;
ci2.extra = ci->extra;
- ci2.mark = mark_of_point(*ci->pointp);
+ ci2.mark = &(*ci->pointp)->m;
for (i = 0; other_inserts[i].key; i++)
if (strcmp(other_inserts[i].key, ci->key) == 0)
break;
struct cmd_info ci3 = {0};
ci3.key = "Replace";
ci3.pointp = ci->pointp;
- ci3.mark = mark_of_point(*ci->pointp);
+ ci3.mark = &(*ci->pointp)->m;
ci3.numeric = 1;
ci3.focus = ci->focus;
ci3.str = c;
struct cmd_info ci3 = {0};
ci3.key = "Replace";
ci3.pointp = ci->pointp;
- ci3.mark = mark_of_point(*ci->pointp);
+ ci3.mark = &(*ci->pointp)->m;
ci3.numeric = 1;
ci3.focus = ci->focus;
ci3.str = c;
if (!ci->str || !ci->str[0])
return -1;
ci2.pointp = pane_point(ci->focus);
- ci2.mark = mark_dup(mark_of_point(*ci2.pointp), 1);
+ ci2.mark = mark_dup(&(*ci2.pointp)->m, 1);
ci2.str = ci->str;
ci2.key = "text-search";
if (!key_lookup(pane2ed(ci->focus)->commands, &ci2))
ci2.key = "render-line";
ci2.focus = ci->home;
ci2.home = ci->home;
- ci2.mark = mark_of_point(*ci->pointp);
+ ci2.mark = &(*ci->pointp)->m;
ci2.pointp = ci->pointp;
ci2.numeric = NO_NUMERIC;
render_complete_line_func(&ci2);
mark_free(last_vis);
last_vis = mark_dup(m, 0);
- if (mark_same(d, m, mark_of_point(*ptp))) {
+ if (mark_same(d, m, &(*ptp)->m)) {
p->cx = x;
p->cy = y;
}
if (dd->home_field < 0)
dd->home_field = home;
}
- if (p->cy == y && mark_of_point(*ptp)->rpos == field - dd->home_field)
+ if (p->cy == y && (*ptp)->m.rpos == field - dd->home_field)
p->cx = x;
b = buf;
while (*n == '-' || *n == '_' || isalnum(*n)) {
x = 0;
}
mark_free(m);
- if (mark_ordered(mark_of_point(*ptp), dd->top) && !mark_same(d, mark_of_point(*ptp), dd->top))
+ if (mark_ordered(&(*ptp)->m, dd->top) && !mark_same(d, &(*ptp)->m, dd->top))
p->cx = p->cy = -1;
return last_vis;
}
int field = 0;
if (RPT_NUM(ci) < 0 &&
- !mark_same(d, mark_of_point(*ci->pointp), m))
+ !mark_same(d, &(*ci->pointp)->m, m))
ci->numeric = NO_NUMERIC;
ch = doc_following(d, m);
if (ch == WEOF) {
n = body;
m->rpos = field - rf->home_field;
if (RPT_NUM(ci) < 0 &&
- mark_of_point(*ci->pointp)->rpos == m->rpos)
+ (*ci->pointp)->m.rpos == m->rpos)
goto endwhile;
if (ci->numeric != NO_NUMERIC && ci->numeric >= 0 &&
ret.len >= ci->numeric)
ret.len >= ci->numeric)
break;
if (RPT_NUM(ci) < 0 &&
- mark_of_point(*ci->pointp)->rpos == m->rpos)
+ (*ci->pointp)->m.rpos == m->rpos)
break;
n += 1;
if (*n == '+') {
rf->home_field = home;
m->rpos = field + 1 - rf->home_field;
if (RPT_NUM(ci) < 0 &&
- mark_of_point(*ci->pointp)->rpos == m->rpos)
+ (*ci->pointp)->m.rpos == m->rpos)
;
else if (ci->numeric >= 0 && ci->numeric != NO_NUMERIC)
;
struct mark *m2 = ci->mark;
if (ci->numeric == -1 &&
- mark_same(d, m2, mark_of_point(*ptp)))
+ mark_same(d, m2, &(*ptp)->m))
goto done;
if (ci->numeric >= 0 && ci->numeric != NO_NUMERIC &&
ci->numeric <= ret.len)
}
m2 = container_of(vmark_next(&m->m), struct rl_mark, m);
if (p->cx <= 0 &&
- mark_ordered_or_same(d, &m->m, mark_of_point(*ptp)) &&
- (!m2 || mark_ordered_or_same(d, mark_of_point(*ptp), &m2->m))) {
+ mark_ordered_or_same(d, &m->m, &(*ptp)->m) &&
+ (!m2 || mark_ordered_or_same(d, &(*ptp)->m, &m2->m))) {
int len = call_render_line_to_point(p, ptp,
m);
rl->cursor_line = y;
top = vmark_first(d, rl->typenum);
bot = vmark_last(d, rl->typenum);
if (top && bot &&
- mark_ordered(top, mark_of_point(pt)) &&
- mark_ordered(mark_of_point(pt), bot))
+ mark_ordered(top, &pt->m) &&
+ mark_ordered(&pt->m, bot))
/* pos already displayed */
return 1;
find_lines(ci->pointp, ci->home);
ci2.numeric -= 1;
else
ci2.numeric += 1;
- ci2.mark = mark_of_point(*ptp);
+ ci2.mark = &(*ptp)->m;
ci2.pointp = ci->pointp;
if (!key_handle_focus(&ci2))
return -1;
while (y < p->h) {
mark_free(last_vis);
last_vis = mark_dup(m, 0);
- if (mark_same(d, m, mark_of_point(*ptp))) {
+ if (mark_same(d, m, &(*ptp)->m)) {
p->cx = x;
p->cy = y;
}
break;
}
mark_free(m);
- if (mark_ordered(mark_of_point(*ptp), rd->top))
+ if (mark_ordered(&(*ptp)->m, rd->top))
/* point is before mark, cannot possibly see cursor */
p->cx = p->cy = -1;
- while (mark_ordered(last_vis, mark_of_point(*ptp)) &&
- mark_same(d, last_vis, mark_of_point(*ptp)))
+ while (mark_ordered(last_vis, &(*ptp)->m) &&
+ mark_same(d, last_vis, &(*ptp)->m))
/* point is at end of visible region - need to include it */
mark_forward_over(last_vis, doc_next_mark_all(d, last_vis));
rt->ignore_point = 1;
if (rt->top &&
rt->bot &&
- mark_ordered(rt->top, mark_of_point(pt)) &&
- mark_ordered(mark_of_point(pt), rt->bot))
+ mark_ordered(rt->top, &pt->m) &&
+ mark_ordered(&pt->m, rt->bot))
/* pos already displayed */
return 1;
top = find_top(ci->pointp, ci->home, rt->top, rt->bot);
ci2.numeric = RPT_NUM(ci);
if (ci2.numeric < 0)
ci2.numeric -= 1;
- m = mark_of_point(pt);
+ m = &pt->m;
ci2.mark = m;
ci2.pointp = ci->pointp;
ret = key_handle_focus(&ci2);