forked from Mirrors/bubbletea
docs: fix typos and clean up comments
This commit is contained in:
parent
76c3c1a221
commit
4880cf2a09
|
@ -71,7 +71,7 @@ func ccnValidator(s string) error {
|
||||||
|
|
||||||
func expValidator(s string) error {
|
func expValidator(s string) error {
|
||||||
// The 3 character should be a slash (/)
|
// The 3 character should be a slash (/)
|
||||||
// The rest thould be numbers
|
// The rest should be numbers
|
||||||
e := strings.ReplaceAll(s, "/", "")
|
e := strings.ReplaceAll(s, "/", "")
|
||||||
_, err := strconv.ParseInt(e, 10, 64)
|
_, err := strconv.ParseInt(e, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -87,7 +87,7 @@ func (m model) Init() tea.Cmd {
|
||||||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case tea.WindowSizeMsg:
|
case tea.WindowSizeMsg:
|
||||||
// If we set a width on the help menu it can it can gracefully truncate
|
// If we set a width on the help menu it can gracefully truncate
|
||||||
// its view as needed.
|
// its view as needed.
|
||||||
m.help.Width = msg.Width
|
m.help.Width = msg.Width
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Views return a string based on data in the model. That string which will be
|
// View returns a string based on data in the model. That string which will be
|
||||||
// rendered to the terminal.
|
// rendered to the terminal.
|
||||||
func (m model) View() string {
|
func (m model) View() string {
|
||||||
return fmt.Sprintf("Hi. This program will exit in %d seconds. To quit sooner press any key.\n", m)
|
return fmt.Sprintf("Hi. This program will exit in %d seconds. To quit sooner press any key.\n", m)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// A simple program demonstrating the text input component from the Bubbles
|
// A simple program demonstrating the textarea component from the Bubbles
|
||||||
// component library.
|
// component library.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (m model) View() string {
|
||||||
return indent.String(s, 1)
|
return indent.String(s, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// processFinishedMsg is send when a pretend process completes.
|
// processFinishedMsg is sent when a pretend process completes.
|
||||||
type processFinishedMsg time.Duration
|
type processFinishedMsg time.Duration
|
||||||
|
|
||||||
// pretendProcess simulates a long-running process.
|
// pretendProcess simulates a long-running process.
|
||||||
|
|
4
mouse.go
4
mouse.go
|
@ -5,9 +5,9 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MouseMsg contains information about a mouse event and are sent to a programs
|
// MouseMsg contains information about a mouse event and is sent to a program's
|
||||||
// update function when mouse activity occurs. Note that the mouse must first
|
// update function when mouse activity occurs. Note that the mouse must first
|
||||||
// be enabled via in order the mouse events to be received.
|
// be enabled in order for the mouse events to be received.
|
||||||
type MouseMsg MouseEvent
|
type MouseMsg MouseEvent
|
||||||
|
|
||||||
// MouseEvent represents a mouse event, which could be a click, a scroll wheel
|
// MouseEvent represents a mouse event, which could be a click, a scroll wheel
|
||||||
|
|
|
@ -41,7 +41,7 @@ func WithInput(input io.Reader) ProgramOption {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithInputTTY open a new TTY for input (or console input device on Windows).
|
// WithInputTTY opens a new TTY for input (or console input device on Windows).
|
||||||
func WithInputTTY() ProgramOption {
|
func WithInputTTY() ProgramOption {
|
||||||
return func(p *Program) {
|
return func(p *Program) {
|
||||||
p.startupOptions |= withInputTTY
|
p.startupOptions |= withInputTTY
|
||||||
|
@ -144,7 +144,7 @@ func WithoutRenderer() ProgramOption {
|
||||||
// WithANSICompressor removes redundant ANSI sequences to produce potentially
|
// WithANSICompressor removes redundant ANSI sequences to produce potentially
|
||||||
// smaller output, at the cost of some processing overhead.
|
// smaller output, at the cost of some processing overhead.
|
||||||
//
|
//
|
||||||
// This feature is provisional, and may be changed removed in a future version
|
// This feature is provisional, and may be changed or removed in a future version
|
||||||
// of this package.
|
// of this package.
|
||||||
func WithANSICompressor() ProgramOption {
|
func WithANSICompressor() ProgramOption {
|
||||||
return func(p *Program) {
|
return func(p *Program) {
|
||||||
|
|
Loading…
Reference in New Issue