Process lines immediately before and after selected lines
Process lines in both the previous and current selection

This will handle some edge cases where the selection moves and
the old lines don't get updated.