forked from Mirrors/bubbletea
Fix various typos in examples
This commit is contained in:
parent
d2c1d9bfb0
commit
b6c7f93d9a
|
@ -123,7 +123,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
// Because we're using the viewport's default update function (with pager-
|
// Because we're using the viewport's default update function (with pager-
|
||||||
// style navigation) it's important that the viewport's update function:
|
// style navigation) it's important that the viewport's update function:
|
||||||
//
|
//
|
||||||
// * Recieves messages from the Bubble Tea runtime
|
// * Receives messages from the Bubble Tea runtime
|
||||||
// * Returns commands to the Bubble Tea runtime
|
// * Returns commands to the Bubble Tea runtime
|
||||||
//
|
//
|
||||||
m.viewport, cmd = m.viewport.Update(msg)
|
m.viewport, cmd = m.viewport.Update(msg)
|
||||||
|
@ -136,7 +136,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
|
|
||||||
func (m model) View() string {
|
func (m model) View() string {
|
||||||
if !m.ready {
|
if !m.ready {
|
||||||
return "\n Initalizing..."
|
return "\n Initializing..."
|
||||||
}
|
}
|
||||||
|
|
||||||
headerTop := "╭───────────╮"
|
headerTop := "╭───────────╮"
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A message used to indicate that activity has occured. In the real world (for
|
// A message used to indicate that activity has occurred. In the real world (for
|
||||||
// example, chat) this would contain actual data.
|
// example, chat) this would contain actual data.
|
||||||
type responseMsg struct{}
|
type responseMsg struct{}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ func (m model) Init() tea.Cmd {
|
||||||
return tick
|
return tick
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called when messages are recived. The idea is that you inspect the
|
// Update is called when messages are received. The idea is that you inspect the
|
||||||
// message and send back an updated model accordingly. You can also return
|
// message and send back an updated model accordingly. You can also return
|
||||||
// a commmand, which is a function that peforms I/O and returns a message.
|
// a command, which is a function that peforms I/O and returns a message.
|
||||||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
switch msg.(type) {
|
switch msg.(type) {
|
||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
|
|
|
@ -86,7 +86,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hand off the message and model to the approprate update function for the
|
// Hand off the message and model to the appropriate update function for the
|
||||||
// appropriate view based on the current state.
|
// appropriate view based on the current state.
|
||||||
if !m.Chosen {
|
if !m.Chosen {
|
||||||
return updateChoices(msg, m)
|
return updateChoices(msg, m)
|
||||||
|
@ -94,7 +94,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
return updateChosen(msg, m)
|
return updateChosen(msg, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The main view, which just calls the approprate sub-view
|
// The main view, which just calls the appropriate sub-view
|
||||||
func (m model) View() string {
|
func (m model) View() string {
|
||||||
var s string
|
var s string
|
||||||
if m.Quitting {
|
if m.Quitting {
|
||||||
|
@ -273,7 +273,7 @@ func makeRamp(colorA, colorB string, steps float64) (s []string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert a colorful.Color to a hexidecimal format compatible with termenv.
|
// Convert a colorful.Color to a hexadecimal format compatible with termenv.
|
||||||
func colorToHex(c colorful.Color) string {
|
func colorToHex(c colorful.Color) string {
|
||||||
return fmt.Sprintf("#%s%s%s", colorFloatToHex(c.R), colorFloatToHex(c.G), colorFloatToHex(c.B))
|
return fmt.Sprintf("#%s%s%s", colorFloatToHex(c.R), colorFloatToHex(c.G), colorFloatToHex(c.B))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue