Skip to content

Commit

Permalink
Merge 07a736f into f13e422
Browse files Browse the repository at this point in the history
  • Loading branch information
mum4k committed Jul 7, 2022
2 parents f13e422 + 07a736f commit ae3df26
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 23 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -4,19 +4,19 @@ go:
- 1.17.x
- stable
before_install:
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go install golang.org/x/tools/cmd/cover@latest
- go install github.com/mattn/goveralls@latest
- go install golang.org/x/lint/golint@latest
script:
- go get -t ./...
- go get -u golang.org/x/lint/golint
# Temporarily set -mod=mod to allow modification of go.mod and go.sum.
# This seems to be caused by a sum missing in the tcell dependency and
# should be removed when no longer needed.
- go test -v -covermode=count -coverprofile=coverage.out -mod=mod ./...
- CGO_ENABLED=1 go test -mod=mod -race ./...
- go vet ./...
- diff -u <(echo -n) <(gofmt -d -s .)
- diff -u <(echo -n) <(./internal/scripts/autogen_licences.sh .)
- diff -u <(echo -n) <(./private/scripts/autogen_licences.sh .)
- diff -u <(echo -n) <(golint ./...)
- $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN
env:
Expand Down
20 changes: 19 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.17.0] - 07-Jul-2022

### Added

- Added support for `tcell`'s `Dim` text style.

### Changed

- Bump github.com/gdamore/tcell from 2.4.0 to 2.5.1.
- Bump github.com/nsf/termbox-go to v1.1.1.
- Change the Go version in `go.mod` to 1.17.
- Executed `go mod tidy`.

### Fixed

- Fixed invalid path to the `autogen_licences.sh` script in `.travis.ci`.

## [0.16.1] - 13-Jan-2022

### Changed
Expand Down Expand Up @@ -472,7 +489,8 @@ identifiers shouldn't be used externally.
- The Gauge widget.
- The Text widget.

[unreleased]: https://github.com/mum4k/termdash/compare/v0.16.1...devel
[unreleased]: https://github.com/mum4k/termdash/compare/v0.17.0...devel
[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
[0.16.0]: https://github.com/mum4k/termdash/compare/v0.15.0...v0.16.0
[0.15.0]: https://github.com/mum4k/termdash/compare/v0.14.0...v0.15.0
Expand Down
8 changes: 8 additions & 0 deletions cell/cell.go
Expand Up @@ -31,6 +31,7 @@ type Options struct {
Strikethrough bool
Inverse bool
Blink bool
Dim bool
}

// Set allows existing options to be passed as an option.
Expand Down Expand Up @@ -110,3 +111,10 @@ func Blink() Option {
co.Blink = true
})
}

// Dim makes the cell foreground color dim. Only works when using the tcell backend.
func Dim() Option {
return option(func(co *Options) {
co.Dim = true
})
}
2 changes: 2 additions & 0 deletions cell/cell_test.go
Expand Up @@ -82,6 +82,7 @@ func TestNewOptions(t *testing.T) {
Strikethrough(),
Inverse(),
Blink(),
Dim(),
},
want: &Options{
Bold: true,
Expand All @@ -90,6 +91,7 @@ func TestNewOptions(t *testing.T) {
Strikethrough: true,
Inverse: true,
Blink: true,
Dim: true,
},
},
}
Expand Down
16 changes: 12 additions & 4 deletions go.mod
@@ -1,11 +1,19 @@
module github.com/mum4k/termdash

go 1.14
go 1.17

require (
github.com/gdamore/tcell/v2 v2.4.0
github.com/gdamore/tcell/v2 v2.5.1
github.com/kylelemons/godebug v1.1.0
github.com/mattn/go-runewidth v0.0.13
github.com/nsf/termbox-go v0.0.0-20201107200903-9b52a5faed9e
golang.org/x/text v0.3.4 // indirect
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-20220704084225-05e143d24a9e // indirect
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
golang.org/x/text v0.3.7 // indirect
)
28 changes: 15 additions & 13 deletions go.sum
@@ -1,25 +1,27 @@
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.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57KM=
github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/gdamore/tcell/v2 v2.5.1 h1:zc3LPdpK184lBW7syF2a5C6MV827KmErk9jGVnmsl/I=
github.com/gdamore/tcell/v2 v2.5.1/go.mod h1:wSkrPaXoiIWZqW/g7Px4xc79di6FTcpB8tvaKJ6uGBo=
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.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.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
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.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/nsf/termbox-go v0.0.0-20201107200903-9b52a5faed9e h1:T8/SzSWIDoWV9trslLNfUdJ5yHrIXXuODEy5M0vou4U=
github.com/nsf/termbox-go v0.0.0-20201107200903-9b52a5faed9e/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
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=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220318055525-2edf467146b5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e h1:CsOuNlbOuf0mzxJIefr6Q4uAUetRUwZE4qt7VfzP+xo=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
14 changes: 14 additions & 0 deletions private/faketerm/diff_test.go
@@ -1,3 +1,17 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package faketerm

import (
Expand Down
3 changes: 2 additions & 1 deletion terminal/tcell/cell_options.go
Expand Up @@ -70,6 +70,7 @@ func cellOptsToStyle(opts *cell.Options, colorMode terminalapi.ColorMode) tcell.
Underline(opts.Underline).
StrikeThrough(opts.Strikethrough).
Reverse(opts.Inverse).
Blink(opts.Blink)
Blink(opts.Blink).
Dim(opts.Dim)
return st
}
5 changes: 5 additions & 0 deletions terminal/tcell/cell_options_test.go
Expand Up @@ -325,6 +325,11 @@ func TestCellOptsToStyle(t *testing.T) {
opts: cell.Options{Blink: true},
want: tcell.StyleDefault.Blink(true),
},
{
colorMode: terminalapi.ColorModeNormal,
opts: cell.Options{Dim: true},
want: tcell.StyleDefault.Dim(true),
},
}

for _, tc := range tests {
Expand Down
5 changes: 5 additions & 0 deletions terminal/termbox/cell_options.go
Expand Up @@ -67,6 +67,11 @@ func cellOptsToFg(opts *cell.Options) (tbx.Attribute, error) {
if opts.Blink {
return 0, errors.New("Termbox: Unsupported attribute: Blink")
}

if opts.Dim {
return 0, errors.New("Termbox: Unsupported attribute: Dim")
}

return a, nil
}

Expand Down
1 change: 1 addition & 0 deletions terminal/termbox/cell_options_test.go
Expand Up @@ -62,6 +62,7 @@ func TestCellFontModifier(t *testing.T) {
{cell.Options{Strikethrough: true}, 0, true},
{cell.Options{Inverse: true}, tbx.AttrReverse, false},
{cell.Options{Blink: true}, 0, true},
{cell.Options{Dim: true}, 0, true},
}

for _, tc := range tests {
Expand Down

0 comments on commit ae3df26

Please sign in to comment.