From: NeilBrown Date: Sat, 3 Jun 2023 00:34:08 +0000 (+1000) Subject: Always call CountLines on the focus X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=cfafe7fb84a6dd23d7cda07264c15a8d154dd23f;p=edlib.git Always call CountLines on the focus 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 --- diff --git a/lib-view.c b/lib-view.c index fb94af3b..8202b7d2 100644 --- a/lib-view.c +++ b/lib-view.c @@ -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"); } diff --git a/render-hex.c b/render-hex.c index ca7b1e70..df2e549e 100644 --- a/render-hex.c +++ b/render-hex.c @@ -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;