// BufferLines returns the lines in the view's internal
// buffer.
556469
func (v *View) BufferLines() []string {
	lines := make([]string, len(v.lines))
	for i, l := range v.lines {
		str := lineType(l).String()
		str = strings.Replace(str, "\x00", " ", -1)
		lines[i] = str
	}
	return lines
}
40139
func Line(buffer Buffer, event *cue.Event) {
	if len(event.Frames) == 0 {
		buffer.AppendString("0")
		return
	}
	buffer.AppendString(fmt.Sprintf("%d", event.Frames[0].Line))
}
286540
func (l *ReaderLexer) BufferString() (str string) {
	guard := Mark("BufferString")
	defer func() {
		Trace("BufferString() -> l.pos = %d, l.buf = %q, return = %q\n", l.pos, l.buf, str)
		guard()
	}()

	Trace("l.buf = %q, l.pos = %d", l.buf, l.pos)

	total := 0
	for i := 0; len(l.buf) > i && i < l.pos+1; i++ {
		Trace("l.buf[%d] = %q\n", i, l.buf[i])
		if l.buf[i] == -1 {
			break
		}
		total += utf8.RuneLen(l.buf[i])
	}

	Trace("Expecting buffer to contain %d bytes", total)
	if total == 0 {
		str = ""
		return
	}

	strbuf := make([]byte, total)
	pos := 0
	for i := 0; len(l.buf) > i && i < l.pos+1; i++ {
		if l.buf[i] == -1 {
			break
		}
		Trace("Encoding rune %q into position %d", l.buf[i], pos)
		pos += utf8.EncodeRune(strbuf[pos:], l.buf[i])
	}
	Trace("%q (%d)\n", strbuf, len(strbuf))

	str = string(strbuf)
	return str
}
1237593
func Line(nums []float64) string {
	if len(nums) == 0 {
		return ""
	}
	indices := normalize(nums)
	var sparkline bytes.Buffer
	for _, index := range indices {
		sparkline.WriteRune(steps[index])
	}
	return sparkline.String()
}
957030
func indentLines(source string, level int) string {
	return regexp.MustCompile("(?m:(^))").ReplaceAllString(source, strings.Repeat(" ", level))
}
549024
func (writer *baseFileWriter) RotateLines() int {
	writer.lock.RLock()
	defer writer.lock.RUnlock()
	return writer.rotateLines
}
652739
func writeProtoStringLines(w *bytes.Buffer, skip int, lines []string) {
	// equivalent to C's isprint.
	isprint := func(c byte) bool {
		return c >= 0x20 && c < 0x7f
	}

	w.WriteByte('"')
	for lIdx, line := range lines {
		if lIdx != 0 {
			// to get a "\\n".join(lines) effect: newlines between lines, but not
			// trailing.
			w.WriteString(`\n`)
		}
		// Loop over the bytes, not the runes.
		for i := skip; i < len(line); i++ {
			// Divergence from C++: we don't escape apostrophes.
			// There's no need to escape them, and the C++ parser
			// copes with a naked apostrophe.
			switch c := line[i]; c {
			case '\n':
				w.WriteString(`\n`)
			case '\r':
				w.WriteString(`\r`)
			case '\t':
				w.WriteString(`\t`)
			case '"':
				w.WriteString(`\"`)
			case '\\':
				w.WriteString(`\\`)
			default:
				if isprint(c) {
					w.WriteByte(c)
				} else {
					fmt.Fprintf(w, "\\%03o", c)
				}
			}
		}
	}
	w.WriteByte('"')
}
147119
func splitLine(line string) []string {
	if line == "" {
		return nil
	}
	if n := strings.IndexByte(line, '#'); n >= 0 {
		line = line[:n]
	}
	line = strings.Replace(line, "\t", " ", -1)
	line = strings.TrimSpace(line)

	var ss []string
	for _, s := range strings.Split(line, " ") {
		if s = strings.TrimSpace(s); s != "" {
			ss = append(ss, s)
		}
	}
	return ss
}
69823
func (f Frame) line() int {
	fn := runtime.FuncForPC(f.pc())
	if fn == nil {
		return 0
	}
	_, line := fn.FileLine(f.pc())
	return line
}
1213346
func (adapter *Decoder) Buffered() io.Reader {
	remaining := adapter.iter.buf[adapter.iter.head:adapter.iter.tail]
	return bytes.NewReader(remaining)
}
671319
func TrimLines(input []string) []string {
	result := make([]string, 0, len(input))
	for _, el := range input {
		result = append(result, strings.TrimSpace(el))
	}
	return result
}
468054
func (b *buffer) deleteLine() error {
	lines, err := b.end()
	if err != nil {
		return err
	}

	for lines > 0 {
		if _, err = term.Output.Write(DelLine_cursorUp); err != nil {
			return outputError(err.Error())
		}
		lines--
	}
	return nil
}
389068
func (p *pingCommand) sparkline() string {
	ticks := []string{"▁", "▂", "▃", "▄", "▅", "▆", "▇"}

	sort.Float64s(p.times)

	latest := p.times[len(p.times)-1]
	bcount := int(latest/50) + 1
	buckets := make([]int, bcount)

	for _, t := range p.times {
		b := int(t / 50.0)
		buckets[b]++
	}

	max := 0
	for _, cnt := range buckets {
		if max < cnt {
			max = cnt
		}
	}

	chars := make([]string, len(buckets))
	distance := float64(max) / float64(len(ticks)-1)

	for i, cnt := range buckets {
		tick := int(math.Round(float64(cnt) / distance))
		if tick < 0 {
			tick = 0
		}

		chars[i] = ticks[tick]
	}

	return strings.Join(chars, "")
}
241404
func (r *RefErrInvalidDetail) Lines() []string {
	lines := []string{r.Ref.String()}
	offset := len(r.Ref[:r.Pos].String()) + 1
	pad := strings.Repeat(" ", offset)
	lines = append(lines, fmt.Sprintf("%s^", pad))
	if r.Have != nil {
		lines = append(lines, fmt.Sprintf("%shave (type): %v", pad, r.Have))
	} else {
		lines = append(lines, fmt.Sprintf("%shave: %v", pad, r.Ref[r.Pos]))
	}
	if len(r.OneOf) > 0 {
		lines = append(lines, fmt.Sprintf("%swant (one of): %v", pad, r.OneOf))
	} else {
		lines = append(lines, fmt.Sprintf("%swant (type): %v", pad, r.Want))
	}
	return lines
}
431926
func indentLines(str string, indent string) string {
	if indent == "" {
		return str
	}

	var indented []string

	lines := strings.Split(str, "\n")
	for i, line := range lines {
		if (i == (len(lines) - 1)) && (line == "") {
			// input string ends with a new line
			indented = append(indented, line)
		} else {
			indented = append(indented, indent+line)
		}
	}

	return strings.Join(indented, "\n")
}
29299
func bufferStats(us []uint32) (BufferStats, error) {
	if l := len(us); l != 9 {
		return BufferStats{}, fmt.Errorf("incorrect number of values for XFS buffer stats: %d", l)
	}

	return BufferStats{
		Get:             us[0],
		Create:          us[1],
		GetLocked:       us[2],
		GetLockedWaited: us[3],
		BusyLocked:      us[4],
		MissLocked:      us[5],
		PageRetries:     us[6],
		PageFound:       us[7],
		GetRead:         us[8],
	}, nil
}
233112
func (r *RefErrUnsupportedDetail) Lines() []string {
	lines := []string{
		r.Ref.String(),
		strings.Repeat("^", len(r.Ref[:r.Pos+1].String())),
		fmt.Sprintf("have: %v", r.Have),
	}
	return lines
}