func (m *Model) indexBackward() {
	m.index--
	if m.index < textInput {
		m.index = cancelButton
	}
	m.updateFocus()
}
Move the focus index one unit backwards.
package username
import (
	"strings"
	"github.com/charmbracelet/bubbles/spinner"
	input "github.com/charmbracelet/bubbles/textinput"
	tea "github.com/charmbracelet/bubbletea"
	"github.com/charmbracelet/charm"
	"github.com/charmbracelet/charm/ui/common"
	te "github.com/muesli/termenv"
)
type state int
const (
	ready state = iota
	submitting
)
type index int
const (
	textInput index = iota
	okButton
	cancelButton
)
const prompt = "> "
var focusedPrompt = te.String(prompt).Foreground(common.Fuschia.Color()).String()
type NameSetMsg string
type NameTakenMsg struct{}
type NameInvalidMsg struct{}
type errMsg struct{ err error }
func (e errMsg) Error() string { return e.err.Error() }
type Model struct {
	Done bool  
	Quit bool  
	cc      *charm.Client
	state   state
	newName string
	index   index
	errMsg  string
	input   input.Model
	spinner spinner.Model
}
func (m *Model) updateFocus() {
	if m.index == textInput && !m.input.Focused() {
		m.input.Focus()
		m.input.Prompt = focusedPrompt
	} else if m.index != textInput && m.input.Focused() {
		m.input.Blur()
		m.input.Prompt = prompt
	}
}
func (m *Model) indexForward() {
	m.index++
	if m.index > cancelButton {
		m.index = textInput
	}
	m.updateFocus()
}