From fbe642df174c024b1ce775bd0780657a21e00437 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 14 Jan 2025 15:34:37 -0300 Subject: [PATCH] chore(deps): update --- go.mod | 9 +++++---- go.sum | 18 ++++++++++-------- textinput/textinput.go | 2 +- textinput/textinput_test.go | 2 +- viewport/viewport_test.go | 32 ++++++++++++++++---------------- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index b7e692410..f1f143123 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ 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.20241126192050-a8ed96118b08 + github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250114183054-9f703251e0d7 github.com/charmbracelet/harmonica v0.2.0 - github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2.0.20241121164047-8448a9be4804 + github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2.0.20250114171829-b67eb015d607 github.com/charmbracelet/x/ansi v0.7.0 github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 github.com/dustin/go-humanize v1.0.1 @@ -21,6 +21,7 @@ require ( github.com/aymanbagabas/go-udiff v0.2.0 // indirect github.com/charmbracelet/colorprofile v0.1.8 // indirect github.com/charmbracelet/x/cellbuf v0.0.6 // indirect + github.com/charmbracelet/x/input v0.3.0 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/charmbracelet/x/vt v0.0.0-20241121165045-a3720547cbb4 // indirect github.com/charmbracelet/x/wcwidth v0.0.0-20241113152101-0af7d04e9f32 // indirect @@ -28,7 +29,7 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - golang.org/x/sync v0.9.0 // indirect - golang.org/x/sys v0.27.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.20.0 // indirect ) diff --git a/go.sum b/go.sum index b247fb4e7..9b0b8811f 100644 --- a/go.sum +++ b/go.sum @@ -4,20 +4,22 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8= 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.20241126192050-a8ed96118b08 h1:8hwULvCHjF6JjaeosebMGbB06oCv46d4s+Lbs5ytAT4= -github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20241126192050-a8ed96118b08/go.mod h1:BbC4R+6e9TLjbskxrjISt/DDCn4OiB6v+ArqfYiPyyg= +github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250114183054-9f703251e0d7 h1:Gn2noktdut/Qz95+4viQE8wZobkScUD64Fo4VdUFDPU= +github.com/charmbracelet/bubbletea/v2 v2.0.0-alpha.2.0.20250114183054-9f703251e0d7/go.mod h1:Ynvl3LVehMYuuEs2B0QKNETMOBPsq/Z05pNBrKnpK1k= github.com/charmbracelet/colorprofile v0.1.8 h1:PywDeXsiAzlPtkiiKgMEVLvb6nlEuKrMj9+FJBtj4jU= github.com/charmbracelet/colorprofile v0.1.8/go.mod h1:+jpmObxZl1Dab3H3IMVIPSZTsKcFpjJUv97G0dLqM60= github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ= github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao= -github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2.0.20241121164047-8448a9be4804 h1:7CYjb9YMZA4kMhLgGdtlXvq+nu1oyENpMyMQlTvqSFw= -github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2.0.20241121164047-8448a9be4804/go.mod h1:F/6E/LGdH3eHCJf2rG8/O3CjlW8cZFL5YJCknJs1GkI= +github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2.0.20250114171829-b67eb015d607 h1:lERE4ow371r5WMqQAt7Eqlg1A4tBNA8T4RLwdXnKyBo= +github.com/charmbracelet/lipgloss/v2 v2.0.0-alpha.2.0.20250114171829-b67eb015d607/go.mod h1:MD7Vb+O1zFRgBo+F94JHHuME7df8XBByNKuX5k/L/qs= github.com/charmbracelet/x/ansi v0.7.0 h1:/QfFmiXOGGwN6fRbzvQaYp7fu1pkxpZ3qFBZWBsP404= github.com/charmbracelet/x/ansi v0.7.0/go.mod h1:KBUFw1la39nl0dLl10l5ORDAqGXaeurTQmwyyVKse/Q= github.com/charmbracelet/x/cellbuf v0.0.6 h1:pJUWN/G1jbt1Nj/+ILfC2/ABQoZzWu1vG73yHQEYELI= github.com/charmbracelet/x/cellbuf v0.0.6/go.mod h1:d72o71glp8flkCz54PHLe3+nuw5u2v3UxmKqruUERWQ= github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ= github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= +github.com/charmbracelet/x/input v0.3.0 h1:lVzEz92E2u9jCU0mUwcyKeSOxkoeat+1eUkjzL0WCYI= +github.com/charmbracelet/x/input v0.3.0/go.mod h1:M8CHPIYnmmiNHA17hqXmvSfeZLO2lj9pzJFX3aWvzgw= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/charmbracelet/x/vt v0.0.0-20241121165045-a3720547cbb4 h1:EacjHxcQEEgOZ7TbkAU3b84hd1Bn5NwA8YV5uyJ9EI4= @@ -44,9 +46,9 @@ github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= diff --git a/textinput/textinput.go b/textinput/textinput.go index feb4a1cef..92c468ac1 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -706,7 +706,7 @@ func (m Model) placeholderView() string { style = m.PlaceholderStyle.Inline(true).Render ) - p := make([]rune, m.Width+1) + p := make([]rune, m.Width()+1) copy(p, []rune(m.Placeholder)) m.Cursor.TextStyle = m.PlaceholderStyle diff --git a/textinput/textinput_test.go b/textinput/textinput_test.go index 95ef0c616..b13f60deb 100644 --- a/textinput/textinput_test.go +++ b/textinput/textinput_test.go @@ -34,6 +34,6 @@ func Test_CurrentSuggestion(t *testing.T) { func Test_SlicingOutsideCap(t *testing.T) { textinput := New() textinput.Placeholder = "作業ディレクトリを指定してください" - textinput.Width = 32 + textinput.SetWidth(32) textinput.View() } diff --git a/viewport/viewport_test.go b/viewport/viewport_test.go index ef70a54f5..180cddb5a 100644 --- a/viewport/viewport_test.go +++ b/viewport/viewport_test.go @@ -11,7 +11,7 @@ func TestNew(t *testing.T) { t.Run("default values on create by New", func(t *testing.T) { t.Parallel() - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) if !m.initialized { t.Errorf("on create by New, Model should be initialized") @@ -52,7 +52,7 @@ func TestSetHorizontalStep(t *testing.T) { t.Run("change default", func(t *testing.T) { t.Parallel() - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) if m.horizontalStep != defaultHorizontalStep { t.Errorf("default horizontalStep should be %d, got %d", defaultHorizontalStep, m.horizontalStep) @@ -68,7 +68,7 @@ func TestSetHorizontalStep(t *testing.T) { t.Run("no negative", func(t *testing.T) { t.Parallel() - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) if m.horizontalStep != defaultHorizontalStep { t.Errorf("default horizontalStep should be %d, got %d", defaultHorizontalStep, m.horizontalStep) @@ -90,7 +90,7 @@ func TestMoveLeft(t *testing.T) { t.Run("zero position", func(t *testing.T) { t.Parallel() - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) if m.xOffset != zeroPosition { t.Errorf("default indent should be %d, got %d", zeroPosition, m.xOffset) } @@ -103,7 +103,7 @@ func TestMoveLeft(t *testing.T) { t.Run("move", func(t *testing.T) { t.Parallel() - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) if m.xOffset != zeroPosition { t.Errorf("default indent should be %d, got %d", zeroPosition, m.xOffset) } @@ -125,7 +125,7 @@ func TestMoveRight(t *testing.T) { zeroPosition := 0 - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) m.SetContent("Some line that is longer than width") if m.xOffset != zeroPosition { t.Errorf("default indent should be %d, got %d", zeroPosition, m.xOffset) @@ -147,7 +147,7 @@ func TestResetIndent(t *testing.T) { zeroPosition := 0 - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) m.xOffset = 500 m.ResetIndent() @@ -183,7 +183,7 @@ func TestVisibleLines(t *testing.T) { t.Run("empty list", func(t *testing.T) { t.Parallel() - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) list := m.visibleLines() if len(list) != 0 { @@ -194,7 +194,7 @@ func TestVisibleLines(t *testing.T) { t.Run("empty list: with indent", func(t *testing.T) { t.Parallel() - m := New(10, 10) + m := New(WithHeight(10), WithWidth(10)) list := m.visibleLines() m.xOffset = 5 @@ -207,7 +207,7 @@ func TestVisibleLines(t *testing.T) { t.Parallel() numberOfLines := 10 - m := New(10, numberOfLines) + m := New(WithHeight(numberOfLines), WithWidth(10)) m.SetContent(strings.Join(defaultList, "\n")) list := m.visibleLines() @@ -217,7 +217,7 @@ func TestVisibleLines(t *testing.T) { lastItemIdx := numberOfLines - 1 // we trim line if it doesn't fit to width of the viewport - shouldGet := defaultList[lastItemIdx][:m.Width] + shouldGet := defaultList[lastItemIdx][:m.Width()] if list[lastItemIdx] != shouldGet { t.Errorf(`%dth list item should be '%s', got '%s'`, lastItemIdx, shouldGet, list[lastItemIdx]) } @@ -227,7 +227,7 @@ func TestVisibleLines(t *testing.T) { t.Parallel() numberOfLines := 10 - m := New(10, numberOfLines) + m := New(WithHeight(numberOfLines), WithWidth(10)) m.SetContent(strings.Join(defaultList, "\n")) m.YOffset = 5 @@ -242,7 +242,7 @@ func TestVisibleLines(t *testing.T) { lastItemIdx := numberOfLines - 1 // we trim line if it doesn't fit to width of the viewport - shouldGet := defaultList[m.YOffset+lastItemIdx][:m.Width] + shouldGet := defaultList[m.YOffset+lastItemIdx][:m.Width()] if list[lastItemIdx] != shouldGet { t.Errorf(`%dth list item should be '%s', got '%s'`, lastItemIdx, shouldGet, list[lastItemIdx]) } @@ -252,7 +252,7 @@ func TestVisibleLines(t *testing.T) { t.Parallel() numberOfLines := 10 - m := New(10, numberOfLines) + m := New(WithHeight(numberOfLines), WithWidth(10)) m.lines = defaultList m.YOffset = 7 @@ -311,7 +311,7 @@ func TestVisibleLines(t *testing.T) { } numberOfLines := len(initList) - m := New(20, numberOfLines) + m := New(WithHeight(numberOfLines), WithWidth(20)) m.lines = initList m.longestLineWidth = 30 // dirty hack: not checking right overscroll for this test case @@ -366,7 +366,7 @@ func TestRightOverscroll(t *testing.T) { t.Run("prevent right overscroll", func(t *testing.T) { t.Parallel() content := "Content is short" - m := New(len(content)+1, 5) + m := New(WithHeight(5), WithWidth(len(content)+1)) m.SetContent(content) for i := 0; i < 10; i++ {