stop when line_index is up to its limit.