]> git.neil.brown.name Git - edlib.git/commitdiff
Use panes and marks to communicate with CountLines
authorNeilBrown <neil@brown.name>
Thu, 26 Nov 2015 01:57:04 +0000 (12:57 +1100)
committerNeilBrown <neil@brown.name>
Thu, 26 Nov 2015 01:57:04 +0000 (12:57 +1100)
so no more pointp;

Signed-off-by: NeilBrown <neil@brown.name>
lib-line-count.c
lib-view.c
render-hex.c

index a403624a7bc1af9361a21852b1212e02b330a43c..40b25af76c05ad995c664c76ef499cf4e11e9862 100644 (file)
@@ -219,14 +219,15 @@ done:
 
 DEF_CMD(count_lines)
 {
-       struct point *pt = *ci->pointp;
-       struct doc *d = pt->doc;
+       struct pane *dp = doc_get_pane(ci->home);
+       struct doc *d = dp->data;
 
        /* FIXME optimise this away most of the time */
        count_calculate(d, NULL, NULL);
-       count_calculate(d, NULL, &pt->m);
        if (ci->mark)
                count_calculate(d, NULL, ci->mark);
+       if (ci->mark2)
+               count_calculate(d, NULL, ci->mark2);
        return 1;
 }
 
index cfe9ceba092e733b91bf6bda9599ad11b44f434e..039e678c6efe4232db076021e6c2b7c5e8df787e 100644 (file)
@@ -63,7 +63,8 @@ static int view_refresh(struct cmd_info *ci)
 
                if (p->h > 4) {
                        ci2.key = "CountLines";
-                       ci2.pointp = ci->pointp;
+                       ci2.home = ci2.focus = p;
+                       ci2.mark = &pt->m;
                        key_lookup(pt->doc->ed->commands, &ci2);
 
                        ln = attr_find_int(*mark_attr(&pt->m), "lines");
index 8d8485b71085282837c5e8b88da9f139551694bf..cde578ec9b269c283cd1d41ba5279d95db62193c 100644 (file)
@@ -88,7 +88,7 @@ DEF_CMD(render_hex_eol)
        struct cmd_info ci2 = {0};
 
        ci2.key = "CountLines";
-       ci2.pointp = ptp;
+       ci2.home = ci2.focus = ci->home;
        ci2.mark = ci->mark;
        key_lookup(d->ed->commands, &ci2);
        pos = attr_find_int(*mark_attr(ci->mark), "chars");
@@ -132,7 +132,7 @@ DEF_CMD(render_line)
                return -1;
        d = (*ptp)->doc;
        ci2.key = "CountLines";
-       ci2.pointp = ptp;
+       ci2.home = ci2.focus = ci->home;
        ci2.mark = ci->mark;
        key_lookup(d->ed->commands, &ci2);
        pos = attr_find_int(*mark_attr(ci->mark), "chars");
@@ -197,7 +197,7 @@ DEF_CMD(render_line_prev)
        int to, from;
 
        ci2.key = "CountLines";
-       ci2.pointp = ptp;
+       ci2.home = ci2.focus = ci->home;
        ci2.mark = ci->mark;
        key_lookup(d->ed->commands, &ci2);