From: NeilBrown Date: Sat, 3 Jun 2023 06:13:25 +0000 (+1000) Subject: linecount: fix need_recalc() X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=5499cf4cf1075486f0ba80b9671270bde52eeecc;p=edlib.git linecount: fix need_recalc() I was testing the wrong thing - or freeing the wrong thing. If a range is small - clear the first mark and discard the second. Then from the first to whatever comes next will be recalculated. Signed-off-by: NeilBrown --- diff --git a/lib-linecount.c b/lib-linecount.c index 5f119baa..110255a1 100644 --- a/lib-linecount.c +++ b/lib-linecount.c @@ -105,14 +105,10 @@ static int need_recalc(struct pane *p safe, struct mark *m) return 1; if (!attr_find(*mark_attr(m), "lines")) ret = 1; - while (1) { - next = vmark_next(m); - if (!next) - break; - if (is_eol(doc_prior(p, next)) && - attr_find_int(*mark_attr(next), "lines") > 10) - break; - /* discard next - we'll find or create another */ + next = vmark_next(m); + if (next && attr_find_int(*mark_attr(m), "lines") < 20) { + /* This is tiny, recalc */ + attr_del(mark_attr(m), "lines"); mark_free(next); ret = 1; }