]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic/escape: allow truncation mode where "…" is always appended
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 5 May 2021 10:53:53 +0000 (12:53 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 5 May 2021 11:59:23 +0000 (13:59 +0200)
commitfc96e5c0536ae6d9d689a373b696f4fd3659f7d3
treedcd2abb7deafeeaff8efd704f4574737e47a2455
parentb19f211698f2359464bd46c69a45390b6579b705
basic/escape: allow truncation mode where "…" is always appended

So far we would append "…" or "..." when the string was wider than the specified
output width. But let's add a mode where the caller knows that the string being
passed is already truncated.

The condition for jumping back in utf8_escape_non_printable_full() was
off-by-one. But we only jumped to that label after doing a check with a
stronger condition, so I think it didn't matter. Now it matters because we'd
output the forced ellipsis one column too early.
src/basic/escape.c
src/basic/escape.h
src/basic/utf8.c
src/basic/utf8.h
src/test/test-escape.c
src/test/test-utf8.c