trivial: fu-util-common: fix description wrapping (Fixes: #1378)

Embedded newline characters don't do so well.

Before:
```
└─XPS 13 9380 System Update:
      New version:         0.1.3.2
      Remote ID:           lvfs
      Summary:             Firmware for the Dell XPS 13 9380
      License:             proprietary
      Size:                19.9 MB
      Vendor:              Dell Inc.
      Flags:               is-downgrade|blocked-version
      Description:         This stable release fixes the following issues:

    �� Fixed an issue with Secure Boot Option ROM Signature Verification.
    �� Firmware updates to address security advisory INTEL-SA-00185 (CVE-2018-12188 CVE-2018-12190 CVE-2018-12191 CVE-2018-12192 CVE-2018-12199 CVE-2018-12198 CVE-2018-12200 CVE-2018-12187 CVE-2018-12196 CVE-2018-12185).
    �� Firmware updates to address security advisories INTEL-SA-00191(CVE-2018-12201, CVE-2018- 12202, CVE-2018-12203, CVE-2018-12205).

    me new functionality has also been added:

    �� Removed the option Always Allow Dell Docks from BIOS settings. Dell dock connection and the port behavior will be controlled via the USB and Thunderbolt Adapter configuration settings under operating system environment.
    �� Replaces Absolute Software service from Computrace to Absolute Persistence Module service.
    �� Supports Dell Dock Station WD19.
```

After:
```
└─XPS 13 9380 System Update:
      New version:         0.1.3.2
      Remote ID:           lvfs
      Summary:             Firmware for the Dell XPS 13 9380
      License:             proprietary
      Size:                19.9 MB
      Vendor:              Dell Inc.
      Flags:               is-downgrade|blocked-version
      Description:         This stable release fixes the following issues:

      • Fixed an issue with Secure Boot Option ROM Signature Verification.
      • Firmware updates to address security advisory INTEL-SA-00185 (CVE-2018-12188 CVE-2018-12190 CVE-2018-12191 CVE-2018-12192 CVE-2018-12199 CVE-2018-12198 CVE-2018-12200 CVE-2018-12187 CVE-2018-12196 CVE-2018-12185).
      • Firmware updates to address security advisories INTEL-SA-00191(CVE-2018-12201, CVE-2018- 12202, CVE-2018-12203, CVE-2018-12205).

      Some new functionality has also been added:

      • Removed the option Always Allow Dell Docks from BIOS settings. Dell dock connection and the port behavior will be controlled via the USB and Thunderbolt Adapter configuration settings under operating system environment.
      • Replaces Absolute Software service from Computrace to Absolute Persistence Module service.
      • Supports Dell Dock Station WD19.
```
This commit is contained in:
Mario Limonciello 2019-09-20 14:22:14 -05:00 committed by Richard Hughes
parent ce94d163f8
commit 1dbb82d25e

View File

@ -1143,11 +1143,22 @@ fu_common_string_append_kv (GString *str, guint idt, const gchar *key, const gch
keysz = idt * 2;
}
if (value != NULL) {
for (gsize i = keysz; i < align; i++)
g_auto(GStrv) split = NULL;
split = g_strsplit (value, "\n", -1);
for (guint i = 0; split[i] != NULL; i++) {
if (i == 0) {
for (gsize j = keysz; j < align; j++)
g_string_append (str, " ");
} else {
for (gsize j = 0; j < idt; j++)
g_string_append (str, " ");
g_string_append (str, value);
}
g_string_append (str, split[i]);
g_string_append (str, "\n");
}
} else {
g_string_append (str, "\n");
}
}
void