Fix for using gq in a string with spaces

This fixes #27 and contains the commit from #28 as well. 
It contains quite a lot of edge cases, like when there is no splitting possible and when trying to reformat docstrings.
I'm not sure how to write tests for this because it would have to test for something different than the other tests.