And get rid of point pointp stuff.
Signed-off-by: NeilBrown <neil@brown.name>
* include that between '<>'.
*/
struct buf b;
- struct point **ptp = ci->pointp;
- struct doc *d;
+ struct doc *d = ci->home->data;
struct mark *m = ci->mark;
+ struct mark *pm = ci->mark2; /* The location to render as focus */
int o = ci->numeric;
wint_t ch = WEOF;
int chars = 0;
- if (!m || !ptp)
+ if (!m)
return -1;
- d = (*ptp)->doc;
buf_init(&b);
while (1) {
int offset = m->ref.o;
if (o >= 0 && b.len >= o)
break;
- if (o == -1 && mark_same(d, m, &(*ptp)->m))
+ if (pm && mark_same(d, m, pm))
break;
ch = mark_next(d, m);
if (ch == WEOF)
*/
struct cmd_info ci2 = {0};
struct complete_data *cd = ci->home->data;
- struct doc *d;
+ struct pane *dp = doc_get_pane(ci->home);
+ struct doc *d = dp ? dp->data : NULL;
int plen;
- if (!ci->pointp || !ci->mark)
+ if (!d || !ci->mark)
return -1;
- d = (*ci->pointp)->doc;
+
ci2.key = ci->key;
ci2.mark = ci->mark;
- ci2.pointp = ci->pointp;
+ ci2.mark2 = ci->mark2;
ci2.focus = ci->home->parent;
ci2.numeric = ci->numeric;
if (key_handle(&ci2) == 0)
ci3.key= "render-line";
ci3.focus = ci->home->parent;
- ci3.pointp = ci->pointp;
while (1) {
int cmp;
ci2.key = "render-line";
ci2.numeric = NO_NUMERIC;
ci2.mark = ci->mark;
- ci2.pointp = ci->pointp;
ci2.focus = ci->focus;
ci2.home = ci->home;
if (render_complete_line_func(&ci2) < 0)
ci2.focus = ci->home;
ci2.home = ci->home;
ci2.mark = &(*ci->pointp)->m;
- ci2.pointp = ci->pointp;
ci2.numeric = NO_NUMERIC;
render_complete_line_func(&ci2);
str = ci2.str;
char *body = pane_attr_get(ci->focus, "line-format");
struct rf_data *rf = ci->home->data;
struct buf ret;
- struct doc *d;
+ struct pane *dp = doc_get_pane(ci->home);
+ struct doc *d = dp ? dp->data : NULL;
struct mark *m = ci->mark;
+ struct mark *pm = ci->mark2;
char *n;
wint_t ch;
int home;
int field = 0;
- if (!ci->pointp || !ci->mark)
+ if (!d || !ci->mark)
return -1;
- d = (*ci->pointp)->doc;
- if (RPT_NUM(ci) < 0 &&
- !mark_same(d, &(*ci->pointp)->m, m))
- ci->numeric = NO_NUMERIC;
+ if (pm && !mark_same(d, pm, m))
+ pm = NULL;
ch = doc_following(d, m);
if (ch == WEOF) {
ci->str = NULL;
body = "%+name";
n = body;
m->rpos = field - rf->home_field;
- if (RPT_NUM(ci) < 0 &&
- (*ci->pointp)->m.rpos == m->rpos)
+ if (pm && pm->rpos == m->rpos)
goto endwhile;
if (ci->numeric != NO_NUMERIC && ci->numeric >= 0 &&
ret.len >= ci->numeric)
if (ci->numeric != NO_NUMERIC && ci->numeric >= 0 &&
ret.len >= ci->numeric)
break;
- if (RPT_NUM(ci) < 0 &&
- (*ci->pointp)->m.rpos == m->rpos)
+ if (pm && pm->rpos == m->rpos)
break;
n += 1;
if (*n == '+') {
rf->fields = field;
rf->home_field = home;
m->rpos = field + 1 - rf->home_field;
- if (RPT_NUM(ci) < 0 &&
- (*ci->pointp)->m.rpos == m->rpos)
+ if (pm && pm->rpos == m->rpos)
;
else if (ci->numeric >= 0 && ci->numeric != NO_NUMERIC)
;
DEF_CMD(render_line)
{
struct buf ret;
- struct point **ptp = ci->pointp;
- struct doc *d;
struct cmd_info ci2 = {0};
struct mark *m = NULL;
+ struct pane *dp = doc_get_pane(ci->home);
+ struct doc *d = dp ? dp->data : NULL;
+ struct mark *pm = ci->mark2;
int pos;
int i;
char buf[10];
- if (!ptp || !ci->mark)
+ if (!d || !ci->mark)
return -1;
- d = (*ptp)->doc;
+
ci2.key = "CountLines";
ci2.home = ci2.focus = ci->home;
ci2.mark = ci->mark;
wint_t ch;
struct mark *m2 = ci->mark;
- if (ci->numeric == -1 &&
- mark_same(d, m2, &(*ptp)->m))
+ if (pm && mark_same(d, m2, pm))
goto done;
if (ci->numeric >= 0 && ci->numeric != NO_NUMERIC &&
ci->numeric <= ret.len)
ci.key = "render-line";
ci.focus = p;
- ci.pointp = ptp;
ci.mark = mark_dup(&start->m, 0);
ci.numeric = NO_NUMERIC;
/* Allow for filling the rest of the pane, given that
ci.key = "render-line";
ci.focus = p;
- ci.pointp = ptp;
ci.mark = mark_dup(&start->m, 0);
ci.numeric = offset;
if (key_handle(&ci) == 0) {
ci.key = "render-line";
ci.focus = p;
- ci.pointp = ptp;
+ ci.mark2 = &(*ptp)->m;
ci.mark = mark_dup(&start->m, 0);
ci.numeric = -1;
if (key_handle(&ci) == 0) {