Whitespace collapse and trimming
The pasted block is treated as plain text. A run of consecutive spaces or tabs anywhere in it becomes a single space, and whitespace at the very start and end of the block is removed, so ragged edges and doubled spacing disappear. Line breaks are handled separately, not swallowed by this pass.