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.

| Action | master(21c3bc1ace6eb5b97d932d147dc572c7ec399134) | pr |
|----------|----------|--------|
|19. Remove the current selection|9799ms|8593ms|