Only trim whitespace between non-whitespace and newline (Issue #158)

This prevents trimming lines that only have whitespace.
Merge pull request #159 from harbichidian/patch-1

Only trim whitespace between non-whitespace and newline (Issue #158)