]> git.neil.brown.name Git - edlib.git/commitdiff
linecount: when async needs a full count - do it.
authorNeilBrown <neil@brown.name>
Tue, 6 Jun 2023 20:54:23 +0000 (06:54 +1000)
committerNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 05:40:21 +0000 (15:40 +1000)
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 <neil@brown.name>
DOC/TODO.md
lib-linecount.c

index 8f7d7caba9687880e805e33f7308596a31513810..653c355b0353cd27789ef745c4fdc05bf91a8aac 100644 (file)
@@ -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
index c9352f1b03a6ed9de41917c4ba5450cc465681ad..1120d50fa79a500fe0b3f161cf292a41bebfbd28 100644 (file)
@@ -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 */