func (c *Cursor) Backspace() {
	a := c.input
	i := c.Position
	if i == 0 {
		return
	}
	if i == len(a) {
		c.input = a[:i-1]
	} else {
		c.input = append(a[:i-1], a[i:]...)
	}
	c.Move(-1)
}
Backspace removes the rune that precedes the cursor

It handles being at the beginning or end of the row, and moves the cursor to
the appropriate position.
package promptui
import (
	"fmt"
	"strings"
)
type Pointer func(to []rune) []rune
func defaultCursor(ignored []rune) []rune {
	return []rune("\u2588")
}
func blockCursor(input []rune) []rune {
	return []rune(fmt.Sprintf("\\e[7m%s\\e[0m", string(input)))
}
func pipeCursor(input []rune) []rune {
	marker := []rune("|")
	out := []rune{}
	out = append(out, marker...)
	out = append(out, input...)
	return out
}
var (
	DefaultCursor Pointer = defaultCursor
	BlockCursor Pointer = blockCursor
	PipeCursor Pointer = pipeCursor
)
type Cursor struct {
	Cursor Pointer
	input []rune
	Position int
	erase    bool
}
func NewCursor(startinginput string, pointer Pointer, eraseDefault bool) Cursor {
	if pointer == nil {
		pointer = defaultCursor
	}
	cur := Cursor{Cursor: pointer, Position: len(startinginput), input: []rune(startinginput), erase: eraseDefault}
	if eraseDefault {
		cur.Start()
	} else {
		cur.End()
	}
	return cur
}
func (c *Cursor) String() string {
	return fmt.Sprintf(
		"Cursor: %s, input %s, Position %d",
		string(c.Cursor([]rune(""))), string(c.input), c.Position)
}
func (c *Cursor) End() {
	c.Place(len(c.input))
}
func (c *Cursor) Start() {
	c.Place(0)
}
func (c *Cursor) correctPosition() {
	if c.Position > len(c.input) {
		c.Position = len(c.input)
	}
	if c.Position < 0 {
		c.Position = 0
	}
}
func format(a []rune, c *Cursor) string {
	i := c.Position
	var b []rune
	out := make([]rune, 0)
	if i < len(a) {
		b = c.Cursor(a[i : i+1])
		out = append(out, a[:i]...)    
		out = append(out, b...)        
		out = append(out, a[i+1:]...)  
	} else {
		b = c.Cursor([]rune{})
		out = append(out, a...)
		out = append(out, b...)
	}
	return string(out)
}
func (c *Cursor) Format() string {
	r := c.input
	return format(r, c)
}
func (c *Cursor) FormatMask(mask rune) string {
	if mask == ' ' {
		return format([]rune{}, c)
	}
	r := make([]rune, len(c.input))
	for i := range r {
		r[i] = mask
	}
	return format(r, c)
}
func (c *Cursor) Update(newinput string) {
	a := c.input
	b := []rune(newinput)
	i := c.Position
	a = append(a[:i], append(b, a[i:]...)...)
	c.input = a
	c.Move(len(b))
}
func (c *Cursor) Get() string {
	return string(c.input)
}
func (c *Cursor) GetMask(mask rune) string {
	return strings.Repeat(string(mask), len(c.input))
}
func (c *Cursor) Replace(input string) {
	c.input = []rune(input)
	c.End()
}
func (c *Cursor) Place(position int) {
	c.Position = position
	c.correctPosition()
}
func (c *Cursor) Move(shift int) {
	c.Position = c.Position + shift
	c.correctPosition()
}