aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authory0ast <joost@joo.st>2020-11-30 22:07:03 +0000
committerReto Brunner <reto@labrat.space>2020-12-18 07:23:22 +0100
commit03650474e2190ef6e54413d433b3d1f63dc9993e (patch)
tree3b6f7df5a249eba9382de495553583795052bc3b
parentaf0a2b9a46e5d7f015682ebc1522bd421d7fe3dd (diff)
downloadaerc-03650474e2190ef6e54413d433b3d1f63dc9993e.tar.gz
update tcell to v2 and enable TrueColor support
Also update to the tcell v2 PaletteColor api, which should keep the chosen theme of the user intact. Note, that if $TRUECOLOR is defined and a truecolor given, aerc will now stop clipping the value to one of the theme colors. Generally this is desired behaviour though.
-rw-r--r--commands/util.go2
-rw-r--r--config/bindings.go2
-rw-r--r--config/bindings_test.go2
-rw-r--r--config/config.go2
-rw-r--r--config/style.go2
-rw-r--r--go.mod5
-rw-r--r--go.sum8
-rw-r--r--lib/ui/borders.go2
-rw-r--r--lib/ui/context.go4
-rw-r--r--lib/ui/fill.go2
-rw-r--r--lib/ui/grid.go2
-rw-r--r--lib/ui/interfaces.go2
-rw-r--r--lib/ui/popover.go2
-rw-r--r--lib/ui/stack.go2
-rw-r--r--lib/ui/tab.go2
-rw-r--r--lib/ui/text.go2
-rw-r--r--lib/ui/textinput.go2
-rw-r--r--lib/ui/ui.go2
-rw-r--r--widgets/account-wizard.go2
-rw-r--r--widgets/account.go2
-rw-r--r--widgets/aerc.go2
-rw-r--r--widgets/compose.go2
-rw-r--r--widgets/dirlist.go2
-rw-r--r--widgets/exline.go2
-rw-r--r--widgets/getpasswd.go2
-rw-r--r--widgets/msglist.go2
-rw-r--r--widgets/msgviewer.go2
-rw-r--r--widgets/selector.go2
-rw-r--r--widgets/spinner.go2
-rw-r--r--widgets/status.go2
-rw-r--r--widgets/terminal.go6
31 files changed, 36 insertions, 41 deletions
diff --git a/commands/util.go b/commands/util.go
index fdf20bda..b1872bc7 100644
--- a/commands/util.go
+++ b/commands/util.go
@@ -13,7 +13,7 @@ import (
"git.sr.ht/~sircmpwn/aerc/lib"
"git.sr.ht/~sircmpwn/aerc/models"
"git.sr.ht/~sircmpwn/aerc/widgets"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/mitchellh/go-homedir"
)
diff --git a/config/bindings.go b/config/bindings.go
index a19d4f35..9956b41e 100644
--- a/config/bindings.go
+++ b/config/bindings.go
@@ -7,7 +7,7 @@ import (
"io"
"strings"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
)
type KeyStroke struct {
diff --git a/config/bindings_test.go b/config/bindings_test.go
index 1d1cbfe2..44597362 100644
--- a/config/bindings_test.go
+++ b/config/bindings_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"testing"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/stretchr/testify/assert"
)
diff --git a/config/config.go b/config/config.go
index 51982d26..e6461338 100644
--- a/config/config.go
+++ b/config/config.go
@@ -14,7 +14,7 @@ import (
"time"
"unicode"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/go-ini/ini"
"github.com/imdario/mergo"
"github.com/kyoh86/xdg"
diff --git a/config/style.go b/config/style.go
index af7241de..c3e85032 100644
--- a/config/style.go
+++ b/config/style.go
@@ -8,7 +8,7 @@ import (
"regexp"
"strings"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/go-ini/ini"
"github.com/mitchellh/go-homedir"
)
diff --git a/go.mod b/go.mod
index 9e324bd6..44030e12 100644
--- a/go.mod
+++ b/go.mod
@@ -16,14 +16,13 @@ require (
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21
github.com/emersion/go-smtp v0.12.1
github.com/fsnotify/fsnotify v1.4.7
- github.com/gdamore/tcell v1.3.0
+ github.com/gdamore/tcell/v2 v2.0.0
github.com/go-ini/ini v1.52.0
github.com/golang/protobuf v1.3.4 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c // indirect
github.com/imdario/mergo v0.3.8
github.com/kyoh86/xdg v1.2.0
- github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
github.com/mattn/go-isatty v0.0.12
github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f // indirect
github.com/mattn/go-runewidth v0.0.8
@@ -46,6 +45,4 @@ require (
replace golang.org/x/crypto => github.com/ProtonMail/crypto v0.0.0-20200420072808-71bec3603bf3
-replace github.com/gdamore/tcell => git.sr.ht/~sircmpwn/tcell v0.0.0-20190807054800-3fdb6bc01a50
-
replace github.com/zenhack/go.notmuch => github.com/brunnre8/go.notmuch v0.0.0-20201126061756-caa2daf7093c
diff --git a/go.sum b/go.sum
index 134b35b9..83b19aec 100644
--- a/go.sum
+++ b/go.sum
@@ -1,9 +1,6 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
git.sr.ht/~sircmpwn/getopt v0.0.0-20190808004552-daaf1274538b h1:da5JBQ6dcW14aWnEf/pFRIMV2PsqTQEWmR+V2sw5oxU=
git.sr.ht/~sircmpwn/getopt v0.0.0-20190808004552-daaf1274538b/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw=
-git.sr.ht/~sircmpwn/tcell v0.0.0-20190807054800-3fdb6bc01a50 h1:GEZXdK3vfsEGlRwlybiAvOnYLA4YKaVWxAQSn/BSkNw=
-git.sr.ht/~sircmpwn/tcell v0.0.0-20190807054800-3fdb6bc01a50/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM=
-github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/ProtonMail/crypto v0.0.0-20200420072808-71bec3603bf3 h1:JW27/kGLQzeM1Fxg5YQhdkTEAU7HIAHMgSag35zVTnY=
github.com/ProtonMail/crypto v0.0.0-20200420072808-71bec3603bf3/go.mod h1:Pxr7w4gA2ikI4sWyYwEffm+oew1WAJHzG1SiDpQMkrI=
github.com/brunnre8/go.notmuch v0.0.0-20201126061756-caa2daf7093c h1:dh58QrW3/S/aCnQPFoeRRE9zMauKooDFd5zh1dLtxXs=
@@ -48,6 +45,8 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
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.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs=
+github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/go-ini/ini v1.52.0 h1:3UeUAveYUTCYV/G0jNDiIrrtIeAl1oAjshYyU2PaAlQ=
github.com/go-ini/ini v1.52.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -65,7 +64,6 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kyoh86/xdg v1.2.0 h1:CERuT/ShdTDj+A2UaX3hQ3mOV369+Sj+wyn2nIRIIkI=
github.com/kyoh86/xdg v1.2.0/go.mod h1:/mg8zwu1+qe76oTFUBnyS7rJzk7LLC0VGEzJyJ19DHs=
-github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s=
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/martinlindhe/base36 v0.0.0-20190418230009-7c6542dfbb41/go.mod h1:+AtEs8xrBpCeYgSLoY/aJ6Wf37jtBuR0s35750M27+8=
@@ -78,7 +76,7 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
github.com/mattn/go-pointer v0.0.0-20180825124634-49522c3f3791/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f h1:QTRRO+ozoYgT3CQRIzNVYJRU3DB8HRnkZv6mr4ISmMA=
github.com/mattn/go-pointer v0.0.0-20190911064623-a0a44394634f/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
-github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
+github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0=
github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/miolini/datacounter v1.0.2 h1:mGTL0vqEAtH7mwNJS1JIpd6jwTAP6cBQQ2P8apaCIm8=
diff --git a/lib/ui/borders.go b/lib/ui/borders.go
index 99d6880d..fd49e7fe 100644
--- a/lib/ui/borders.go
+++ b/lib/ui/borders.go
@@ -1,7 +1,7 @@
package ui
import (
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"git.sr.ht/~sircmpwn/aerc/config"
)
diff --git a/lib/ui/context.go b/lib/ui/context.go
index 6bdf76ae..7936f359 100644
--- a/lib/ui/context.go
+++ b/lib/ui/context.go
@@ -3,8 +3,8 @@ package ui
import (
"fmt"
- "github.com/gdamore/tcell"
- "github.com/gdamore/tcell/views"
+ "github.com/gdamore/tcell/v2"
+ "github.com/gdamore/tcell/v2/views"
"github.com/mattn/go-runewidth"
)
diff --git a/lib/ui/fill.go b/lib/ui/fill.go
index 4d364787..0ab4f74b 100644
--- a/lib/ui/fill.go
+++ b/lib/ui/fill.go
@@ -1,7 +1,7 @@
package ui
import (
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
)
type Fill rune
diff --git a/lib/ui/grid.go b/lib/ui/grid.go
index cff55777..f505ce02 100644
--- a/lib/ui/grid.go
+++ b/lib/ui/grid.go
@@ -6,7 +6,7 @@ import (
"sync"
"sync/atomic"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
)
type Grid struct {
diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go
index 1f2f2849..7e117256 100644
--- a/lib/ui/interfaces.go
+++ b/lib/ui/interfaces.go
@@ -1,7 +1,7 @@
package ui
import (
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
)
// Drawable is a UI component that can draw. Unless specified, all methods must
diff --git a/lib/ui/popover.go b/lib/ui/popover.go
index a76f2225..7a539de1 100644
--- a/lib/ui/popover.go
+++ b/lib/ui/popover.go
@@ -1,6 +1,6 @@
package ui
-import "github.com/gdamore/tcell"
+import "github.com/gdamore/tcell/v2"
type Popover struct {
x, y, width, height int
diff --git a/lib/ui/stack.go b/lib/ui/stack.go
index c9004a0d..53714084 100644
--- a/lib/ui/stack.go
+++ b/lib/ui/stack.go
@@ -5,7 +5,7 @@ import (
"git.sr.ht/~sircmpwn/aerc/config"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
)
type Stack struct {
diff --git a/lib/ui/tab.go b/lib/ui/tab.go
index cd5f4485..2cd8828a 100644
--- a/lib/ui/tab.go
+++ b/lib/ui/tab.go
@@ -3,7 +3,7 @@ package ui
import (
"io"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~sircmpwn/aerc/config"
diff --git a/lib/ui/text.go b/lib/ui/text.go
index 455c2eb6..ffae1938 100644
--- a/lib/ui/text.go
+++ b/lib/ui/text.go
@@ -1,7 +1,7 @@
package ui
import (
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
)
diff --git a/lib/ui/textinput.go b/lib/ui/textinput.go
index 24450658..e96499a9 100644
--- a/lib/ui/textinput.go
+++ b/lib/ui/textinput.go
@@ -4,7 +4,7 @@ import (
"math"
"time"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~sircmpwn/aerc/config"
diff --git a/lib/ui/ui.go b/lib/ui/ui.go
index ee71f8ec..66c2a054 100644
--- a/lib/ui/ui.go
+++ b/lib/ui/ui.go
@@ -3,7 +3,7 @@ package ui
import (
"sync/atomic"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
)
type UI struct {
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index f47e97e1..71ba6e16 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -11,7 +11,7 @@ import (
"strconv"
"strings"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/go-ini/ini"
"github.com/kyoh86/xdg"
diff --git a/widgets/account.go b/widgets/account.go
index f2795133..fc746a48 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib"
diff --git a/widgets/aerc.go b/widgets/aerc.go
index b5e8dd13..70bee7c6 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -10,7 +10,7 @@ import (
"time"
"github.com/emersion/go-message/mail"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/google/shlex"
"golang.org/x/crypto/openpgp"
diff --git a/widgets/compose.go b/widgets/compose.go
index e139f9ac..aab33088 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -16,7 +16,7 @@ import (
"time"
"github.com/emersion/go-message/mail"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index aca14914..5711fe40 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -7,7 +7,7 @@ import (
"regexp"
"sort"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~sircmpwn/aerc/config"
diff --git a/widgets/exline.go b/widgets/exline.go
index 692c8e21..24c39c10 100644
--- a/widgets/exline.go
+++ b/widgets/exline.go
@@ -1,7 +1,7 @@
package widgets
import (
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib"
diff --git a/widgets/getpasswd.go b/widgets/getpasswd.go
index 3cdc5cfe..b5c3d0ec 100644
--- a/widgets/getpasswd.go
+++ b/widgets/getpasswd.go
@@ -3,7 +3,7 @@ package widgets
import (
"fmt"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib/ui"
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 61738a89..827282b3 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -5,7 +5,7 @@ import (
"log"
"math"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~sircmpwn/aerc/config"
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 6c695771..216a8c5e 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -11,7 +11,7 @@ import (
"strings"
"github.com/danwakefield/fnmatch"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/google/shlex"
"github.com/mattn/go-runewidth"
diff --git a/widgets/selector.go b/widgets/selector.go
index d19d38f6..196601bf 100644
--- a/widgets/selector.go
+++ b/widgets/selector.go
@@ -1,7 +1,7 @@
package widgets
import (
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib/ui"
diff --git a/widgets/spinner.go b/widgets/spinner.go
index 0c724221..f49256aa 100644
--- a/widgets/spinner.go
+++ b/widgets/spinner.go
@@ -5,7 +5,7 @@ import (
"sync/atomic"
"time"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib/ui"
diff --git a/widgets/status.go b/widgets/status.go
index 122ca5f1..dfad08ca 100644
--- a/widgets/status.go
+++ b/widgets/status.go
@@ -3,7 +3,7 @@ package widgets
import (
"time"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
"github.com/mattn/go-runewidth"
"git.sr.ht/~sircmpwn/aerc/config"
diff --git a/widgets/terminal.go b/widgets/terminal.go
index 77da71e6..e83c812f 100644
--- a/widgets/terminal.go
+++ b/widgets/terminal.go
@@ -10,7 +10,7 @@ import (
"github.com/creack/pty"
"github.com/ddevault/go-libvterm"
- "github.com/gdamore/tcell"
+ "github.com/gdamore/tcell/v2"
)
type vtermKey struct {
@@ -406,7 +406,7 @@ func (term *Terminal) styleFromCell(cell *vterm.ScreenCell) tcell.Style {
if background.IsDefaultBg() {
bg = tcell.ColorDefault
} else if background.IsIndexed() {
- bg = tcell.Color(background.GetIndex())
+ bg = tcell.Color(tcell.PaletteColor(int(background.GetIndex())))
} else if background.IsRgb() {
r, g, b := background.GetRGB()
bg = tcell.NewRGBColor(int32(r), int32(g), int32(b))
@@ -414,7 +414,7 @@ func (term *Terminal) styleFromCell(cell *vterm.ScreenCell) tcell.Style {
if foreground.IsDefaultFg() {
fg = tcell.ColorDefault
} else if foreground.IsIndexed() {
- fg = tcell.Color(foreground.GetIndex())
+ fg = tcell.Color(tcell.PaletteColor(int(foreground.GetIndex())))
} else if foreground.IsRgb() {
r, g, b := foreground.GetRGB()
fg = tcell.NewRGBColor(int32(r), int32(g), int32(b))