Skip to content

Commit

Permalink
vte: Preserve EOL when left-justified follows
Browse files Browse the repository at this point in the history
  • Loading branch information
dridi committed May 7, 2024
1 parent 7f04ec5 commit a367c01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/libvarnish/vte.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -310,13 +310,15 @@ 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 =
"name ref comment\n"
"foo 1 the foo\n"
"bar 10 the bars\n"
"baz 0 \n"
" 0 0 \n"
"qux -1 no eol";

static int
Expand Down

0 comments on commit a367c01

Please sign in to comment.