From: NeilBrown Date: Tue, 29 Aug 2023 09:00:34 +0000 (+1000) Subject: rfc822header: don't mark spaces as wrap points. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=c3f7a6c30a892c6ea241d62cd92a49e3c201c803;p=edlib.git rfc822header: don't mark spaces as wrap points. Now that lib-renderlines supports word-wrap, we don't need rfc822header to annotate for it. Signed-off-by: NeilBrown --- diff --git a/lib-rfc822header.c b/lib-rfc822header.c index 548793a1..132ade78 100644 --- a/lib-rfc822header.c +++ b/lib-rfc822header.c @@ -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);