code: Remove trailing spaces.
code: Fix a bug in diff rendering.

The rendered lines may have been out of order if change lines are continued
more than 2 lines.