mirror of
https://github.com/charmbracelet/bubbles.git
synced 2026-07-22 11:39:28 -06:00
chore: fix lint issues (#534)
This commit is contained in:
parent
296fcf77fa
commit
11a9fccd58
11
help/help.go
11
help/help.go
@ -15,7 +15,6 @@ import (
|
||||
// Note that if a key is disabled (via key.Binding.SetEnabled) it will not be
|
||||
// rendered in the help view, so in theory generated help should self-manage.
|
||||
type KeyMap interface {
|
||||
|
||||
// ShortHelp returns a slice of bindings to be displayed in the short
|
||||
// version of the help. The help bubble will render help in the order in
|
||||
// which the help items are returned here.
|
||||
@ -82,10 +81,10 @@ func New() Model {
|
||||
ShortKey: keyStyle,
|
||||
ShortDesc: descStyle,
|
||||
ShortSeparator: sepStyle,
|
||||
Ellipsis: sepStyle.Copy(),
|
||||
FullKey: keyStyle.Copy(),
|
||||
FullDesc: descStyle.Copy(),
|
||||
FullSeparator: sepStyle.Copy(),
|
||||
Ellipsis: sepStyle,
|
||||
FullKey: keyStyle,
|
||||
FullDesc: descStyle,
|
||||
FullSeparator: sepStyle,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -118,7 +117,7 @@ func (m Model) ShortHelpView(bindings []key.Binding) string {
|
||||
|
||||
var b strings.Builder
|
||||
var totalWidth int
|
||||
var separator = m.Styles.ShortSeparator.Inline(true).Render(m.ShortSeparator)
|
||||
separator := m.Styles.ShortSeparator.Inline(true).Render(m.ShortSeparator)
|
||||
|
||||
for i, kb := range bindings {
|
||||
if !kb.Enabled() {
|
||||
|
||||
@ -37,7 +37,7 @@ func NewDefaultItemStyles() (s DefaultItemStyles) {
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"}).
|
||||
Padding(0, 0, 0, 2)
|
||||
|
||||
s.NormalDesc = s.NormalTitle.Copy().
|
||||
s.NormalDesc = s.NormalTitle.
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#A49FA5", Dark: "#777777"})
|
||||
|
||||
s.SelectedTitle = lipgloss.NewStyle().
|
||||
@ -46,14 +46,14 @@ func NewDefaultItemStyles() (s DefaultItemStyles) {
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"}).
|
||||
Padding(0, 0, 0, 1)
|
||||
|
||||
s.SelectedDesc = s.SelectedTitle.Copy().
|
||||
s.SelectedDesc = s.SelectedTitle.
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#F793FF", Dark: "#AD58B4"})
|
||||
|
||||
s.DimmedTitle = lipgloss.NewStyle().
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#A49FA5", Dark: "#777777"}).
|
||||
Padding(0, 0, 0, 2)
|
||||
|
||||
s.DimmedDesc = s.DimmedTitle.Copy().
|
||||
s.DimmedDesc = s.DimmedTitle.
|
||||
Foreground(lipgloss.AdaptiveColor{Light: "#C2B8C2", Dark: "#4D4D4D"})
|
||||
|
||||
s.FilterMatch = lipgloss.NewStyle().Underline(true)
|
||||
@ -187,7 +187,7 @@ func (d DefaultDelegate) Render(w io.Writer, m Model, index int, item Item) {
|
||||
if isFiltered {
|
||||
// Highlight matches
|
||||
unmatched := s.SelectedTitle.Inline(true)
|
||||
matched := unmatched.Copy().Inherit(s.FilterMatch)
|
||||
matched := unmatched.Inherit(s.FilterMatch)
|
||||
title = lipgloss.StyleRunes(title, matchedRunes, matched, unmatched)
|
||||
}
|
||||
title = s.SelectedTitle.Render(title)
|
||||
@ -196,7 +196,7 @@ func (d DefaultDelegate) Render(w io.Writer, m Model, index int, item Item) {
|
||||
if isFiltered {
|
||||
// Highlight matches
|
||||
unmatched := s.NormalTitle.Inline(true)
|
||||
matched := unmatched.Copy().Inherit(s.FilterMatch)
|
||||
matched := unmatched.Inherit(s.FilterMatch)
|
||||
title = lipgloss.StyleRunes(title, matchedRunes, matched, unmatched)
|
||||
}
|
||||
title = s.NormalTitle.Render(title)
|
||||
@ -204,10 +204,10 @@ func (d DefaultDelegate) Render(w io.Writer, m Model, index int, item Item) {
|
||||
}
|
||||
|
||||
if d.ShowDescription {
|
||||
fmt.Fprintf(w, "%s\n%s", title, desc)
|
||||
fmt.Fprintf(w, "%s\n%s", title, desc) //nolint: errcheck
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(w, "%s", title)
|
||||
fmt.Fprintf(w, "%s", title) //nolint: errcheck
|
||||
}
|
||||
|
||||
// ShortHelp returns the delegate's short help.
|
||||
|
||||
@ -1049,7 +1049,7 @@ func (m Model) View() string {
|
||||
func (m Model) titleView() string {
|
||||
var (
|
||||
view string
|
||||
titleBarStyle = m.Styles.TitleBar.Copy()
|
||||
titleBarStyle = m.Styles.TitleBar
|
||||
|
||||
// We need to account for the size of the spinner, even if we don't
|
||||
// render it, to reserve some space for it should we turn it on later.
|
||||
@ -1157,7 +1157,7 @@ func (m Model) paginationView() string {
|
||||
|
||||
style := m.Styles.PaginationStyle
|
||||
if m.delegate.Spacing() == 0 && style.GetMarginTop() == 0 {
|
||||
style = style.Copy().MarginTop(1)
|
||||
style = style.MarginTop(1)
|
||||
}
|
||||
|
||||
return style.Render(s)
|
||||
|
||||
@ -409,7 +409,7 @@ func (m *Model) FromValues(value, separator string) {
|
||||
type StyleFunc func(row, col int, value string) lipgloss.Style
|
||||
|
||||
func (m Model) headersView() string {
|
||||
var s = make([]string, 0, len(m.cols))
|
||||
s := make([]string, 0, len(m.cols))
|
||||
for _, col := range m.cols {
|
||||
if col.Width <= 0 {
|
||||
continue
|
||||
@ -422,7 +422,7 @@ func (m Model) headersView() string {
|
||||
}
|
||||
|
||||
func (m *Model) renderRow(r int) string {
|
||||
var s = make([]string, 0, len(m.cols))
|
||||
s := make([]string, 0, len(m.cols))
|
||||
for i, value := range m.rows[r] {
|
||||
if m.cols[i].Width <= 0 {
|
||||
continue
|
||||
|
||||
@ -30,8 +30,10 @@ const (
|
||||
)
|
||||
|
||||
// Internal messages for clipboard operations.
|
||||
type pasteMsg string
|
||||
type pasteErrMsg struct{ error }
|
||||
type (
|
||||
pasteMsg string
|
||||
pasteErrMsg struct{ error }
|
||||
)
|
||||
|
||||
// KeyMap is the key bindings for different actions within the textarea.
|
||||
type KeyMap struct {
|
||||
@ -606,8 +608,7 @@ func (m *Model) transposeLeft() {
|
||||
if m.col >= len(m.value[m.row]) {
|
||||
m.SetCursor(m.col - 1)
|
||||
}
|
||||
m.value[m.row][m.col-1], m.value[m.row][m.col] =
|
||||
m.value[m.row][m.col], m.value[m.row][m.col-1]
|
||||
m.value[m.row][m.col-1], m.value[m.row][m.col] = m.value[m.row][m.col], m.value[m.row][m.col-1]
|
||||
if m.col < len(m.value[m.row]) {
|
||||
m.SetCursor(m.col + 1)
|
||||
}
|
||||
|
||||
@ -17,8 +17,10 @@ import (
|
||||
)
|
||||
|
||||
// Internal messages for clipboard operations.
|
||||
type pasteMsg string
|
||||
type pasteErrMsg struct{ error }
|
||||
type (
|
||||
pasteMsg string
|
||||
pasteErrMsg struct{ error }
|
||||
)
|
||||
|
||||
// EchoMode sets the input behavior of the text input field.
|
||||
type EchoMode int
|
||||
|
||||
@ -378,7 +378,7 @@ func (m Model) View() string {
|
||||
MaxHeight(contentHeight). // truncate height if taller.
|
||||
MaxWidth(contentWidth). // truncate width if wider.
|
||||
Render(strings.Join(m.visibleLines(), "\n"))
|
||||
return m.Style.Copy().
|
||||
return m.Style.
|
||||
UnsetWidth().UnsetHeight(). // Style size already applied in contents.
|
||||
Render(contents)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user