func sliceEnd(slc []byte, index int) []byte {
	len := len(slc)
	i := 0
	totalSize := 0
	for totalSize < len {
		if i >= index {
			return slc[:totalSize]
		}
		_, size := utf8.DecodeRune(slc[totalSize:])
		totalSize += size
		i++
	}
	return slc[:totalSize]
}
func sliceStart(slc []byte, index int) []byte {
len := len(slc)
i := 0
totalSize := 0
for totalSize < len {
if i >= index {
return slc[totalSize:]
}

_, size := utf8.DecodeRune(slc[totalSize:])
totalSize += size
i++
}

return slc[totalSize:]
}
package editor
import (
	"os"
	"path/filepath"
	"reflect"
	"runtime"
	"strconv"
	"strings"
	"time"
	"unicode/utf8"
	"regexp"
	runewidth "github.com/mattn/go-runewidth"
)
func Count(s string) int {
	return utf8.RuneCountInString(s)
}
func toRunes(b []byte) []rune {
	runes := make([]rune, 0, utf8.RuneCount(b))
	for len(b) > 0 {
		r, size := utf8.DecodeRune(b)
		runes = append(runes, r)
		b = b[size:]
	}
	return runes
}