[PATCH imv v2] Remove trailing whitespace from wordexp-ed strings
Export this patch
Previous implementation was always leaving a trailing whitespace at the
end of the expanded string (used in window title, description text,
etc.). Now it doesn't happen.
---
src/imv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/imv.c b/src/imv.c
index 8380a12..ba411f6 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -2002,7 +2002,7 @@ static size_t generate_env_text(struct imv *imv, char *buf, size_t buf_len, cons
setenv("IFS", "", 1);
if (wordexp(format, &word, 0) == 0) {
for (size_t i = 0; i < word.we_wordc; ++i) {
- len += snprintf(buf + len, buf_len - len, "%s ", word.we_wordv[i]);
+ len += snprintf(buf + len, buf_len - len, (i ? " %s" : "%s"), word.we_wordv[i]);
}
wordfree(&word);
} else {
--
2.36.1
imv/patches: SUCCESS in 4m28s
[Remove trailing whitespace from wordexp-ed strings][0] v2 from [Ivan Oleynikov][1]
[0]: https://lists.sr.ht/~exec64/imv-devel/patches/32741
[1]: mailto:ivan.oleynikov95@gmail.com
✓ #773531 SUCCESS imv/patches/fedora.yml https://builds.sr.ht/~exec64/job/773531
✓ #773529 SUCCESS imv/patches/archlinux.yml https://builds.sr.ht/~exec64/job/773529
✓ #773532 SUCCESS imv/patches/freebsd.yml https://builds.sr.ht/~exec64/job/773532
✓ #773530 SUCCESS imv/patches/ubuntu.yml https://builds.sr.ht/~exec64/job/773530