func (h *Content) DeleteAt(idx int, length int) {
	*h = append((*h)[0:idx], (*h)[idx+length:]...)
}
DeleteAt will remove a segment of content of the provided length starting at index idx.
package text
import (
	"fmt"
	"io"
	"unicode"
	"unicode/utf8"
	"github.com/gcla/gowid"
	"github.com/gcla/gowid/gwutil"
	"github.com/mattn/go-runewidth"
)
type ICursor interface {
	CursorEnabled() bool
	SetCursorDisabled()
	CursorPos() int
	SetCursorPos(pos int, app gowid.IApp)
}
type SimpleCursor struct {
	Pos int
}
func (c *SimpleCursor) CursorEnabled() bool {
	return c.Pos != -1
}
func (c *SimpleCursor) SetCursorDisabled() {
	c.Pos = -1
}
func (c *SimpleCursor) CursorPos() int {
	return c.Pos
}
func (c *SimpleCursor) SetCursorPos(pos int, app gowid.IApp) {
	c.Pos = pos
}
type ContentCB struct{}
type IContent interface {
	Length() int
	Width() int
	ChrAt(idx int) rune
	RangeOver(start, end int, attrs gowid.IRenderContext, proc gowid.ICellProcessor)
	AddAt(idx int, content ContentSegment)
	DeleteAt(idx, length int)
	fmt.Stringer
}
type ICloneContent interface {
	Clone() IContent
}
type ContentSegment struct {
	Style gowid.ICellStyler
	Text  string
}
func StringContent(s string) ContentSegment {
	return ContentSegment{nil, s}
}
func StyledContent(text string, style gowid.ICellStyler) ContentSegment {
	return ContentSegment{style, text}
}
type StyledRune struct {
	Chr  rune
	Attr gowid.ICellStyler
}
type Content []StyledRune
var _ IContent = (*Content)(nil)
var _ ICloneContent = (*Content)(nil)
func NewContent(content []ContentSegment) *Content {
	var length int
	for _, m := range content {
		length += len(m.Text)  
	}
	res := Content(make([]StyledRune, 0, length))
	for _, m := range content {
		res = append(res, MakeAttributedRunes(m)...)
	}
	return &res
}
func MakeAttributedRunes(m ContentSegment) []StyledRune {
	res := make([]StyledRune, 0, len(m.Text))  
	s := m.Text
	for len(s) > 0 {
		c, size := utf8.DecodeRuneInString(s)
		res = append(res, StyledRune{c, m.Style})
		s = s[size:]
	}
	return res
}
func (h *Content) Clone() IContent {
	runes := make([]StyledRune, len(*h))
	copy(runes, *h)
	res := Content(runes)
	return &res
}
func (h *Content) AddAt(idx int, content ContentSegment) {
	piece := MakeAttributedRunes(content)
	res := Content(make([]StyledRune, 0, len(piece)+len(*h)))
	res = append(res, (*h)[0:idx]...)
	res = append(res, piece...)
	res = append(res, (*h)[idx:]...)
	*h = res
}