From bcf09964ab18d579dd6fe18c398e135d5a04c25a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 6 Nov 2019 00:03:08 +0200 Subject: [PATCH] Better formatting for multi-line values in config option --- platformio/project/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platformio/project/config.py b/platformio/project/config.py index 524879e3..27b116c1 100644 --- a/platformio/project/config.py +++ b/platformio/project/config.py @@ -230,12 +230,13 @@ class ProjectConfigBase(object): def set(self, section, option, value): if isinstance(value, (list, tuple)): value = "\n".join(value) - if value: - value = "\n" + value # start from a new line elif isinstance(value, bool): value = "yes" if value else "no" elif isinstance(value, (int, float)): value = str(value) + # start multi-line value from a new line + if "\n" in value and not value.startswith("\n"): + value = "\n" + value self._parser.set(section, option, value) def getraw(self, section, option):