Cosmetic changes.
Selection background is drawn more efficiently.
Fix longest line computation and clipping.
Selection cursor now drawn more efficiently.
Fix cursor not rendered when on very last position.