[master] a367c0150 vte: Preserve EOL when left-justified follows

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue May 7 13:31:05 UTC 2024


commit a367c01504996406442dc8b95f8cc71297fbe0c5
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue May 7 15:16:02 2024 +0200

    vte: Preserve EOL when left-justified follows

diff --git a/lib/libvarnish/vte.c b/lib/libvarnish/vte.c
index f27598feb..db15bd94d 100644
--- a/lib/libvarnish/vte.c
+++ b/lib/libvarnish/vte.c
@@ -263,7 +263,7 @@ VTE_format(const struct vte *vte, VTE_format_f *func, void *priv)
 		if (*p == '\v') {
 			if (p > q) {
 				VTE_FORMAT(func, priv, "%.*s%s",
-				    (int)(p - q), q, sep);
+				    (int)((p - 1) - q), q, sep);
 			}
 			q = ++p;
 			just_left = 1;
@@ -310,6 +310,7 @@ static const char *test_vte =
     "foo\t\v1\tthe foo\n"
     "bar\t\v10\tthe bars\n"
     "baz\t\v0\t\n"
+    "\v0\t\v0\t\n"
     "qux\t\v-1\tno eol";
 
 static const char *test_fmt =
@@ -317,6 +318,7 @@ static const char *test_fmt =
     "foo     1  the foo\n"
     "bar    10  the bars\n"
     "baz     0  \n"
+    "   0    0  \n"
     "qux    -1  no eol";
 
 static int


More information about the varnish-commit mailing list