func (r *LogsDisplay) DrawOriginList() {

	utility.WipeArea(0, 5, r.MarginPos, r.height-2, r.page.Foreground, r.page.Background)
	index := 0

	for _, origin := range r.originKeys {

		var bg termbox.Attribute
		fg := r.page.Foreground

		if r.LogOrigins[origin] {
			bg = termbox.ColorGreen
		} else {
			bg = termbox.ColorRed
		}

		if index == r.selectedOrigin {
			origin = fmt.Sprintf("> %s", origin)
			fg = termbox.ColorWhite | termbox.AttrBold
		} else {
			origin = fmt.Sprintf("  %s", origin)
		}

		origin = r.padRight(origin, " ", r.MarginPos)

		for i := 0; i < len(origin); i++ {
			termbox.SetCell(i, index+5, rune(origin[i]), fg, bg)
		}
		index++
	}
}
func (r *LogsDisplay) DrawLogBuffer() {
	utility.WipeArea(r.MarginPos+1, 3, r.width, r.height-2, r.page.Foreground, r.page.Background)

	paneStart := 3
	paneEnd := r.height - 2 // height in rows of the screen

	if len(r.lineBuffer) < (paneEnd - paneStart) { // adjust for length of the buffer
		paneStart = paneEnd - len(r.lineBuffer)
	}

	offset := len(r.lineBuffer) - (paneEnd - paneStart)

	if r.pagingMode {
		offset = r.pagingOffset
	}

	// look at
	for i := paneEnd; i > paneStart; i-- {
		line := r.lineBuffer[(i-paneStart)+offset-1]

		cursor := r.MarginPos + 1

		if line.Source != "" {
			source := fmt.Sprintf("[%s] ", line.Source)
			utility.WriteString(source, cursor, i-1, utility.ColorBrightGreen, r.page.Background)
			cursor += len(source)
		}

		if line.Indent {
			utility.WriteString(">> ", cursor, i-1, utility.ColorBrightGreen, r.page.Background)
			cursor += 3
		}

		utility.WriteString(line.Line, cursor, i-1, r.page.Foreground, r.page.Background)
	}

	if r.pagingMode {
		numberOfPages := math.Ceil(float64(len(r.lineBuffer)) / float64(r.height-5))
		currentPage := math.Ceil(float64(r.pagingOffset)/float64(r.height-5) + 1)

		// offSetIndicator := fmt.Sprintf(" %d / %d ", r.pagingOffset, len(r.lineBuffer))
		offSetIndicator := fmt.Sprintf(" %d / %d ", int(currentPage), int(numberOfPages))
		x := r.width - len(offSetIndicator)
		utility.WriteString(offSetIndicator, x, paneStart, r.page.Foreground, termbox.ColorRed)
	}
}