Improve options.locations performance by tracking newlines rather than finding them