Limit the number of segments dynamically to avoid too-long lines.