int rpt = RPT_NUM(ci);
if (ci->mark == NULL)
- ci->mark = ci->home->point;
+ ci->mark = dd->point;
while (rpt > 0 && ch != WEOF) {
while ((ch = mark_next(d, ci->mark)) != WEOF)
;
if (strcmp(ci->key, "Clone") == 0) {
struct pane *p = doc_attach(ci->focus, dd->doc);
struct pane *c = pane_child(ci->home);
+ struct doc_data *dd2 = p->data;
- p->point = point_dup(ci->home->point);
+ dd2->point = point_dup(dd->point);
+ p->pointer = dd2->point;
if (c)
pane_clone(c, p);
return 1;
if (strcmp(ci->key, "Close") == 0) {
doc_del_view(ci->home, &dd->notify);
- if (ci->home->point)
- mark_free(ci->home->point);
- ci->home->point = NULL;
+ if (dd->point)
+ mark_free(dd->point);
free(dd);
ci->home->data = NULL;
return 1;
}
if (strcmp(ci->key, "doc:dup-point") == 0) {
- struct mark *pt = ci->home->point;
+ struct mark *pt = dd->point;
if (ci->mark && ci->mark->viewnum == MARK_POINT)
pt = ci->mark;
ci->mark = NULL;
- if (ci->home->point) {
+ if (pt) {
if (ci->extra == MARK_POINT)
ci->mark = point_dup(pt);
else if (ci->extra == MARK_UNGROUPED)
}
if (strcmp(ci->key, "Move-to") == 0) {
- point_to_mark(ci->home->point, ci->mark);
+ point_to_mark(dd->point, ci->mark);
return 1;
}
if (strcmp(ci->key, "doc:vmark-get") == 0) {
ci->mark = do_vmark_first(dd->doc, ci->numeric);
ci->mark2 = do_vmark_last(dd->doc, ci->numeric);
- if (ci->extra && ci->home->point)
- ci->mark2 = do_vmark_at_point(dd->doc, ci->home->point,
+ if (ci->extra && dd->point)
+ ci->mark2 = do_vmark_at_point(dd->doc, dd->point,
ci->numeric);
return 1;
}
dd->notify = doc_notify;
doc_add_view(p, &dd->notify, 0);
}
+ dd->point = NULL;
dd->pane = p;
d->ed = pane2ed(parent);
doc_promote(d);
struct doc_data *dd = doc->data;
p = doc_attach(parent, dd->doc);
if (p) {
- p->point = point_new(dd->doc);
+ dd = p->data;
+ dd->point = point_new(dd->doc);
+ p->pointer = dd->point;
p = pane_attach(p, "view", doc, NULL);
}
if (p)
DEF_CMD(docs_open)
{
struct pane *p = ci->home;
- struct pane *dp = p->point->ref.p;
+ struct doc_data *dd = p->data;
+ struct pane *dp = dd->point->ref.p;
struct pane *par = p->parent;
char *renderer = NULL;
p->handle = NULL;
p->data = NULL;
p->damaged = 0;
- p->point = NULL;
+ p->pointer = NULL;
p->attrs = 0;
}
if (p->focus == NULL)
p->focus = list_first_entry_or_null(
&p->children, struct pane, siblings);
- if (p->point)
- ci2.mark = p->point;
+ if (p->pointer)
+ ci2.mark = p->pointer;
damage |= p->damaged;
if (!damage)
}
pane_damaged(p->parent, DAMAGED_SIZE);
attr_free(&p->attrs);
-/* FIXME who destroys 'point'*/
- ASSERT(p->point == NULL);
free(p);
}
parent->data = p->data;
p->data = data;
- point = parent->point;
- parent->point = p->point;
- p->point = point;
+ point = parent->pointer;
+ parent->pointer = p->pointer;
+ p->pointer = point;
}
int pane_masked(struct pane *p, int x, int y, int z, int *w, int *h)
char *a = attr_get_str(p->attrs, key, -1);
if (a)
return a;
- if (p->point) {
- a = doc_attr(p, NULL, 0, key);
- if (a)
- return a;
- }
+ a = doc_attr(p, NULL, 0, key);
+ if (a)
+ return a;
p = p->parent;
}
/* FIXME do I want editor-wide attributes too? */
DEF_CMD(text_reundo)
{
struct doc_data *dd = ci->home->data;
- struct mark *m = ci->home->point;
+ struct mark *m = dd->point;
bool redo = ci->numeric != 0;
struct doc_ref start, end;
int did_do = 2;
if (early && !text_ref_same(t, &early->ref, &start))
early = NULL;
- point_notify_change(&t->doc, ci->home->point, early);
+ point_notify_change(&t->doc, dd->point, early);
text_check_consistent(t);
}
{
struct doc_data *dd = ci->home->data;
struct text *t = container_of(dd->doc, struct text, doc);
- struct mark *pm = ci->home->point;
+ struct mark *pm = dd->point;
struct mark *end = ci->mark;
char *str = ci->str;
bool first = ci->numeric;