diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 279ca17a..2d726cfc 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: [ '1.20', 'stable' ] + go-version: [ '1.20', '1.21', 'stable' ] steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index d13f9110..11c1fe84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.19.0] - 29-Jan-2024 + +### Added + +- Support for "Backtab" (a.k.a. Shift+Tab) as a supported keystroke for tcell + widgets. + +### Changed + +- Migrated CI from Travis to Github Actions. +- Bump github.com/gdamore/tcell/v2 from 2.5.4 to 2.7.0. +- Change the Go version in `go.mod` to 1.21. +- Executed `go mod tidy`. +- CI now executes tests with Golang v1.20 and v1.21. + ## [0.18.0] - 08-Feb-2023 ### Added @@ -516,7 +531,8 @@ identifiers shouldn't be used externally. - The Gauge widget. - The Text widget. -[unreleased]: https://github.com/mum4k/termdash/compare/v0.17.0...devel +[unreleased]: https://github.com/mum4k/termdash/compare/v0.19.0...devel +[0.19.0]: https://github.com/mum4k/termdash/compare/v0.18.0...v0.19.0 [0.18.0]: https://github.com/mum4k/termdash/compare/v0.17.0...v0.18.0 [0.17.0]: https://github.com/mum4k/termdash/compare/v0.16.1...v0.17.0 [0.16.1]: https://github.com/mum4k/termdash/compare/v0.16.0...v0.16.1 diff --git a/container/container_test.go b/container/container_test.go index 2d1d76e7..f16c3156 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -1939,7 +1939,7 @@ func TestMouse(t *testing.T) { ), Right( PlaceWidget(fakewidget.New(widgetapi.Options{WantKeyboard: widgetapi.KeyScopeFocused})), - KeyFocusPrevious(keyboard.KeyTab), + KeyFocusPrevious(keyboard.KeyBacktab), ), ), ) @@ -1949,7 +1949,7 @@ func TestMouse(t *testing.T) { return c, nil }, events: []terminalapi.Event{ - &terminalapi.Keyboard{Key: keyboard.KeyTab}, + &terminalapi.Keyboard{Key: keyboard.KeyBacktab}, }, want: func(size image.Point) *faketerm.Terminal { ft := faketerm.MustNew(size) @@ -1966,7 +1966,7 @@ func TestMouse(t *testing.T) { &widgetapi.Meta{Focused: true}, widgetapi.Options{WantKeyboard: widgetapi.KeyScopeFocused}, &fakewidget.Event{ - Ev: &terminalapi.Keyboard{Key: keyboard.KeyTab}, + Ev: &terminalapi.Keyboard{Key: keyboard.KeyBacktab}, Meta: &widgetapi.EventMeta{Focused: true}, }, ) diff --git a/container/focus_test.go b/container/focus_test.go index 58c8ce38..5d79fcfb 100644 --- a/container/focus_test.go +++ b/container/focus_test.go @@ -529,7 +529,7 @@ func TestFocusTrackerNextAndPrevious(t *testing.T) { const ( keyNext keyboard.Key = keyboard.KeyTab - keyPrevious keyboard.Key = '~' + keyPrevious keyboard.Key = keyboard.KeyBacktab ) tests := []struct { diff --git a/go.mod b/go.mod index 5fcc03e5..c0dd619d 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,19 @@ module github.com/mum4k/termdash -go 1.20 +go 1.21 require ( - github.com/gdamore/tcell/v2 v2.5.4 + github.com/gdamore/tcell/v2 v2.7.0 github.com/kylelemons/godebug v1.1.0 - github.com/mattn/go-runewidth v0.0.14 + github.com/mattn/go-runewidth v0.0.15 github.com/nsf/termbox-go v1.1.1 ) require ( github.com/gdamore/encoding v1.0.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/rivo/uniseg v0.2.0 // indirect - golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect - golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect - golang.org/x/text v0.5.0 // indirect + github.com/rivo/uniseg v0.4.3 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect ) diff --git a/go.sum b/go.sum index 64204834..8315e343 100644 --- a/go.sum +++ b/go.sum @@ -1,43 +1,52 @@ 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/v2 v2.5.4 h1:TGU4tSjD3sCL788vFNeJnTdzpNKIw1H5dgLnJRQVv/k= -github.com/gdamore/tcell/v2 v2.5.4/go.mod h1:dZgRy5v4iMobMEcWNYBtREnDZAT9DYmfqIkrgEMxLyw= +github.com/gdamore/tcell/v2 v2.7.0 h1:I5LiGTQuwrysAt1KS9wg1yFfOI3arI3ucFrxtd/xqaA= +github.com/gdamore/tcell/v2 v2.7.0/go.mod h1:hl/KtAANGBecfIPxk+FzKvThTqI84oplgbPEmVX60b8= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 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.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -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/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/nsf/termbox-go v1.1.1 h1:nksUPLCb73Q++DwbYUBEglYBRPZyoXJdrj5L+TkjyZY= github.com/nsf/termbox-go v1.1.1/go.mod h1:T0cTdVuOwf7pHQNtfhnEbzHbcNyCEcVU4YPpouCbVxo= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= 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/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 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/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= 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/sync v0.1.0/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 h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM= -golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= 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.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 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/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/keyboard/keyboard.go b/keyboard/keyboard.go index 3a852b32..8308af9d 100644 --- a/keyboard/keyboard.go +++ b/keyboard/keyboard.go @@ -65,6 +65,7 @@ var buttonNames = map[Key]string{ KeyCtrlG: "KeyCtrlG", KeyBackspace: "KeyBackspace", KeyTab: "KeyTab", + KeyBacktab: "KeyBacktab", KeyCtrlJ: "KeyCtrlJ", KeyCtrlK: "KeyCtrlK", KeyCtrlL: "KeyCtrlL", @@ -130,6 +131,7 @@ const ( KeyCtrlG KeyBackspace KeyTab + KeyBacktab KeyCtrlJ KeyCtrlK KeyCtrlL diff --git a/terminal/tcell/event.go b/terminal/tcell/event.go index 609c43f9..78bf189f 100644 --- a/terminal/tcell/event.go +++ b/terminal/tcell/event.go @@ -77,6 +77,7 @@ var tcellToTd = map[tcell.Key]keyboard.Key{ tcell.KeyCtrlZ: keyboard.KeyCtrlZ, tcell.KeyBackspace: keyboard.KeyBackspace, tcell.KeyTab: keyboard.KeyTab, + tcell.KeyBacktab: keyboard.KeyBacktab, tcell.KeyEscape: keyboard.KeyEsc, tcell.KeyCtrlBackslash: keyboard.KeyCtrlBackslash, tcell.KeyCtrlRightSq: keyboard.KeyCtrlRsqBracket, diff --git a/terminal/tcell/event_test.go b/terminal/tcell/event_test.go index e2618218..a14b30ac 100644 --- a/terminal/tcell/event_test.go +++ b/terminal/tcell/event_test.go @@ -218,6 +218,7 @@ func TestKeyboardKeys(t *testing.T) { {key: tcell.KeyBackspace, want: keyboard.KeyCtrlH}, {key: tcell.KeyCtrlH, want: keyboard.KeyBackspace}, {key: tcell.KeyTab, want: keyboard.KeyTab}, + {key: tcell.KeyBacktab, want: keyboard.KeyBacktab}, {key: tcell.KeyTab, want: keyboard.KeyCtrlI}, {key: tcell.KeyCtrlI, want: keyboard.KeyTab}, {key: tcell.KeyCtrlJ, want: keyboard.KeyCtrlJ}, diff --git a/widgets/textinput/formdemo/formdemo.go b/widgets/textinput/formdemo/formdemo.go index 723318a4..1ce6ec98 100644 --- a/widgets/textinput/formdemo/formdemo.go +++ b/widgets/textinput/formdemo/formdemo.go @@ -167,6 +167,7 @@ func newForm(cancel context.CancelFunc) (*form, error) { func formLayout(c *container.Container, f *form) error { return c.Update("root", container.KeyFocusNext(keyboard.KeyTab), + container.KeyFocusPrevious(keyboard.KeyBacktab), container.KeyFocusGroupsNext(keyboard.KeyArrowDown, 1), container.KeyFocusGroupsPrevious(keyboard.KeyArrowUp, 1), container.KeyFocusGroupsNext(keyboard.KeyArrowRight, 2),