function findLineSegments( str ) {
	var lines;
	var out;
	var i;

	lines = str.split( RE_EOL ); // FIXME: this approach is not robust for three reasons: (1) line breaks may include carriage returns, not just line feeds (so the `+1` may not be appropriate), (2) it does not consider line feeds which are escaped (e.g., `\\\n`), and (3) assumes that line breaks map directly to displayed lines (while true most of the line for text which has been wrapped to 80 chars, such as repl.txt files, this may not be true for all outputs, some of which may spill across multiple lines)
	out = [ 0 ];
	for ( i = 0; i < lines.length-1; i++ ) {
		out.push( out[ i ] + lines[ i ].length + 1 );
	}
	return out;
}
Returns a list of indices corresponding to line segments.

@private
@param {string} str - input string
@returns {Array<integer>} list of indices

@example
var str = 'foo\nbar\nbeep\nboop\n';

var idx = findLineSegments( str );
// returns [ 0, 4, 8, 13, 18 ]