Strips trailing whitespace w/out moving the cursor

Stripping whitespace currently moves the cursor to the last substitution, this saves the cursor location and resets it after the replacements.