]> git.neil.brown.name Git - edlib.git/commitdiff
linecount: optimise when no counting needed.
authorNeilBrown <neil@brown.name>
Sat, 3 Jun 2023 01:20:51 +0000 (11:20 +1000)
committerNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 05:40:21 +0000 (15:40 +1000)
If a mark wasn't passed, and the pane count is up to date, there is no
need to do anything, so optimise it all away.

Signed-off-by: NeilBrown <neil@brown.name>
lib-linecount.c

index 2572086601507eafcd45b8707e8147ca23f1f656..ba51efa1ff6ac57b69886e7c18d7ac41b0edd763 100644 (file)
@@ -126,6 +126,10 @@ static void count_calculate(struct pane *p safe,
        int lines, words, chars, l, w, c;
        struct mark *m, *m2;
 
+       if (!end && attr_find(p->attrs, "lines"))
+               /* nothing to do */
+               return;
+
        m = vmark_first(p, type, owner);
        if (m == NULL || doc_prior(p, m) != WEOF) {
                /* No mark at doc start, make some */