From 091c9154624724413b395aeb735893af266acd81 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Tue, 18 Jan 2022 17:15:38 -0500 Subject: [PATCH] Fix various godoc comments --- help/help.go | 7 ++++++- list/list.go | 2 ++ progress/progress.go | 8 +++++++- textinput/textinput.go | 4 ++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/help/help.go b/help/help.go index 04ad4c6..6db0649 100644 --- a/help/help.go +++ b/help/help.go @@ -165,7 +165,12 @@ func (m Model) FullHelpView(groups [][]key.Binding) string { } var ( - out []string + // Linter note: at this time we don't think it's worth the additional + // code complexity involved in preallocating this slice. + // + //nolint:prealloc + out []string + totalWidth int sep = m.Styles.FullSeparator.Render(m.FullSeparator) sepWidth = lipgloss.Width(sep) diff --git a/list/list.go b/list/list.go index 3fb095a..4850390 100644 --- a/list/list.go +++ b/list/list.go @@ -75,6 +75,8 @@ func (f filteredItems) matches() [][]int { return agg } +// FilterMatchesMsg contains data about items matched during filtering. The +// message should be routed to Update for processing. type FilterMatchesMsg []filteredItem type statusMessageTimeoutMsg struct{} diff --git a/progress/progress.go b/progress/progress.go index 038e7b2..42a6abe 100644 --- a/progress/progress.go +++ b/progress/progress.go @@ -98,6 +98,11 @@ func WithWidth(w int) Option { } } +// WithSpringOptions sets the initial frequency and damping options for the +// progressbar's built-in spring-based animation. Frequency corresponds to +// speed, and damping to bounciness. For details see: +// +// https://github.com/charmbracelet/harmonica func WithSpringOptions(frequency, damping float64) Option { return func(m *Model) { m.SetSpringOptions(frequency, damping) @@ -213,7 +218,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // SetSpringOptions sets the frequency and damping for the current spring. // Frequency corresponds to speed, and damping to bounciness. For details see: -// https://github.com/charmbracelet/harmonica. +// +// https://github.com/charmbracelet/harmonica func (m *Model) SetSpringOptions(frequency, damping float64) { m.spring = harmonica.NewSpring(harmonica.FPS(fps), frequency, damping) } diff --git a/textinput/textinput.go b/textinput/textinput.go index 6f3481e..38f8af5 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -62,7 +62,7 @@ const ( // seen for password fields on the command line. EchoNone - // EchoOnEdit + // EchoOnEdit. ) // blinkCtx manages cursor blinking. @@ -234,7 +234,7 @@ func (m *Model) cursorStart() bool { return m.setCursor(0) } -// CursorEnd moves the cursor to the end of the input field +// CursorEnd moves the cursor to the end of the input field. func (m *Model) CursorEnd() { m.cursorEnd() }