From b427dc8d96a04e73afe3bce34d820d306460d750 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Wed, 7 Jun 2023 06:54:23 +1000 Subject: [PATCH] linecount: when async needs a full count - do it. If async linecount is asked to find a mark, and we don't have a full line count, then we aren't going to find the mark (because async handlers forget about it). So be honest up front and just forget about it. This ensure consistency. Signed-off-by: NeilBrown --- DOC/TODO.md | 9 +++++++++ lib-linecount.c | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/DOC/TODO.md b/DOC/TODO.md index 8f7d7cab..653c355b 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -33,6 +33,8 @@ the file. - [ ] lib-url - [ ] lib-mergeview improvements - [ ] lib-diff slowness with large diff +- [ ] linecount :when used in 'view' mode, stack the counting pane with all the + others so it can easily catch view-changed. ### Large @@ -144,6 +146,13 @@ Core features Module features --------------- +### lib-linecount + +- [ ] when used in 'view' mode, stack the counting pane with all the + others so it can easily catch view-changed. In general, make it + easier to use this way. e.g. easier than catching + doc:request:doc:CountLines. + ### lib-server - [ ] ctrl-z in elc doesn't ask edlib to release the terminal diff --git a/lib-linecount.c b/lib-linecount.c index c9352f1b..1120d50f 100644 --- a/lib-linecount.c +++ b/lib-linecount.c @@ -213,6 +213,13 @@ static void count_calculate(struct pane *p safe, /* nothing to do */ return; + if (end && !attr_find(p->attrs, "lines") && !sync) + /* We don't have totals, so do that first. + * When asked again, we will be able to find + * the mark quickly. + */ + end = NULL; + m = vmark_first(p, type, owner); if (m == NULL || doc_prior(p, m) != WEOF) { /* No mark at doc start, make some */ -- 2.39.5