Projects STRLCPY termdash Commits 8a5b62c7
🤬
  • Release v0.15.0. (#298)

    ### Changed
    
    - Bump github.com/gdamore/tcell/v2 from 2.0.0 to 2.2.0.
    - Bump github.com/mattn/go-runewidth from 0.0.9 to 0.0.10.
    - Allowing CI to modify go.mod and go.sum when necessary.
    - Executed `go mod tidy`.
    
    ### Added
    
    - TitleColor and TitleFocusedColor options for border title which enables the 
      setting of separate colors for border and title on a container.
  • Loading...
  • Jakub Sobon committed with GitHub 3 years ago
    8a5b62c7
    1 parent 74d9de20
  • ■ ■ ■ ■ ■ ■
    .travis.yml
    skipped 7 lines
    8 8  script:
    9 9   - go get -t ./...
    10 10   - go get -u golang.org/x/lint/golint
    11  - - go test ./...
    12  - - CGO_ENABLED=1 go test -race ./...
     11 + # Temporarily set -mod=mod to allow modification of go.mod and go.sum.
     12 + # This seems to be caused by a sum missing in the tcell dependency and
     13 + # should be removed when no longer needed.
     14 + - go test -mod=mod ./...
     15 + - CGO_ENABLED=1 go test -mod=mod -race ./...
    13 16   - go vet ./...
    14 17   - diff -u <(echo -n) <(gofmt -d -s .)
    15 18   - diff -u <(echo -n) <(./internal/scripts/autogen_licences.sh .)
    skipped 7 lines
  • ■ ■ ■ ■ ■ ■
    CHANGELOG.md
    skipped 6 lines
    7 7   
    8 8  ## [Unreleased]
    9 9   
     10 +## [0.15.0] - 06-Mar-2021
     11 + 
     12 +### Changed
     13 + 
     14 +- Bump github.com/gdamore/tcell/v2 from 2.0.0 to 2.2.0.
     15 +- Bump github.com/mattn/go-runewidth from 0.0.9 to 0.0.10.
     16 +- Allowing CI to modify go.mod and go.sum when necessary.
     17 +- Executed `go mod tidy`.
     18 + 
     19 +### Added
     20 + 
     21 +- TitleColor and TitleFocusedColor options for border title which enables the
     22 + setting of separate colors for border and title on a container.
     23 + 
    10 24  ## [0.14.0] - 30-Dec-2020
    11 25   
    12 26  ### Breaking API changes
    skipped 426 lines
    439 453  - The Gauge widget.
    440 454  - The Text widget.
    441 455   
    442  -[unreleased]: https://github.com/mum4k/termdash/compare/v0.14.0...devel
     456 +[unreleased]: https://github.com/mum4k/termdash/compare/v0.15.0...devel
     457 +[0.15.0]: https://github.com/mum4k/termdash/compare/v0.14.0...v0.15.0
    443 458  [0.14.0]: https://github.com/mum4k/termdash/compare/v0.13.0...v0.14.0
    444 459  [0.13.0]: https://github.com/mum4k/termdash/compare/v0.12.2...v0.13.0
    445 460  [0.12.2]: https://github.com/mum4k/termdash/compare/v0.12.1...v0.12.2
    skipped 17 lines
  • ■ ■ ■ ■ ■ ■
    container/container_test.go
    skipped 1003 lines
    1004 1004   },
    1005 1005   },
    1006 1006   {
     1007 + desc: "sets border title on root container of different color",
     1008 + termSize: image.Point{10, 10},
     1009 + container: func(ft *faketerm.Terminal) (*Container, error) {
     1010 + return New(
     1011 + ft,
     1012 + Border(linestyle.Light),
     1013 + BorderTitle("Ab"),
     1014 + BorderColor(cell.ColorRed),
     1015 + FocusedColor(cell.ColorBlue),
     1016 + TitleColor(cell.ColorMagenta),
     1017 + TitleFocusedColor(cell.ColorCyan),
     1018 + SplitVertical(
     1019 + Left(
     1020 + Border(linestyle.Light),
     1021 + ),
     1022 + Right(
     1023 + Border(linestyle.Light),
     1024 + ),
     1025 + ),
     1026 + )
     1027 + },
     1028 + want: func(size image.Point) *faketerm.Terminal {
     1029 + ft := faketerm.MustNew(size)
     1030 + cvs := testcanvas.MustNew(ft.Area())
     1031 + testdraw.MustBorder(
     1032 + cvs,
     1033 + image.Rect(0, 0, 10, 10),
     1034 + draw.BorderCellOpts(cell.FgColor(cell.ColorBlue)),
     1035 + )
     1036 + testdraw.MustBorder(
     1037 + cvs,
     1038 + image.Rect(1, 1, 5, 9),
     1039 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)),
     1040 + )
     1041 + testdraw.MustBorder(
     1042 + cvs,
     1043 + image.Rect(5, 1, 9, 9),
     1044 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)),
     1045 + )
     1046 + testdraw.MustText(
     1047 + cvs,
     1048 + "Ab",
     1049 + image.Point{1, 0},
     1050 + draw.TextCellOpts(cell.FgColor(cell.ColorCyan)),
     1051 + )
     1052 + testcanvas.MustApply(cvs, ft)
     1053 + return ft
     1054 + },
     1055 + },
     1056 + {
     1057 + desc: "sets different color title on left child container",
     1058 + termSize: image.Point{10, 10},
     1059 + container: func(ft *faketerm.Terminal) (*Container, error) {
     1060 + return New(
     1061 + ft,
     1062 + Border(linestyle.Light),
     1063 + BorderColor(cell.ColorRed),
     1064 + FocusedColor(cell.ColorBlue),
     1065 + SplitVertical(
     1066 + Left(
     1067 + Border(linestyle.Light),
     1068 + BorderTitle("Ab"),
     1069 + TitleColor(cell.ColorMagenta),
     1070 + TitleFocusedColor(cell.ColorCyan),
     1071 + ),
     1072 + Right(
     1073 + Border(linestyle.Light),
     1074 + ),
     1075 + ),
     1076 + )
     1077 + },
     1078 + want: func(size image.Point) *faketerm.Terminal {
     1079 + ft := faketerm.MustNew(size)
     1080 + cvs := testcanvas.MustNew(ft.Area())
     1081 + testdraw.MustBorder(
     1082 + cvs,
     1083 + image.Rect(0, 0, 10, 10),
     1084 + draw.BorderCellOpts(cell.FgColor(cell.ColorBlue)),
     1085 + )
     1086 + testdraw.MustBorder(
     1087 + cvs,
     1088 + image.Rect(1, 1, 5, 9),
     1089 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)),
     1090 + )
     1091 + testdraw.MustBorder(
     1092 + cvs,
     1093 + image.Rect(5, 1, 9, 9),
     1094 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)),
     1095 + )
     1096 + testdraw.MustText(
     1097 + cvs,
     1098 + "Ab",
     1099 + image.Point{2, 1},
     1100 + draw.TextCellOpts(cell.FgColor(cell.ColorMagenta)),
     1101 + )
     1102 + testcanvas.MustApply(cvs, ft)
     1103 + return ft
     1104 + },
     1105 + },
     1106 + {
     1107 + desc: "inherits the border color for the title on left child container when TitleColor is not set",
     1108 + termSize: image.Point{10, 10},
     1109 + container: func(ft *faketerm.Terminal) (*Container, error) {
     1110 + return New(
     1111 + ft,
     1112 + Border(linestyle.Light),
     1113 + BorderColor(cell.ColorRed),
     1114 + FocusedColor(cell.ColorBlue),
     1115 + SplitVertical(
     1116 + Left(
     1117 + Border(linestyle.Light),
     1118 + BorderTitle("Ab"),
     1119 + ),
     1120 + Right(
     1121 + Border(linestyle.Light),
     1122 + ),
     1123 + ),
     1124 + )
     1125 + },
     1126 + want: func(size image.Point) *faketerm.Terminal {
     1127 + ft := faketerm.MustNew(size)
     1128 + cvs := testcanvas.MustNew(ft.Area())
     1129 + testdraw.MustBorder(
     1130 + cvs,
     1131 + image.Rect(0, 0, 10, 10),
     1132 + draw.BorderCellOpts(cell.FgColor(cell.ColorBlue)),
     1133 + )
     1134 + testdraw.MustBorder(
     1135 + cvs,
     1136 + image.Rect(1, 1, 5, 9),
     1137 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)),
     1138 + )
     1139 + testdraw.MustBorder(
     1140 + cvs,
     1141 + image.Rect(5, 1, 9, 9),
     1142 + draw.BorderCellOpts(cell.FgColor(cell.ColorRed)),
     1143 + )
     1144 + testdraw.MustText(
     1145 + cvs,
     1146 + "Ab",
     1147 + image.Point{2, 1},
     1148 + draw.TextCellOpts(cell.FgColor(cell.ColorRed)),
     1149 + )
     1150 + testcanvas.MustApply(cvs, ft)
     1151 + return ft
     1152 + },
     1153 + },
     1154 + {
    1007 1155   desc: "splitting a container removes the widget",
    1008 1156   termSize: image.Point{10, 10},
    1009 1157   container: func(ft *faketerm.Terminal) (*Container, error) {
    skipped 1899 lines
  • ■ ■ ■ ■ ■
    container/draw.go
    skipped 83 lines
    84 84   return err
    85 85   }
    86 86   
    87  - var cOpts []cell.Option
     87 + var cOpts, titleCOpts []cell.Option
    88 88   if c.focusTracker.isActive(c) {
    89 89   cOpts = append(cOpts, cell.FgColor(c.opts.inherited.focusedColor))
     90 + if c.opts.inherited.titleFocusedColor != nil {
     91 + titleCOpts = append(titleCOpts, cell.FgColor(*c.opts.inherited.titleFocusedColor))
     92 + } else {
     93 + titleCOpts = cOpts
     94 + }
    90 95   } else {
    91 96   cOpts = append(cOpts, cell.FgColor(c.opts.inherited.borderColor))
     97 + if c.opts.inherited.titleColor != nil {
     98 + titleCOpts = append(titleCOpts, cell.FgColor(*c.opts.inherited.titleColor))
     99 + } else {
     100 + titleCOpts = cOpts
     101 + }
    92 102   }
    93 103   
    94 104   if err := draw.Border(cvs, ar,
    95 105   draw.BorderLineStyle(c.opts.border),
    96  - draw.BorderTitle(c.opts.borderTitle, draw.OverrunModeThreeDot, cOpts...),
     106 + draw.BorderTitle(c.opts.borderTitle, draw.OverrunModeThreeDot, titleCOpts...),
    97 107   draw.BorderTitleAlign(c.opts.borderTitleHAlign),
    98 108   draw.BorderCellOpts(cOpts...),
    99 109   ); err != nil {
    skipped 77 lines
  • ■ ■ ■ ■ ■ ■
    container/draw_test.go
    skipped 502 lines
    503 503   },
    504 504   },
    505 505   {
     506 + desc: "draws widget with container border and title with different color and focus color",
     507 + termSize: image.Point{9, 5},
     508 + container: func(ft *faketerm.Terminal) (*Container, error) {
     509 + return New(
     510 + ft,
     511 + Border(linestyle.Light),
     512 + BorderTitle("ab"),
     513 + TitleColor(cell.ColorBlue),
     514 + // The created container is in focus so we must set the focus color
     515 + // in order to see the difference.
     516 + TitleFocusedColor(cell.ColorBlue),
     517 + BorderTitleAlignLeft(),
     518 + PlaceWidget(fakewidget.New(widgetapi.Options{})),
     519 + )
     520 + },
     521 + want: func(size image.Point) *faketerm.Terminal {
     522 + ft := faketerm.MustNew(size)
     523 + cvs := testcanvas.MustNew(ft.Area())
     524 + // Container border.
     525 + testdraw.MustBorder(
     526 + cvs,
     527 + cvs.Area(),
     528 + draw.BorderCellOpts(cell.FgColor(cell.ColorYellow)),
     529 + draw.BorderTitle(
     530 + "ab",
     531 + draw.OverrunModeThreeDot,
     532 + cell.FgColor(cell.ColorBlue),
     533 + ),
     534 + )
     535 + 
     536 + // Fake widget border.
     537 + testdraw.MustBorder(cvs, image.Rect(1, 1, 8, 4))
     538 + testdraw.MustText(cvs, "(7,3)", image.Point{2, 2})
     539 + testcanvas.MustApply(cvs, ft)
     540 + return ft
     541 + },
     542 + },
     543 + {
    506 544   desc: "draws widget without container border",
    507 545   termSize: image.Point{9, 5},
    508 546   container: func(ft *faketerm.Terminal) (*Container, error) {
    skipped 640 lines
  • ■ ■ ■ ■ ■ ■
    container/options.go
    skipped 193 lines
    194 194   borderColor cell.Color
    195 195   // focusedColor is the color used for the border when focused.
    196 196   focusedColor cell.Color
     197 + // titleColor is the color used for the title.
     198 + titleColor *cell.Color
     199 + // titleFocusedColor is the color used for the title when focused.
     200 + titleFocusedColor *cell.Color
    197 201  }
    198 202   
    199 203  // focusGroups maps focus group numbers that have the same key assigned.
    skipped 545 lines
    745 749  func FocusedColor(color cell.Color) Option {
    746 750   return option(func(c *Container) error {
    747 751   c.opts.inherited.focusedColor = color
     752 + return nil
     753 + })
     754 +}
     755 + 
     756 +// TitleColor sets the color of the title around the container.
     757 +// This option is inherited to sub containers created by container splits.
     758 +func TitleColor(color cell.Color) Option {
     759 + return option(func(c *Container) error {
     760 + c.opts.inherited.titleColor = &color
     761 + return nil
     762 + })
     763 +}
     764 + 
     765 +// TitleFocusedColor sets the color of the container title when it has
     766 +// keyboard focus.
     767 +// This option is inherited to sub containers created by container splits.
     768 +func TitleFocusedColor(color cell.Color) Option {
     769 + return option(func(c *Container) error {
     770 + c.opts.inherited.titleFocusedColor = &color
    748 771   return nil
    749 772   })
    750 773  }
    skipped 297 lines
  • ■ ■ ■ ■ ■
    go.mod
    skipped 2 lines
    3 3  go 1.14
    4 4   
    5 5  require (
    6  - github.com/gdamore/tcell/v2 v2.0.0
     6 + github.com/gdamore/tcell/v2 v2.2.0
    7 7   github.com/kylelemons/godebug v1.1.0
    8  - github.com/mattn/go-runewidth v0.0.9
     8 + github.com/mattn/go-runewidth v0.0.10
    9 9   github.com/nsf/termbox-go v0.0.0-20201107200903-9b52a5faed9e
    10  - golang.org/x/sys v0.0.0-20201113233024-12cec1faf1ba // indirect
    11 10   golang.org/x/text v0.3.4 // indirect
    12 11  )
    13 12   
  • ■ ■ ■ ■ ■ ■
    go.sum
    1  -github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08=
    2  -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
    3 1  github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
    4 2  github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
    5  -github.com/gdamore/tcell v1.3.0 h1:r35w0JBADPZCVQijYebl6YMWWtHRqVEGt7kL2eBADRM=
    6  -github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM=
    7  -github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU=
    8  -github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0=
    9  -github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs=
    10  -github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
     3 +github.com/gdamore/tcell/v2 v2.2.0 h1:vSyEgKwraXPSOkvCk7IwOSyX+Pv3V2cV9CikJMXg4U4=
     4 +github.com/gdamore/tcell/v2 v2.2.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
    11 5  github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
    12 6  github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
    13  -github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4=
    14  -github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s=
    15 7  github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
    16 8  github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
    17  -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
    18  -github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
    19  -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
    20  -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
    21  -github.com/nsf/termbox-go v0.0.0-20200204031403-4d2b513ad8be h1:yzmWtPyxEUIKdZg4RcPq64MfS8NA6A5fNOJgYhpR9EQ=
    22  -github.com/nsf/termbox-go v0.0.0-20200204031403-4d2b513ad8be/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
     9 +github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
     10 +github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
    23 11  github.com/nsf/termbox-go v0.0.0-20201107200903-9b52a5faed9e h1:T8/SzSWIDoWV9trslLNfUdJ5yHrIXXuODEy5M0vou4U=
    24 12  github.com/nsf/termbox-go v0.0.0-20201107200903-9b52a5faed9e/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
    25  -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10=
    26  -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
    27  -golang.org/x/sys v0.0.0-20201113233024-12cec1faf1ba h1:xmhUJGQGbxlod18iJGqVEp9cHIPLl7QiX2aA3to708s=
    28  -golang.org/x/sys v0.0.0-20201113233024-12cec1faf1ba/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
    29  -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
     13 +github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
     14 +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
     15 +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
     16 +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
     17 +golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
     18 +golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
    30 19  golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
    31 20  golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
    32 21  golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
    skipped 2 lines
Please wait...
Page is in error, reload to recover