Optimize whitespace trimming on paragraph merge

Avoid some unnecessary work by only trimming insignificant whitespace
in the direction of the merge. This is the only place that whitespace
can inadvertently become significant whitespace.
Merge pull request #804 from peitschie/merge-p-speed

Optimize whitespace trimming on paragraph merge