Fix line number and highlighting collisions

Improvements to help line-numbering and line-highlighting to get along reliably.