Fix range check for cursor move by line