From dc7273e8888cdfce1c49f0688cdbd69eabe7a482 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 27 Jun 2024 11:23:16 +0200 Subject: [PATCH] schema: drop trailing double-newlines in wrap_text This is completely wrong and make working with it extremely annoying. Whether or not there should be separation should be decided where multiple elements are connected, they shouldn't automatically come with a bunch of trailing new lines for absolutely no reason. Places using this will need to be fixed as they get noticed. Signed-off-by: Wolfgang Bumiller --- proxmox-schema/src/format.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxmox-schema/src/format.rs b/proxmox-schema/src/format.rs index 066bb4b2..0d25efc7 100644 --- a/proxmox-schema/src/format.rs +++ b/proxmox-schema/src/format.rs @@ -52,9 +52,9 @@ pub fn wrap_text( if acc.is_empty() { acc.push_str(&textwrap::wrap(p, &wrap_options1).join("\n")); } else { + acc.push_str("\n\n"); acc.push_str(&textwrap::wrap(p, &wrap_options2).join("\n")); } - acc.push_str("\n\n"); acc }) } @@ -62,7 +62,7 @@ pub fn wrap_text( #[test] fn test_wrap_text() { let text = "Command. This may be a list in order to spefify nested sub-commands."; - let expect = " Command. This may be a list in order to spefify nested sub-\n commands.\n\n"; + let expect = " Command. This may be a list in order to spefify nested sub-\n commands."; let indent = " "; let wrapped = wrap_text(indent, indent, text, 80);