Upgraded to latest tcell version. Results in a minor incompatibility in the Table class.

pull/516/head
Oliver 4 years ago
parent 42866ecf6c
commit e4d167311d

@ -86,12 +86,20 @@ For a presentation highlighting this package, compile and run the program found
## Documentation ## Documentation
Refer to https://pkg.go.dev/github.com/rivo/tview for the package's documentation. Refer to https://pkg.go.dev/github.com/rivo/tview for the package's documentation. Also check out the [Wiki](https://github.com/rivo/tview/wiki).
## Dependencies ## Dependencies
This package is based on [github.com/gdamore/tcell](https://github.com/gdamore/tcell) (and its dependencies) as well as on [github.com/rivo/uniseg](https://github.com/rivo/uniseg). This package is based on [github.com/gdamore/tcell](https://github.com/gdamore/tcell) (and its dependencies) as well as on [github.com/rivo/uniseg](https://github.com/rivo/uniseg).
## Versioning and Backwards-Compatibility
I try really hard to keep this project backwards compatible. Your software should not break when you upgrade `tview`. But this also means that some of its shortcomings that were present in the initial versions will remain. In addition, at least for the time being, you won't find any version tags in this repo. The newest version shoud be the one to upgrade to. It has all the bugfixes and latest features. Having said that, backwards compatibility may still break when:
- a new version of an imported package (most likely [`tcell`](https://github.com/gdamore/tcell)) changes in such a way that forces me to make changes in `tview` as well,
- I fix something that I consider a bug, rather than a feature, something that does not work as originally intended,
- I make changes to "internal" interfaces such as [`Primitive`](https://pkg.go.dev/github.com/rivo/tview#Primitive) or [`Focusable`](https://pkg.go.dev/github.com/rivo/tview#Focusable). You shouldn't need these interfaces unless you're writing your own primitives for `tview`.
## Your Feedback ## Your Feedback
Add your issue here on GitHub. Feel free to get in touch if you have any questions. Add your issue here on GitHub. Feel free to get in touch if you have any questions.

@ -4,7 +4,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
const ( const (

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// Box implements the Primitive interface with an empty background and optional // Box implements the Primitive interface with an empty background and optional
@ -30,11 +30,8 @@ type Box struct {
// two in width and height. // two in width and height.
border bool border bool
// The color of the border. // The border style.
borderColor tcell.Color borderStyle tcell.Style
// The style attributes of the border.
borderAttributes tcell.AttrMask
// The title. Only visible if there is a border, too. // The title. Only visible if there is a border, too.
title string title string
@ -73,7 +70,7 @@ func NewBox() *Box {
height: 10, height: 10,
innerX: -1, // Mark as uninitialized. innerX: -1, // Mark as uninitialized.
backgroundColor: Styles.PrimitiveBackgroundColor, backgroundColor: Styles.PrimitiveBackgroundColor,
borderColor: Styles.BorderColor, borderStyle: tcell.StyleDefault.Foreground(Styles.BorderColor),
titleColor: Styles.TitleColor, titleColor: Styles.TitleColor,
titleAlign: AlignCenter, titleAlign: AlignCenter,
} }
@ -267,7 +264,7 @@ func (b *Box) SetBorder(show bool) *Box {
// SetBorderColor sets the box's border color. // SetBorderColor sets the box's border color.
func (b *Box) SetBorderColor(color tcell.Color) *Box { func (b *Box) SetBorderColor(color tcell.Color) *Box {
b.borderColor = color b.borderStyle = b.borderStyle.Foreground(color)
return b return b
} }
@ -276,18 +273,20 @@ func (b *Box) SetBorderColor(color tcell.Color) *Box {
// //
// box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) // box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold)
func (b *Box) SetBorderAttributes(attr tcell.AttrMask) *Box { func (b *Box) SetBorderAttributes(attr tcell.AttrMask) *Box {
b.borderAttributes = attr b.borderStyle = b.borderStyle.Attributes(attr)
return b return b
} }
// GetBorderAttributes returns the border's style attributes. // GetBorderAttributes returns the border's style attributes.
func (b *Box) GetBorderAttributes() tcell.AttrMask { func (b *Box) GetBorderAttributes() tcell.AttrMask {
return b.borderAttributes _, _, attr := b.borderStyle.Decompose()
return attr
} }
// GetBorderColor returns the box's border color. // GetBorderColor returns the box's border color.
func (b *Box) GetBorderColor() tcell.Color { func (b *Box) GetBorderColor() tcell.Color {
return b.borderColor color, _, _ := b.borderStyle.Decompose()
return color
} }
// GetBackgroundColor returns the box's background color. // GetBackgroundColor returns the box's background color.
@ -340,7 +339,6 @@ func (b *Box) Draw(screen tcell.Screen) {
// Draw border. // Draw border.
if b.border && b.width >= 2 && b.height >= 2 { if b.border && b.width >= 2 && b.height >= 2 {
border := background.Foreground(b.borderColor) | tcell.Style(b.borderAttributes)
var vertical, horizontal, topLeft, topRight, bottomLeft, bottomRight rune var vertical, horizontal, topLeft, topRight, bottomLeft, bottomRight rune
if b.focus.HasFocus() { if b.focus.HasFocus() {
horizontal = Borders.HorizontalFocus horizontal = Borders.HorizontalFocus
@ -358,17 +356,17 @@ func (b *Box) Draw(screen tcell.Screen) {
bottomRight = Borders.BottomRight bottomRight = Borders.BottomRight
} }
for x := b.x + 1; x < b.x+b.width-1; x++ { for x := b.x + 1; x < b.x+b.width-1; x++ {
screen.SetContent(x, b.y, horizontal, nil, border) screen.SetContent(x, b.y, horizontal, nil, b.borderStyle)
screen.SetContent(x, b.y+b.height-1, horizontal, nil, border) screen.SetContent(x, b.y+b.height-1, horizontal, nil, b.borderStyle)
} }
for y := b.y + 1; y < b.y+b.height-1; y++ { for y := b.y + 1; y < b.y+b.height-1; y++ {
screen.SetContent(b.x, y, vertical, nil, border) screen.SetContent(b.x, y, vertical, nil, b.borderStyle)
screen.SetContent(b.x+b.width-1, y, vertical, nil, border) screen.SetContent(b.x+b.width-1, y, vertical, nil, b.borderStyle)
} }
screen.SetContent(b.x, b.y, topLeft, nil, border) screen.SetContent(b.x, b.y, topLeft, nil, b.borderStyle)
screen.SetContent(b.x+b.width-1, b.y, topRight, nil, border) screen.SetContent(b.x+b.width-1, b.y, topRight, nil, b.borderStyle)
screen.SetContent(b.x, b.y+b.height-1, bottomLeft, nil, border) screen.SetContent(b.x, b.y+b.height-1, bottomLeft, nil, b.borderStyle)
screen.SetContent(b.x+b.width-1, b.y+b.height-1, bottomRight, nil, border) screen.SetContent(b.x+b.width-1, b.y+b.height-1, bottomRight, nil, b.borderStyle)
// Draw title. // Draw title.
if b.title != "" && b.width >= 4 { if b.title != "" && b.width >= 4 {

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// Button is labeled box that triggers an action when selected. // Button is labeled box that triggers an action when selected.
@ -95,13 +95,13 @@ func (b *Button) SetBlurFunc(handler func(key tcell.Key)) *Button {
// Draw draws this primitive onto the screen. // Draw draws this primitive onto the screen.
func (b *Button) Draw(screen tcell.Screen) { func (b *Button) Draw(screen tcell.Screen) {
// Draw the box. // Draw the box.
borderColor := b.borderColor borderColor := b.GetBorderColor()
backgroundColor := b.backgroundColor backgroundColor := b.GetBackgroundColor()
if b.focus.HasFocus() { if b.focus.HasFocus() {
b.backgroundColor = b.backgroundColorActivated b.SetBackgroundColor(b.backgroundColorActivated)
b.borderColor = b.labelColorActivated b.SetBorderColor(b.labelColorActivated)
defer func() { defer func() {
b.borderColor = borderColor b.SetBorderColor(borderColor)
}() }()
} }
b.Box.Draw(screen) b.Box.Draw(screen)

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// Checkbox implements a simple box for boolean values which can be checked and // Checkbox implements a simple box for boolean values which can be checked and

@ -2,7 +2,7 @@
package main package main
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -2,7 +2,7 @@
package main package main
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -3,7 +3,7 @@ package main
import ( import (
"strings" "strings"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -7,7 +7,7 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -2,7 +2,7 @@
package main package main
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -3,7 +3,7 @@ package main
import ( import (
"strings" "strings"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )
@ -10,7 +10,7 @@ const inputField = `[green]package[white] main
[green]import[white] ( [green]import[white] (
[red]"strconv"[white] [red]"strconv"[white]
[red]"github.com/gdamore/tcell"[white] [red]"github.com/gdamore/tcell/v2"[white]
[red]"github.com/rivo/tview"[white] [red]"github.com/rivo/tview"[white]
) )

@ -16,7 +16,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )
@ -68,7 +68,7 @@ const textView2 = `[green]package[white] main
[green]import[white] ( [green]import[white] (
[red]"strconv"[white] [red]"strconv"[white]
[red]"github.com/gdamore/tcell"[white] [red]"github.com/gdamore/tcell/v2"[white]
[red]"github.com/rivo/tview"[white] [red]"github.com/rivo/tview"[white]
) )

@ -3,7 +3,7 @@ package main
import ( import (
"strings" "strings"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -4,7 +4,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -4,7 +4,7 @@ package main
import ( import (
"strings" "strings"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -7,7 +7,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -5,7 +5,7 @@ import (
"io/ioutil" "io/ioutil"
"path/filepath" "path/filepath"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
"github.com/rivo/tview" "github.com/rivo/tview"
) )

@ -3,7 +3,7 @@ package tview
import ( import (
"strings" "strings"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// dropDownOption is one option that can be selected in a drop-down primitive. // dropDownOption is one option that can be selected in a drop-down primitive.

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// Configuration values. // Configuration values.

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// DefaultFormFieldWidth is the default field screen width of form elements // DefaultFormFieldWidth is the default field screen width of form elements

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// frameText holds information about a line of text shown in the frame. // frameText holds information about a line of text shown in the frame.

@ -3,10 +3,10 @@ module github.com/rivo/tview
go 1.12 go 1.12
require ( require (
github.com/gdamore/tcell v1.3.0 github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591
github.com/lucasb-eyer/go-colorful v1.0.3 github.com/lucasb-eyer/go-colorful v1.0.3
github.com/mattn/go-runewidth v0.0.9 github.com/mattn/go-runewidth v0.0.9
github.com/rivo/uniseg v0.1.0 github.com/rivo/uniseg v0.1.0
golang.org/x/sys v0.0.0-20200817155316-9781c653f443 // indirect golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7 // indirect
golang.org/x/text v0.3.2 // indirect golang.org/x/text v0.3.3 // indirect
) )

@ -1,25 +1,22 @@
github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= 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/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/gdamore/tcell v1.3.0 h1:r35w0JBADPZCVQijYebl6YMWWtHRqVEGt7kL2eBADRM= github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs=
github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM= github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591 h1:0WWUDZ1oxq7NxVyGo8M3KI5jbkiwNAdZFFzAdC68up4=
github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= 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/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10= 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/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200817155316-9781c653f443 h1:X18bCaipMcoJGm27Nv7zr4XYPKGUy92GtqboKC2Hxaw= golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7 h1:XtNJkfEjb4zR3q20BBBcYUykVOEMgZeIUOpBPfNYgxg=
golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

@ -3,7 +3,7 @@ package tview
import ( import (
"math" "math"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// gridItem represents one primitive and its possible position on a grid. // gridItem represents one primitive and its possible position on a grid.

@ -7,7 +7,7 @@ import (
"sync" "sync"
"unicode/utf8" "unicode/utf8"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// InputField is a one-line box (three lines if there is a title) where the // InputField is a one-line box (three lines if there is a title) where the

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// listItem represents one item in a List. // listItem represents one item in a List.

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// Modal is a centered message window used to inform the user or prompt them // Modal is a centered message window used to inform the user or prompt them

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// page represents one page of a Pages object. // page represents one page of a Pages object.

@ -1,6 +1,6 @@
package tview package tview
import "github.com/gdamore/tcell" import "github.com/gdamore/tcell/v2"
// Primitive is the top-most interface for all graphical primitives. // Primitive is the top-most interface for all graphical primitives.
type Primitive interface { type Primitive interface {

@ -1,6 +1,6 @@
package tview package tview
import "github.com/gdamore/tcell" import "github.com/gdamore/tcell/v2"
// Semigraphics provides an easy way to access unicode characters for drawing. // Semigraphics provides an easy way to access unicode characters for drawing.
// //

@ -1,6 +1,6 @@
package tview package tview
import "github.com/gdamore/tcell" import "github.com/gdamore/tcell/v2"
// Theme defines the colors used when primitives are initialized. // Theme defines the colors used when primitives are initialized.
type Theme struct { type Theme struct {

@ -3,7 +3,7 @@ package tview
import ( import (
"sort" "sort"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
colorful "github.com/lucasb-eyer/go-colorful" colorful "github.com/lucasb-eyer/go-colorful"
) )
@ -271,8 +271,8 @@ type Table struct {
// drawn. // drawn.
visibleColumnWidths []int visibleColumnWidths []int
// The style of the selected rows. If this value is 0, selected rows are // The style of the selected rows. If this value is the empty struct,
// simply inverted. // selected rows are simply inverted.
selectedStyle tcell.Style selectedStyle tcell.Style
// An optional function which gets called when the user presses Enter on a // An optional function which gets called when the user presses Enter on a
@ -327,8 +327,8 @@ func (t *Table) SetBordersColor(color tcell.Color) *Table {
// To reset a previous setting to its default, make the following call: // To reset a previous setting to its default, make the following call:
// //
// table.SetSelectedStyle(tcell.ColorDefault, tcell.ColorDefault, 0) // table.SetSelectedStyle(tcell.ColorDefault, tcell.ColorDefault, 0)
func (t *Table) SetSelectedStyle(foregroundColor, backgroundColor tcell.Color, attributes tcell.AttrMask) *Table { func (t *Table) SetSelectedStyle(style tcell.Style) *Table {
t.selectedStyle = tcell.StyleDefault.Foreground(foregroundColor).Background(backgroundColor) | tcell.Style(attributes) t.selectedStyle = style
return t return t
} }
@ -885,7 +885,7 @@ ColumnLoop:
finalWidth = width - columnX - 1 finalWidth = width - columnX - 1
} }
cell.x, cell.y, cell.width = x+columnX+1, y+rowY, finalWidth cell.x, cell.y, cell.width = x+columnX+1, y+rowY, finalWidth
_, printed := printWithStyle(screen, cell.Text, x+columnX+1, y+rowY, finalWidth, cell.Align, tcell.StyleDefault.Foreground(cell.Color)|tcell.Style(cell.Attributes)) _, printed := printWithStyle(screen, cell.Text, x+columnX+1, y+rowY, finalWidth, cell.Align, tcell.StyleDefault.Foreground(cell.Color).Attributes(cell.Attributes))
if TaggedStringWidth(cell.Text)-printed > 0 && printed > 0 { if TaggedStringWidth(cell.Text)-printed > 0 && printed > 0 {
_, _, style, _ := screen.GetContent(x+columnX+finalWidth, y+rowY) _, _, style, _ := screen.GetContent(x+columnX+finalWidth, y+rowY)
printWithStyle(screen, string(SemigraphicsHorizontalEllipsis), x+columnX+finalWidth, y+rowY, 1, AlignLeft, style) printWithStyle(screen, string(SemigraphicsHorizontalEllipsis), x+columnX+finalWidth, y+rowY, 1, AlignLeft, style)
@ -954,7 +954,7 @@ ColumnLoop:
if attr != 0 { if attr != 0 {
a = attr a = attr
} }
style = style.Background(bg).Foreground(fg) | tcell.Style(a) style = style.Background(bg).Foreground(fg).Attributes(a)
} }
screen.SetContent(fromX+bx, fromY+by, m, c, style) screen.SetContent(fromX+bx, fromY+by, m, c, style)
} }
@ -1017,7 +1017,7 @@ ColumnLoop:
entries := cellsByBackgroundColor[bgColor] entries := cellsByBackgroundColor[bgColor]
for _, cell := range entries { for _, cell := range entries {
if cell.selected { if cell.selected {
if t.selectedStyle != 0 { if t.selectedStyle != (tcell.Style{}) {
defer colorBackground(cell.x, cell.y, cell.w, cell.h, selBg, selFg, selAttr, false) defer colorBackground(cell.x, cell.y, cell.w, cell.h, selBg, selFg, selAttr, false)
} else { } else {
defer colorBackground(cell.x, cell.y, cell.w, cell.h, bgColor, cell.text, 0, true) defer colorBackground(cell.x, cell.y, cell.w, cell.h, bgColor, cell.text, 0, true)

@ -8,7 +8,7 @@ import (
"sync" "sync"
"unicode/utf8" "unicode/utf8"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
colorful "github.com/lucasb-eyer/go-colorful" colorful "github.com/lucasb-eyer/go-colorful"
runewidth "github.com/mattn/go-runewidth" runewidth "github.com/mattn/go-runewidth"
"github.com/rivo/uniseg" "github.com/rivo/uniseg"

@ -1,7 +1,7 @@
package tview package tview
import ( import (
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
) )
// Tree navigation events. // Tree navigation events.

@ -6,7 +6,7 @@ import (
"sort" "sort"
"strconv" "strconv"
"github.com/gdamore/tcell" "github.com/gdamore/tcell/v2"
runewidth "github.com/mattn/go-runewidth" runewidth "github.com/mattn/go-runewidth"
"github.com/rivo/uniseg" "github.com/rivo/uniseg"
) )

Loading…
Cancel
Save