Fix position cursor error on rehighlight and improve rehighlight