Expand fix for paren trail 'space before cursor' behavior

Now also correctly handles multiple whitespace characters
before the cursor when inserting close parens, shortening
the whitespace to a single space and clipping the cursor
position so it does not end up behind an inserted close paren.