Implement support for trimming leading whitespace
There's already an option for removing trailing whitespace.
Combining both pulls since the later makes the code easier to read.
Patches by sandsmark
Differential Revision: https://phabricator.kde.org/D8381
Differential Revision: https://phabricator.kde.org/D8417