A better fix for bug #17777 with visual-order cursor movement.