on main help sign in
chore: upgrade bubbles v2 to latest v2-exp commit
commit6a0282e4fcd755ceac97122d0e3b54d9416c2880 authorAyman Bagabas <ayman.bagabas@gmail.com> dateThu 10 Jul 2025, 12:30 (1 year ago) parent3ec5d01
4 files changed+23−11
go.mod+1−1 go.sum+2 vendor/github.com/charmbracelet/bubbles/v2/textarea/textarea.go+19−9 vendor/modules.txt+1−1
go.mod+1−1
@@ -16,7 +16,7 @@ require (
1616 github.com/aymanbagabas/go-udiff v0.3.1
1717 github.com/bmatcuk/doublestar/v4 v4.8.1
1818 github.com/charlievieth/fastwalk v1.0.11
19− github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e
19+ github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250710161907-a4c42b579198
2020 github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1
2121 github.com/charmbracelet/fang v0.1.0
2222 github.com/charmbracelet/glamour/v2 v2.0.0-20250516160903-6f1e2c8f9ebe
go.sum+2
@@ -70,6 +70,8 @@ github.com/charlievieth/fastwalk v1.0.11 h1:5sLT/q9+d9xMdpKExawLppqvXFZCVKf6JHnr
7070github.com/charlievieth/fastwalk v1.0.11/go.mod h1:yGy1zbxog41ZVMcKA/i8ojXLFsuayX5VvwhQVoj9PBI=
7171github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e h1:99Ugtt633rqauFsXjZobZmtkNpeaWialfj8dl6COC6A=
7272github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e/go.mod h1:6HamsBKWqEC/FVHuQMHgQL+knPyvHH55HwJDHl/adMw=
73+github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250710161907-a4c42b579198 h1:CkMS9Ah9ac1Ego5JDC5NJyZyAAqu23Z+O0yDwsa3IxM=
74+github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250710161907-a4c42b579198/go.mod h1:6HamsBKWqEC/FVHuQMHgQL+knPyvHH55HwJDHl/adMw=
7375github.com/charmbracelet/bubbletea-internal/v2 v2.0.0-20250708152737-144080f3d891 h1:wh6N1dR4XkDh6XsiZh1/tImJAZvYB0yVLmaUKvJXvK0=
7476github.com/charmbracelet/bubbletea-internal/v2 v2.0.0-20250708152737-144080f3d891/go.mod h1:SwBB+WoaQVMMOM9hknbN/7FNT86kgKG0LSHGTmLphX8=
7577github.com/charmbracelet/colorprofile v0.3.1 h1:k8dTHMd7fgw4bnFd7jXTLZrSU/CQrKnL3m+AxCzDz40=
vendor/github.com/charmbracelet/bubbles/v2/textarea/textarea.go+19−9
@@ -133,6 +133,13 @@ type LineInfo struct {
133133 CharOffset int
134134}
135135
136+// PromptInfo is a struct that can be used to store information about the
137+// prompt.
138+type PromptInfo struct {
139+ LineNumber int
140+ Focused bool
141+}
142+
136143// CursorStyle is the style for real and virtual cursors.
137144type CursorStyle struct {
138145 // Style styles the cursor block.
@@ -287,7 +294,7 @@ type Model struct {
287294
288295 // If promptFunc is set, it replaces Prompt as a generator for
289296 // prompt strings at the beginning of each line.
290− promptFunc func(line int, focused bool) string
297+ promptFunc func(PromptInfo) string
291298
292299 // promptWidth is the width of the prompt.
293300 promptWidth int
@@ -983,14 +990,14 @@ func (m Model) Width() int {
983990 return m.width
984991}
985992
986−// moveToBegin moves the cursor to the beginning of the input.
987−func (m *Model) moveToBegin() {
993+// MoveToBegin moves the cursor to the beginning of the input.
994+func (m *Model) MoveToBegin() {
988995 m.row = 0
989996 m.SetCursorColumn(0)
990997}
991998
992−// moveToEnd moves the cursor to the end of the input.
993−func (m *Model) moveToEnd() {
999+// MoveToEnd moves the cursor to the end of the input.
1000+func (m *Model) MoveToEnd() {
9941001 m.row = len(m.value) - 1
9951002 m.SetCursorColumn(len(m.value[m.row]))
9961003}
@@ -1052,7 +1059,7 @@ func (m *Model) SetWidth(w int) {
10521059// promptWidth, it will be padded to the left. If it returns a prompt that is
10531060// longer, display artifacts may occur; the caller is responsible for computing
10541061// an adequate promptWidth.
1055−func (m *Model) SetPromptFunc(promptWidth int, fn func(lineIndex int, focused bool) string) {
1062+func (m *Model) SetPromptFunc(promptWidth int, fn func(PromptInfo) string) {
10561063 m.promptFunc = fn
10571064 m.promptWidth = promptWidth
10581065}
@@ -1170,9 +1177,9 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
11701177 case key.Matches(msg, m.KeyMap.WordBackward):
11711178 m.wordLeft()
11721179 case key.Matches(msg, m.KeyMap.InputBegin):
1173− m.moveToBegin()
1180+ m.MoveToBegin()
11741181 case key.Matches(msg, m.KeyMap.InputEnd):
1175− m.moveToEnd()
1182+ m.MoveToEnd()
11761183 case key.Matches(msg, m.KeyMap.LowercaseWordForward):
11771184 m.lowercaseRight()
11781185 case key.Matches(msg, m.KeyMap.UppercaseWordForward):
@@ -1320,7 +1327,10 @@ func (m Model) promptView(displayLine int) (prompt string) {
13201327 if m.promptFunc == nil {
13211328 return prompt
13221329 }
1323− prompt = m.promptFunc(displayLine, m.focus)
1330+ prompt = m.promptFunc(PromptInfo{
1331+ LineNumber: displayLine,
1332+ Focused: m.focus,
1333+ })
13241334 width := lipgloss.Width(prompt)
13251335 if width < m.promptWidth {
13261336 prompt = fmt.Sprintf("%*s%s", m.promptWidth-width, "", prompt)
vendor/modules.txt+1−1
@@ -242,7 +242,7 @@ github.com/bmatcuk/doublestar/v4
242242github.com/charlievieth/fastwalk
243243github.com/charlievieth/fastwalk/internal/dirent
244244github.com/charlievieth/fastwalk/internal/fmtdirent
245−# github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e
245+# github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250710161907-a4c42b579198
246246## explicit; go 1.23.0
247247github.com/charmbracelet/bubbles/v2/cursor
248248github.com/charmbracelet/bubbles/v2/filepicker