Fixed an off-by-one error in the highlighting algorithm.