on main help sign in
chore: upgrade bubbles v2 to latest v2-exp commit
6a0282eAyman Bagabas
go.mod+1−1
@@ -16,7 +16,7 @@ require (
16 github.com/aymanbagabas/go-udiff v0.3.1
16 github.com/aymanbagabas/go-udiff v0.3.1
17 github.com/bmatcuk/doublestar/v4 v4.8.1
17 github.com/bmatcuk/doublestar/v4 v4.8.1
18 github.com/charlievieth/fastwalk v1.0.11
18 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
20 github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1
20 github.com/charmbracelet/bubbletea/v2 v2.0.0-beta.1
21 github.com/charmbracelet/fang v0.1.0
21 github.com/charmbracelet/fang v0.1.0
22 github.com/charmbracelet/glamour/v2 v2.0.0-20250516160903-6f1e2c8f9ebe
22 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
70github.com/charlievieth/fastwalk v1.0.11/go.mod h1:yGy1zbxog41ZVMcKA/i8ojXLFsuayX5VvwhQVoj9PBI=
70github.com/charlievieth/fastwalk v1.0.11/go.mod h1:yGy1zbxog41ZVMcKA/i8ojXLFsuayX5VvwhQVoj9PBI=
71github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e h1:99Ugtt633rqauFsXjZobZmtkNpeaWialfj8dl6COC6A=
71github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e h1:99Ugtt633rqauFsXjZobZmtkNpeaWialfj8dl6COC6A=
72github.com/charmbracelet/bubbles/v2 v2.0.0-beta.1.0.20250607113720-eb5e1cf3b09e/go.mod h1:6HamsBKWqEC/FVHuQMHgQL+knPyvHH55HwJDHl/adMw=
72github.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=
73github.com/charmbracelet/bubbletea-internal/v2 v2.0.0-20250708152737-144080f3d891 h1:wh6N1dR4XkDh6XsiZh1/tImJAZvYB0yVLmaUKvJXvK0=
75github.com/charmbracelet/bubbletea-internal/v2 v2.0.0-20250708152737-144080f3d891 h1:wh6N1dR4XkDh6XsiZh1/tImJAZvYB0yVLmaUKvJXvK0=
74github.com/charmbracelet/bubbletea-internal/v2 v2.0.0-20250708152737-144080f3d891/go.mod h1:SwBB+WoaQVMMOM9hknbN/7FNT86kgKG0LSHGTmLphX8=
76github.com/charmbracelet/bubbletea-internal/v2 v2.0.0-20250708152737-144080f3d891/go.mod h1:SwBB+WoaQVMMOM9hknbN/7FNT86kgKG0LSHGTmLphX8=
75github.com/charmbracelet/colorprofile v0.3.1 h1:k8dTHMd7fgw4bnFd7jXTLZrSU/CQrKnL3m+AxCzDz40=
77github.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 {
133 CharOffset int
133 CharOffset int
134}
134}
135
135
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+
136// CursorStyle is the style for real and virtual cursors.
143// CursorStyle is the style for real and virtual cursors.
137type CursorStyle struct {
144type CursorStyle struct {
138 // Style styles the cursor block.
145 // Style styles the cursor block.
@@ -287,7 +294,7 @@ type Model struct {
287
294
288 // If promptFunc is set, it replaces Prompt as a generator for
295 // If promptFunc is set, it replaces Prompt as a generator for
289 // prompt strings at the beginning of each line.
296 // prompt strings at the beginning of each line.
290− promptFunc func(line int, focused bool) string
297+ promptFunc func(PromptInfo) string
291
298
292 // promptWidth is the width of the prompt.
299 // promptWidth is the width of the prompt.
293 promptWidth int
300 promptWidth int
@@ -983,14 +990,14 @@ func (m Model) Width() int {
983 return m.width
990 return m.width
984}
991}
985
992
986−// moveToBegin moves the cursor to the beginning of the input.
993+// MoveToBegin moves the cursor to the beginning of the input.
987−func (m *Model) moveToBegin() {
994+func (m *Model) MoveToBegin() {
988 m.row = 0
995 m.row = 0
989 m.SetCursorColumn(0)
996 m.SetCursorColumn(0)
990}
997}
991
998
992−// moveToEnd moves the cursor to the end of the input.
999+// MoveToEnd moves the cursor to the end of the input.
993−func (m *Model) moveToEnd() {
1000+func (m *Model) MoveToEnd() {
994 m.row = len(m.value) - 1
1001 m.row = len(m.value) - 1
995 m.SetCursorColumn(len(m.value[m.row]))
1002 m.SetCursorColumn(len(m.value[m.row]))
996}
1003}
@@ -1052,7 +1059,7 @@ func (m *Model) SetWidth(w int) {
1052// promptWidth, it will be padded to the left. If it returns a prompt that is
1059// promptWidth, it will be padded to the left. If it returns a prompt that is
1053// longer, display artifacts may occur; the caller is responsible for computing
1060// longer, display artifacts may occur; the caller is responsible for computing
1054// an adequate promptWidth.
1061// 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) {
1056 m.promptFunc = fn
1063 m.promptFunc = fn
1057 m.promptWidth = promptWidth
1064 m.promptWidth = promptWidth
1058}
1065}
@@ -1170,9 +1177,9 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
1170 case key.Matches(msg, m.KeyMap.WordBackward):
1177 case key.Matches(msg, m.KeyMap.WordBackward):
1171 m.wordLeft()
1178 m.wordLeft()
1172 case key.Matches(msg, m.KeyMap.InputBegin):
1179 case key.Matches(msg, m.KeyMap.InputBegin):
1173− m.moveToBegin()
1180+ m.MoveToBegin()
1174 case key.Matches(msg, m.KeyMap.InputEnd):
1181 case key.Matches(msg, m.KeyMap.InputEnd):
1175− m.moveToEnd()
1182+ m.MoveToEnd()
1176 case key.Matches(msg, m.KeyMap.LowercaseWordForward):
1183 case key.Matches(msg, m.KeyMap.LowercaseWordForward):
1177 m.lowercaseRight()
1184 m.lowercaseRight()
1178 case key.Matches(msg, m.KeyMap.UppercaseWordForward):
1185 case key.Matches(msg, m.KeyMap.UppercaseWordForward):
@@ -1320,7 +1327,10 @@ func (m Model) promptView(displayLine int) (prompt string) {
1320 if m.promptFunc == nil {
1327 if m.promptFunc == nil {
1321 return prompt
1328 return prompt
1322 }
1329 }
1323− prompt = m.promptFunc(displayLine, m.focus)
1330+ prompt = m.promptFunc(PromptInfo{
1331+ LineNumber: displayLine,
1332+ Focused: m.focus,
1333+ })
1324 width := lipgloss.Width(prompt)
1334 width := lipgloss.Width(prompt)
1325 if width < m.promptWidth {
1335 if width < m.promptWidth {
1326 prompt = fmt.Sprintf("%*s%s", m.promptWidth-width, "", prompt)
1336 prompt = fmt.Sprintf("%*s%s", m.promptWidth-width, "", prompt)
vendor/modules.txt+1−1
@@ -242,7 +242,7 @@ github.com/bmatcuk/doublestar/v4
242github.com/charlievieth/fastwalk
242github.com/charlievieth/fastwalk
243github.com/charlievieth/fastwalk/internal/dirent
243github.com/charlievieth/fastwalk/internal/dirent
244github.com/charlievieth/fastwalk/internal/fmtdirent
244github.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
246## explicit; go 1.23.0
246## explicit; go 1.23.0
247github.com/charmbracelet/bubbles/v2/cursor
247github.com/charmbracelet/bubbles/v2/cursor
248github.com/charmbracelet/bubbles/v2/filepicker
248github.com/charmbracelet/bubbles/v2/filepicker