]> git.neil.brown.name Git - edlib.git/commitdiff
rfc822header: don't mark spaces as wrap points.
authorNeilBrown <neil@brown.name>
Tue, 29 Aug 2023 09:00:34 +0000 (19:00 +1000)
committerNeilBrown <neil@brown.name>
Tue, 29 Aug 2023 09:00:34 +0000 (19:00 +1000)
Now that lib-renderlines supports word-wrap, we don't need rfc822header
to annotate for it.

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

index 548793a1c75cd631b18b4ff64ea7a99442d256ee..132ade78201b78d10a358c04126f01b6e2761733 100644 (file)
@@ -255,7 +255,7 @@ static void copy_header(struct pane *doc safe,
         * the document 'p' at 'point'.
         * 'type' can be:
         *  NULL : no explicit wrapping
-        *  "text": add wrap points between words
+        *  "text": no explicit wrapping
         *  "list": convert commas to wrap points.
         * 'hdr' is the name of the header -  before the ':'.
         * '\n', '\r' are copied as a single space, and subsequent
@@ -267,7 +267,6 @@ static void copy_header(struct pane *doc safe,
        char buf[20];
        wint_t ch;
        char attr[100];
-       int is_text = type && strcmp(type, "text") == 0;
        int is_list = type && strcmp(type, "list") == 0;
 
        m = mark_dup(start);
@@ -286,8 +285,7 @@ static void copy_header(struct pane *doc safe,
                if (sol && (ch == ' ' || ch == '\t'))
                        continue;
                if (sol) {
-                       call("doc:replace", p, 1, NULL, " ", 0, point,
-                            is_text ? ",render:rfc822header-wrap=1" : NULL);
+                       call("doc:replace", p, 1, NULL, " ", 0, point);
                        sol = 0;
                }
                buf[0] = ch;
@@ -320,29 +318,6 @@ static void copy_header(struct pane *doc safe,
                        mark_free(p2);
                }
        }
-       if (is_text) {
-               /* flag all space as wrapping.  We didn't do this before
-                * as they might have been hiding in quoted words.
-                */
-               struct mark *m2 = mark_dup(hstart);
-               while (mark_ordered_not_same(m2, point)) {
-                       struct mark *ms;
-                       int cnt = 1;
-                       int c = doc_next(p, m2);
-                       if (c != ' ' && c != '\t')
-                               continue;
-                       ms = mark_dup(m2);
-                       doc_prev(p, ms);
-                       while ((c = doc_following(p, m2)) == ' ' ||
-                              c == '\t') {
-                               cnt += 1;
-                               doc_next(p, m2);
-                       }
-                       snprintf(buf, sizeof(buf), "%d", cnt);
-                       call("doc:set-attr", p, 1, ms, "render:rfc822header-wrap",
-                            0, NULL, buf);
-               }
-       }
        call("doc:replace", p, 1, NULL, "\n", 0, point);
        snprintf(buf, sizeof(buf), "%zd", strlen(hdr_found)+1);
        call("doc:set-attr", p, 1, hstart, "render:rfc822header", 0, NULL, buf);