Skip to content
Myr

docs: fix typos and clean up comments

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Glenn Gonda · committed by Christian Rocha · parent 76c3c1a · Browse files · 9 files+12 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

9 files+12 added−12 removed

  • other:+12 added−12 removed

9 files+12 added−12 removed

modified:examples/credit-card-form/main.go+1 added-1 removed
69 unmodified lines
70}7172func expValidator(s string) error {73 // The 3 character should be a slash (/)74 // The rest thould be numbers74 // The rest should be numbers75 e := strings.ReplaceAll(s, "/", "")76 _, err := strconv.ParseInt(e, 10, 64)77 if err != nil {78 return fmt.Errorf("EXP is invalid")
123 unmodified lines
modified:examples/help/main.go+1 added-1 removed
85 unmodified lines
8687func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {88 switch msg := msg.(type) {89 case tea.WindowSizeMsg:90 // If we set a width on the help menu it can it can gracefully truncate90 // If we set a width on the help menu it can gracefully truncate91 // its view as needed.92 m.help.Width = msg.Width9394 case tea.KeyMsg:
53 unmodified lines
modified:examples/simple/main.go+1 added-1 removed
54 unmodified lines
55 }56 return m, nil57}5859// Views return a string based on data in the model. That string which will be59// View returns a string based on data in the model. That string which will be60// rendered to the terminal.61func (m model) View() string {62 return fmt.Sprintf("Hi. This program will exit in %d seconds. To quit sooner press any key.\n", m)63}
9 unmodified lines
modified:examples/textarea/main.go+1 added-1 removed
1package main23// A simple program demonstrating the text input component from the Bubbles3// A simple program demonstrating the textarea component from the Bubbles4// component library.56import (7 "fmt"
74 unmodified lines
modified:examples/tui-daemon-combo/main.go+1 added-1 removed
121 unmodified lines
122123 return indent.String(s, 1)124}125126// processFinishedMsg is send when a pretend process completes.126// processFinishedMsg is sent when a pretend process completes.127type processFinishedMsg time.Duration128129// pretendProcess simulates a long-running process.130func runPretendProcess() tea.Msg {
9 unmodified lines
modified:tutorials/basics/main.go+1 added-1 removed
16 unmodified lines
17 return model{18 choices: []string{"Buy carrots", "Buy celery", "Buy kohlrabi"},1920 // A map which indicates which choices are selected. We're using21 // the map like a mathematical set. The keys refer to the indexes21 // the map like a mathematical set. The keys refer to the indexes22 // of the `choices` slice, above.23 selected: make(map[int]struct{}),24 }25}
61 unmodified lines
modified:tutorials/basics/README.md+2 added-2 removed
62 unmodified lines
63 // Our to-do list is a grocery list64 choices: []string{"Buy carrots", "Buy celery", "Buy kohlrabi"},6566 // A map which indicates which choices are selected. We're using67 // the map like a mathematical set. The keys refer to the indexes67 // the map like a mathematical set. The keys refer to the indexes68 // of the `choices` slice, above.69 selected: make(map[int]struct{}),70 }71}
81 unmodified lines
153## The View Method154155At last, it’s time to render our UI. Of all the methods, the view is the156simplest. We look at the model in its current state and use it to return157a `string`. That string is our UI!157a `string`. That string is our UI!158159Because the view describes the entire UI of your application, you don’t have to160worry about redrawing logic and stuff like that. Bubble Tea takes care of it161for you.
81 unmodified lines
modified:mouse.go+2 added-2 removed
3 unmodified lines
4 "bytes"5 "errors"6)78// MouseMsg contains information about a mouse event and are sent to a programs8// MouseMsg contains information about a mouse event and is sent to a program's9// update function when mouse activity occurs. Note that the mouse must first10// be enabled via in order the mouse events to be received.10// be enabled in order for the mouse events to be received.11type MouseMsg MouseEvent1213// MouseEvent represents a mouse event, which could be a click, a scroll wheel14// movement, a cursor movement, or a combination.
135 unmodified lines
modified:options.go+2 added-2 removed
39 unmodified lines
40 p.startupOptions |= withCustomInput41 }42}4344// WithInputTTY open a new TTY for input (or console input device on Windows).44// WithInputTTY opens a new TTY for input (or console input device on Windows).45func WithInputTTY() ProgramOption {46 return func(p *Program) {47 p.startupOptions |= withInputTTY48 }
94 unmodified lines
143144// WithANSICompressor removes redundant ANSI sequences to produce potentially145// smaller output, at the cost of some processing overhead.146//147// This feature is provisional, and may be changed removed in a future version147// This feature is provisional, and may be changed or removed in a future version148// of this package.149func WithANSICompressor() ProgramOption {150 return func(p *Program) {151 p.startupOptions |= withANSICompressor
2 unmodified lines