Fixed the order of options after the priority change
Fixed the trimming of trailing whitespaces in the output on Windows

Normalizing newlines needs to be done before trimming them, otherwise the
regex does not match the end of line properly because of the CR char.