mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-05 04:36:07 +00:00
chore: merge branch 'v2-exp' into v2-area
This commit is contained in:
@@ -233,8 +233,8 @@ func (m Model) Height() int {
|
||||
}
|
||||
|
||||
// Init initializes the file picker model.
|
||||
func (m Model) Init() (Model, tea.Cmd) {
|
||||
return m, m.readDir(m.CurrentDirectory, m.ShowHidden)
|
||||
func (m Model) Init() tea.Cmd {
|
||||
return m.readDir(m.CurrentDirectory, m.ShowHidden)
|
||||
}
|
||||
|
||||
// Update handles user interactions within the file picker model.
|
||||
|
||||
@@ -5,7 +5,7 @@ go 1.18
|
||||
require (
|
||||
github.com/MakeNowJust/heredoc v1.0.0
|
||||
github.com/atotto/clipboard v0.1.4
|
||||
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250203222705-2e91ec2235cd
|
||||
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250204175057-2a96bc438da6
|
||||
github.com/charmbracelet/harmonica v0.2.0
|
||||
github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2.0.20250204145343-96725424379d
|
||||
github.com/charmbracelet/x/ansi v0.8.0
|
||||
|
||||
@@ -7,6 +7,8 @@ github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWp
|
||||
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
|
||||
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250203222705-2e91ec2235cd h1:u+kqgSbIL4pnP7huv4kaYUCmuN2L4yyDvdH81QJ4FZ0=
|
||||
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250203222705-2e91ec2235cd/go.mod h1:zaWGYfO6cBtu4dRgGbVN7yMYUz3j9sVIzHy2gn0jdo8=
|
||||
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250204175057-2a96bc438da6 h1:KbLqbYgHC5JZWks50WjBJr92Hs+GpiauwZaDObw9vxE=
|
||||
github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250204175057-2a96bc438da6/go.mod h1:zaWGYfO6cBtu4dRgGbVN7yMYUz3j9sVIzHy2gn0jdo8=
|
||||
github.com/charmbracelet/colorprofile v0.2.0 h1:iiIQlp3LSvoJPtR11KoDfIf9wqWm2mn/iU420rHOZ/A=
|
||||
github.com/charmbracelet/colorprofile v0.2.0/go.mod h1:6wPrSSR4QtwYtOY3h0bLRw5YOUAIKWlZIJ02CTAsZsk=
|
||||
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
|
||||
|
||||
@@ -182,8 +182,8 @@ func New(opts ...Option) Model {
|
||||
}
|
||||
|
||||
// Init exists to satisfy the tea.Model interface.
|
||||
func (m Model) Init() (Model, tea.Cmd) {
|
||||
return m, nil
|
||||
func (m Model) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Update is used to animate the progress bar during transitions. Use
|
||||
|
||||
@@ -80,8 +80,8 @@ func (m Model) ID() int {
|
||||
}
|
||||
|
||||
// Init starts the stopwatch.
|
||||
func (m Model) Init() (Model, tea.Cmd) {
|
||||
return m, m.Start()
|
||||
func (m Model) Init() tea.Cmd {
|
||||
return m.Start()
|
||||
}
|
||||
|
||||
// Start starts the stopwatch.
|
||||
|
||||
+9
-2
@@ -1,6 +1,7 @@
|
||||
package table
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/charmbracelet/lipgloss/v2"
|
||||
@@ -124,7 +125,7 @@ func TestTableAlignment(t *testing.T) {
|
||||
{"Hobnobs", "UK", "Yes"},
|
||||
}),
|
||||
)
|
||||
got := ansi.Strip(biscuits.View())
|
||||
got := ansiStrip(biscuits.View())
|
||||
golden.RequireEqual(t, []byte(got))
|
||||
})
|
||||
t.Run("With border", func(t *testing.T) {
|
||||
@@ -153,7 +154,13 @@ func TestTableAlignment(t *testing.T) {
|
||||
}),
|
||||
WithStyles(s),
|
||||
)
|
||||
got := ansi.Strip(baseStyle.Render(biscuits.View()))
|
||||
got := ansiStrip(baseStyle.Render(biscuits.View()))
|
||||
golden.RequireEqual(t, []byte(got))
|
||||
})
|
||||
}
|
||||
|
||||
func ansiStrip(s string) string {
|
||||
// Replace all \r\n with \n
|
||||
s = strings.ReplaceAll(s, "\r\n", "\n")
|
||||
return ansi.Strip(s)
|
||||
}
|
||||
|
||||
+2
-2
@@ -134,8 +134,8 @@ func (m Model) Timedout() bool {
|
||||
}
|
||||
|
||||
// Init starts the timer.
|
||||
func (m Model) Init() (Model, tea.Cmd) {
|
||||
return m, m.tick()
|
||||
func (m Model) Init() tea.Cmd {
|
||||
return m.tick()
|
||||
}
|
||||
|
||||
// Update handles the timer tick.
|
||||
|
||||
@@ -145,8 +145,8 @@ func (m *Model) setInitialValues() {
|
||||
}
|
||||
|
||||
// Init exists to satisfy the tea.Model interface for composability purposes.
|
||||
func (m Model) Init() (Model, tea.Cmd) {
|
||||
return m, nil
|
||||
func (m Model) Init() tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Height returns the height of the viewport.
|
||||
|
||||
Reference in New Issue
Block a user