]> git.neil.brown.name Git - edlib.git/commitdiff
Always call CountLines on the focus
authorNeilBrown <neil@brown.name>
Sat, 3 Jun 2023 00:34:08 +0000 (10:34 +1000)
committerNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 05:40:21 +0000 (15:40 +1000)
A view might hide some lines, and might intercept CountLines so exclude
those lines from the count.
As a line count is a particular view on the file, it should be
consistent with other views.
So always use the current focus when calling CountLines.

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

index fb94af3b174619e65cbdca2abd685794a882c8da..8202b7d28d60758b872443204ae30c57e4f26d00 100644 (file)
@@ -195,11 +195,11 @@ DEF_CMD(view_refresh)
                        int mid;
 
                        if (vd->viewpoint) {
-                               call("CountLines", p, 0, vd->viewpoint);
+                               call("CountLines", ci->focus, 0, vd->viewpoint);
                                vpln = attr_find_int(*mark_attr(vd->viewpoint),
                                                     "line");
                        } else if (pm) {
-                               call("CountLines", p, 0, pm);
+                               call("CountLines", ci->focus, 0, pm);
                                vpln = attr_find_int(*mark_attr(pm), "line");
                        }
 
index ca7b1e70a7eafa59a4e0a47078548a5bc1f773e6..df2e549edfd60aaee27e5cf80b09de0013f1820e 100644 (file)
@@ -69,7 +69,7 @@ DEF_CMD(render_hex_eol)
 
        if (!ci->mark)
                return Enoarg;
-       call("CountLines", ci->home, 0, ci->mark);
+       call("CountLines", ci->focus, 0, ci->mark);
 
        pos = attr_find_int(*mark_attr(ci->mark), "char") - 1;
        while (rpt > 0 && ch != WEOF) {
@@ -109,7 +109,7 @@ DEF_CMD(render_line)
        if (!ci->mark)
                return Enoarg;
 
-       call("CountLines", ci->home, 0, ci->mark);
+       call("CountLines", ci->focus, 0, ci->mark);
        pos = attr_find_int(*mark_attr(ci->mark), "char") - 1;
 
        buf_init(&ret);
@@ -173,7 +173,7 @@ DEF_CMD(render_line_prev)
 
        if (!ci->mark)
                return Enoarg;
-       call("CountLines", ci->home, 0, ci->mark);
+       call("CountLines", ci->focus, 0, ci->mark);
 
        from = attr_find_int(*mark_attr(ci->mark), "char") - 1;
        to = from & ~0xF;