mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-23 22:32:59 +03:00
chore: Miscellaneous minor fixes (#243)
* chore: remove internal use of deprecated NewModel * chore: miscellaneous comment fixes
This commit is contained in:
parent
a4ed54327f
commit
72d87e4513
@ -183,18 +183,18 @@ type Model struct {
|
|||||||
func New(items []Item, delegate ItemDelegate, width, height int) Model {
|
func New(items []Item, delegate ItemDelegate, width, height int) Model {
|
||||||
styles := DefaultStyles()
|
styles := DefaultStyles()
|
||||||
|
|
||||||
sp := spinner.NewModel()
|
sp := spinner.New()
|
||||||
sp.Spinner = spinner.Line
|
sp.Spinner = spinner.Line
|
||||||
sp.Style = styles.Spinner
|
sp.Style = styles.Spinner
|
||||||
|
|
||||||
filterInput := textinput.NewModel()
|
filterInput := textinput.New()
|
||||||
filterInput.Prompt = "Filter: "
|
filterInput.Prompt = "Filter: "
|
||||||
filterInput.PromptStyle = styles.FilterPrompt
|
filterInput.PromptStyle = styles.FilterPrompt
|
||||||
filterInput.CursorStyle = styles.FilterCursor
|
filterInput.CursorStyle = styles.FilterCursor
|
||||||
filterInput.CharLimit = 64
|
filterInput.CharLimit = 64
|
||||||
filterInput.Focus()
|
filterInput.Focus()
|
||||||
|
|
||||||
p := paginator.NewModel()
|
p := paginator.New()
|
||||||
p.Type = paginator.Dots
|
p.Type = paginator.Dots
|
||||||
p.ActiveDot = styles.ActivePaginationDot.String()
|
p.ActiveDot = styles.ActivePaginationDot.String()
|
||||||
p.InactiveDot = styles.InactivePaginationDot.String()
|
p.InactiveDot = styles.InactivePaginationDot.String()
|
||||||
@ -221,7 +221,7 @@ func New(items []Item, delegate ItemDelegate, width, height int) Model {
|
|||||||
items: items,
|
items: items,
|
||||||
Paginator: p,
|
Paginator: p,
|
||||||
spinner: sp,
|
spinner: sp,
|
||||||
Help: help.NewModel(),
|
Help: help.New(),
|
||||||
}
|
}
|
||||||
|
|
||||||
m.updatePagination()
|
m.updatePagination()
|
||||||
@ -538,7 +538,6 @@ func (m Model) SettingFilter() bool {
|
|||||||
// It's purely a convenience method for the following:
|
// It's purely a convenience method for the following:
|
||||||
//
|
//
|
||||||
// m.FilterState() == FilterApplied
|
// m.FilterState() == FilterApplied
|
||||||
//
|
|
||||||
func (m Model) IsFiltered() bool {
|
func (m Model) IsFiltered() bool {
|
||||||
return m.filterState == FilterApplied
|
return m.filterState == FilterApplied
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,12 @@ const (
|
|||||||
defaultDamping = 1.0
|
defaultDamping = 1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
// Option is used to set options in NewModel. For example:
|
// Option is used to set options in New. For example:
|
||||||
//
|
//
|
||||||
// progress := NewModel(
|
// progress := New(
|
||||||
// WithRamp("#ff0000", "#0000ff"),
|
// WithRamp("#ff0000", "#0000ff"),
|
||||||
// WithoutPercentage(),
|
// WithoutPercentage(),
|
||||||
// )
|
// )
|
||||||
//
|
|
||||||
type Option func(*Model)
|
type Option func(*Model)
|
||||||
|
|
||||||
// WithDefaultGradient sets a gradient fill with default colors.
|
// WithDefaultGradient sets a gradient fill with default colors.
|
||||||
|
@ -85,7 +85,7 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// Model contains the state for the spinner. Use NewModel to create new models
|
// Model contains the state for the spinner. Use New to create new models
|
||||||
// rather than using Model as a struct literal.
|
// rather than using Model as a struct literal.
|
||||||
type Model struct {
|
type Model struct {
|
||||||
// Spinner settings to use. See type Spinner.
|
// Spinner settings to use. See type Spinner.
|
||||||
@ -209,7 +209,6 @@ func Tick() tea.Msg {
|
|||||||
// Option is used to set options in New. For example:
|
// Option is used to set options in New. For example:
|
||||||
//
|
//
|
||||||
// spinner := New(WithSpinner(Dot))
|
// spinner := New(WithSpinner(Dot))
|
||||||
//
|
|
||||||
type Option func(*Model)
|
type Option func(*Model)
|
||||||
|
|
||||||
// WithSpinner is an option to set the spinner.
|
// WithSpinner is an option to set the spinner.
|
||||||
|
@ -169,7 +169,7 @@ func (m Model) Focused() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Focus sets the focus state on the model. When the model is in focus it can
|
// Focus sets the focus state on the model. When the model is in focus it can
|
||||||
// receive keyboard input and the cursor will be hidden.
|
// receive keyboard input and the cursor will be shown.
|
||||||
func (m *Model) Focus() tea.Cmd {
|
func (m *Model) Focus() tea.Cmd {
|
||||||
m.focus = true
|
m.focus = true
|
||||||
return m.Cursor.Focus()
|
return m.Cursor.Focus()
|
||||||
|
Loading…
Reference in New Issue
Block a user