Merge pull request 'Update module github.com/gdamore/tcell to v2' (#8) from renovate/github.com-gdamore-tcell-2.x into master
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: #8
This commit is contained in:
commit
ef55ec0663
@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"git.yetaga.in/alazyreader/library/media"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
)
|
||||
|
||||
// error message
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
"git.yetaga.in/alazyreader/library/importer"
|
||||
"git.yetaga.in/alazyreader/library/media"
|
||||
"git.yetaga.in/alazyreader/library/ui"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/kelseyhightower/envconfig"
|
||||
)
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.16
|
||||
replace github.com/irlndts/go-discogs v0.3.5 => git.yetaga.in/alazyreader/go-discogs v0.3.6
|
||||
|
||||
require (
|
||||
github.com/gdamore/tcell v1.4.0
|
||||
github.com/gdamore/tcell/v2 v2.6.0
|
||||
github.com/go-sql-driver/mysql v1.7.0
|
||||
github.com/irlndts/go-discogs v0.3.5
|
||||
github.com/kelseyhightower/envconfig v1.4.0
|
||||
|
50
go.sum
50
go.sum
@ -1,25 +1,49 @@
|
||||
git.yetaga.in/alazyreader/go-discogs v0.3.5 h1:XcwcFJP0p1eQQ6OQhScYiNM8+vymeEO4V+M9H9x58os=
|
||||
git.yetaga.in/alazyreader/go-discogs v0.3.5/go.mod h1:UVQ05FdCzH4P/usnSxQDh77QYE37HvmPnSCgogioljo=
|
||||
git.yetaga.in/alazyreader/go-discogs v0.3.6 h1:VhV8/uhnWsxae6PvIVtXOfO4eWWqShX6DkiN2hFsZ8U=
|
||||
git.yetaga.in/alazyreader/go-discogs v0.3.6/go.mod h1:UVQ05FdCzH4P/usnSxQDh77QYE37HvmPnSCgogioljo=
|
||||
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU=
|
||||
github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0=
|
||||
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
|
||||
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/gdamore/tcell/v2 v2.6.0 h1:OKbluoP9VYmJwZwq/iLb4BxwKcwGthaa1YNBJIyCySg=
|
||||
github.com/gdamore/tcell/v2 v2.6.0/go.mod h1:be9omFATkdr0D9qewWW3d+MEvl5dha+Etb5y65J2H8Y=
|
||||
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
|
||||
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
|
||||
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
|
||||
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
|
||||
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
28
ui/mock.go
28
ui/mock.go
@ -3,7 +3,7 @@ package ui
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
)
|
||||
|
||||
type coord struct {
|
||||
@ -38,8 +38,18 @@ func (m *MockScreen) SetContent(x int, y int, mainc rune, combc []rune, style tc
|
||||
m.content[coord{x, y}] = mainc
|
||||
}
|
||||
|
||||
func (m *MockScreen) Suspend() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockScreen) Resume() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockScreen) SetStyle(style tcell.Style) {}
|
||||
|
||||
func (m *MockScreen) SetCursorStyle(style tcell.CursorStyle) {}
|
||||
|
||||
func (m *MockScreen) ShowCursor(x int, y int) {}
|
||||
|
||||
func (m *MockScreen) HideCursor() {}
|
||||
@ -52,16 +62,26 @@ func (m *MockScreen) PollEvent() tcell.Event {
|
||||
return tcell.NewEventError(fmt.Errorf("mock error"))
|
||||
}
|
||||
|
||||
func (m *MockScreen) ChannelEvents(ch chan<- tcell.Event, quit <-chan struct{}) {}
|
||||
|
||||
func (m *MockScreen) HasPendingEvent() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *MockScreen) PostEvent(ev tcell.Event) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockScreen) PostEventWait(ev tcell.Event) {}
|
||||
|
||||
func (m *MockScreen) EnableMouse() {}
|
||||
func (m *MockScreen) EnableMouse(...tcell.MouseFlags) {}
|
||||
|
||||
func (m *MockScreen) DisableMouse() {}
|
||||
|
||||
func (m *MockScreen) EnablePaste() {}
|
||||
|
||||
func (m *MockScreen) DisablePaste() {}
|
||||
|
||||
func (m *MockScreen) HasMouse() bool {
|
||||
return false
|
||||
}
|
||||
@ -90,6 +110,10 @@ func (m *MockScreen) Resize(x, y, h, w int) {
|
||||
m.x, m.y, m.h, m.w = x, y, h, w
|
||||
}
|
||||
|
||||
func (m *MockScreen) SetSize(h, w int) {
|
||||
m.h, m.w = h, w
|
||||
}
|
||||
|
||||
func (m *MockScreen) HasKey(tcell.Key) bool {
|
||||
return true
|
||||
}
|
||||
|
6
ui/ui.go
6
ui/ui.go
@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"git.yetaga.in/alazyreader/library/media"
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
)
|
||||
|
||||
type Drawable interface {
|
||||
@ -37,8 +37,8 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
StyleActive = tcell.Style(0).Foreground(tcell.ColorWhite).Background(tcell.ColorBlack)
|
||||
StyleInactive = tcell.Style(0).Foreground(tcell.ColorGray).Background(tcell.ColorBlack)
|
||||
StyleActive = tcell.Style{}.Foreground(tcell.ColorWhite).Background(tcell.ColorBlack)
|
||||
StyleInactive = tcell.Style{}.Foreground(tcell.ColorGray).Background(tcell.ColorBlack)
|
||||
)
|
||||
|
||||
// A Container has no visible UI of its own, but arranges sub-components on the screen.
|
||||
|
@ -3,6 +3,8 @@ package ui
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
)
|
||||
|
||||
func TestContainerOneBox(t *testing.T) {
|
||||
@ -13,7 +15,7 @@ func TestContainerOneBox(t *testing.T) {
|
||||
└──────────────────┘
|
||||
`
|
||||
m := &MockScreen{}
|
||||
one := NewBox("box one", nil, Contents{}, 0, false)
|
||||
one := NewBox("box one", nil, Contents{}, tcell.Style{}, false)
|
||||
container := NewContainer(
|
||||
Contents{{Container: one}},
|
||||
LayoutHorizontalEven,
|
||||
@ -38,8 +40,8 @@ func TestContainerTwoBoxesHStack(t *testing.T) {
|
||||
└────────┘└────────┘
|
||||
`
|
||||
m := &MockScreen{}
|
||||
one := NewBox("one", nil, Contents{}, 0, false)
|
||||
two := NewBox("two", nil, Contents{}, 0, false)
|
||||
one := NewBox("one", nil, Contents{}, tcell.Style{}, false)
|
||||
two := NewBox("two", nil, Contents{}, tcell.Style{}, false)
|
||||
container := NewContainer(
|
||||
Contents{{Container: one}, {Container: two}},
|
||||
LayoutHorizontalEven,
|
||||
@ -64,9 +66,9 @@ func TestContainerThreeBoxesUnevenHStack(t *testing.T) {
|
||||
└────────┘└────────┘└───────┘
|
||||
`
|
||||
m := &MockScreen{}
|
||||
one := NewBox("one", nil, Contents{}, 0, false)
|
||||
two := NewBox("two", nil, Contents{}, 0, false)
|
||||
three := NewBox("three", nil, Contents{}, 0, false)
|
||||
one := NewBox("one", nil, Contents{}, tcell.Style{}, false)
|
||||
two := NewBox("two", nil, Contents{}, tcell.Style{}, false)
|
||||
three := NewBox("three", nil, Contents{}, tcell.Style{}, false)
|
||||
container := NewContainer(
|
||||
Contents{{Container: one}, {Container: two}, {Container: three}},
|
||||
LayoutHorizontalEven,
|
||||
@ -91,8 +93,8 @@ func TestContainerTwoBoxesHPercentStack(t *testing.T) {
|
||||
└────────────┘└──────┘
|
||||
`
|
||||
m := &MockScreen{}
|
||||
one := NewBox("one", nil, Contents{}, 0, false)
|
||||
two := NewBox("two", nil, Contents{}, 0, false)
|
||||
one := NewBox("one", nil, Contents{}, tcell.Style{}, false)
|
||||
two := NewBox("two", nil, Contents{}, tcell.Style{}, false)
|
||||
container := NewContainer(
|
||||
Contents{
|
||||
{Container: one, Offsets: Offsets{Percent: 2}},
|
||||
@ -124,8 +126,8 @@ func TestContainerTwoBoxesVStack(t *testing.T) {
|
||||
└────────┘
|
||||
`
|
||||
m := &MockScreen{}
|
||||
one := NewBox("one", nil, Contents{}, 0, false)
|
||||
two := NewBox("two", nil, Contents{}, 0, false)
|
||||
one := NewBox("one", nil, Contents{}, tcell.Style{}, false)
|
||||
two := NewBox("two", nil, Contents{}, tcell.Style{}, false)
|
||||
container := NewContainer(
|
||||
Contents{{Container: one}, {Container: two}},
|
||||
LayoutVerticalEven,
|
||||
@ -155,8 +157,8 @@ func TestContainerTwoBoxesPercentageVStack(t *testing.T) {
|
||||
└────────┘
|
||||
`
|
||||
m := &MockScreen{}
|
||||
one := NewBox("one", nil, Contents{}, 0, false)
|
||||
two := NewBox("two", nil, Contents{}, 0, false)
|
||||
one := NewBox("one", nil, Contents{}, tcell.Style{}, false)
|
||||
two := NewBox("two", nil, Contents{}, tcell.Style{}, false)
|
||||
container := NewContainer(
|
||||
Contents{
|
||||
{Container: one, Offsets: Offsets{Percent: 2}},
|
||||
|
Loading…
Reference in New Issue
Block a user