D7057: Filetemplate generation: avoid trailing empty line in license header
noreply at phabricator.kde.org
Wed Aug 2 07:32:08 UTC 2017
kfunk added a comment.
In https://phabricator.kde.org/D7057#131094, @kossebau wrote:
> Not really sure about this one. Alternative approaches could be:
> a) completely trim the license text from any leading and trailing empty lines, not just a last linebreak
> b) fix the existing license templates to not end with a linebreak
> What do you think?
I just fixing up the license text after having loaded them is fine. Wouldn't touch the license files, as otherwise Git complains about files not having a new line at the EOF.
> QString licenseText = d->license->licenseTextEdit->document()->toPlainText();
> + QRegularExpression anyLinebreakAtEnd(QStringLiteral("(\n|\r\n)$"));
> + licenseText.remove(anyLinebreakAtEnd);
I think the additional newline should be rather stripped inside `LicensePagePrivate::readLicense`, not here.
I just tested this:
- If I manually enter text, everything works just fine.
- If I use any of the presets, then indeed there's an additional newline added.
-> We just need to fix the contents of the presets after they were loaded from disk.
To: kossebau, #kdevelop
Cc: kfunk, kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the KDevelop-devel