File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,6 @@ require (
4747 golang.org/x/text v0.24.0 // indirect
4848)
4949
50- replace charm.land/lipgloss/v2 v2.0.0-beta.3.0.20251205162909-7869489d8971 => ../../lipgloss
50+ replace charm.land/lipgloss/v2 v2.0.0 => ../../lipgloss
5151
5252replace charm.land/bubbles/v2 v2.0.0-beta.1.0.20251110211018-84a82dfeeed8 => ../../bubbles
Original file line number Diff line number Diff line change 1- charm.land/lipgloss/v2 v2.0.0 h1:sd8N/B3x892oiOjFfBQdXBQp3cAkvjGaU5TvVZC3ivo =
2- charm.land/lipgloss/v2 v2.0.0 /go.mod h1:w6SnmsBFBmEFBodiEDurGS/sdUY/u1+v72DqUzc6J14 =
31github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ =
42github.com/MakeNowJust/heredoc v1.0.0 /go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE =
53github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE =
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
2929 return m , cmd
3030}
3131
32- func (m model ) View () string {
33- return m .tree .View ()
32+ func (m model ) View () tea. View {
33+ return tea . NewView ( m .tree .View () )
3434}
3535
3636func main () {
Original file line number Diff line number Diff line change @@ -59,8 +59,8 @@ func (m *model) updateStyles() {
5959 })
6060}
6161
62- func (m model ) View () string {
63- return m .tree .View ()
62+ func (m model ) View () tea. View {
63+ return tea . NewView ( m .tree .View () )
6464}
6565
6666type file struct {
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
3131 return m , cmd
3232}
3333
34- func (m model ) View () string {
35- return m .tree .View ()
34+ func (m model ) View () tea. View {
35+ return tea . NewView ( m .tree .View () )
3636}
3737
3838func main () {
@@ -41,7 +41,8 @@ func main() {
4141 for year := thisYear ; year < thisYear + 10 ; year ++ {
4242 yRoot := tree .Root (fmt .Sprintf ("%d" , year )).Close ()
4343 for month := 1 ; month <= 12 ; month ++ {
44- mRoot := tree .Root (time .Month (month ).String ()).Close ().RootStyle (lipgloss .NewStyle ().Foreground (lipgloss .Color ("1" )))
44+ mRoot := tree .Root (time .Month (month ).String ()).Close ().RootStyle (
45+ lipgloss .NewStyle ().Foreground (lipgloss .Color ("1" )))
4546 for day := 1 ; day < daysIn (time .Month (month ), year ); day ++ {
4647 mRoot .Child (fmt .Sprintf ("%d" , day ))
4748 }
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ func (m *model) updateStyles() {
4242 })
4343}
4444
45- func (m model ) View () string {
45+ func (m model ) View () tea. View {
4646 pageNumbers := make ([]string , len (m .tree .AllNodes ()))
4747 for i , node := range m .tree .AllNodes () {
4848 v := node .GivenValue ()
@@ -56,18 +56,19 @@ func (m model) View() string {
5656 pageNumbers [i ] = num
5757 }
5858 }
59- return lipgloss .NewStyle ().Padding (1 ).Render (
59+ v := lipgloss .NewStyle ().Padding (1 ).Render (
6060 lipgloss .JoinHorizontal (
6161 lipgloss .Top ,
6262 m .tree .View (),
6363 lipgloss .JoinVertical (lipgloss .Left , pageNumbers ... )),
6464 )
65+
66+ return tea .NewView (v )
6567}
6668
6769const (
68- width = 60
69- height = 12
70- enumeratorWidth = 3
70+ width = 60
71+ height = 12
7172)
7273
7374func enumerator (_ ltree.Children , _ int ) string {
You can’t perform that action at this time.
0 commit comments