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 <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2024-06-27 11:23:16 +02:00
parent d240ef1e92
commit dc7273e888

View File

@ -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);