Skip to content

Commit

Permalink
update tview dep
Browse files Browse the repository at this point in the history
  • Loading branch information
zaquestion committed Jul 25, 2019
1 parent 3654a36 commit 18d029c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
12 changes: 10 additions & 2 deletions cmd/ci_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/spf13/cobra"

"github.com/lunixbochs/vtclean"
"github.com/xanzy/go-gitlab"
gitlab "github.com/xanzy/go-gitlab"

"github.com/zaquestion/lab/internal/git"
lab "github.com/zaquestion/lab/internal/gitlab"
Expand Down Expand Up @@ -403,6 +403,14 @@ func jobsView(app *tview.Application, jobsCh chan []*gitlab.Job, root *tview.Pag
}
// retryChar := '⟳'
title := fmt.Sprintf("%c %s", statChar, j.Name)
if statChar == '✔' {
// I don't understand why, but upon updating
// rivo/tview the '✔' rune now gets printed
// with an extra space for the title, so I'm
// remove the space that I add here to obviate
// this.
title = fmt.Sprintf("%c%s", statChar, j.Name)
}
// trim the suffix if it matches the stage, I've seen
// the pattern in 2 different places to handle
// different stages for the same service and it tends
Expand All @@ -412,7 +420,7 @@ func jobsView(app *tview.Application, jobsCh chan []*gitlab.Job, root *tview.Pag
// tview default aligns center, which is nice, but if
// the title is too long we want to bias towards seeing
// the beginning of it
if tview.StringWidth(title) > maxTitle {
if tview.TaggedStringWidth(title) > maxTitle {
b.SetTitleAlign(tview.AlignLeft)
}
if j.StartedAt != nil {
Expand Down
15 changes: 9 additions & 6 deletions cmd/ci_view_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package cmd

import (
"strconv"
"strings"
"testing"
"time"

"github.com/gdamore/tcell"
"github.com/rivo/tview"
"github.com/stretchr/testify/assert"
"github.com/xanzy/go-gitlab"
gitlab "github.com/xanzy/go-gitlab"
)

func assertScreen(t *testing.T, screen tcell.Screen, expected []string) {
Expand All @@ -22,16 +22,19 @@ func assertScreen(t *testing.T, screen tcell.Screen, expected []string) {
for x, expectedRune := range row {
r, _, _, _ := screen.GetContent(x, y)
runes[x] = r
assert.Equal(t, expectedRune, r, "%s != %s at (%d,%d)",
strconv.QuoteRune(expectedRune), strconv.QuoteRune(r), x, y)
_ = expectedRune
//assert.Equal(t, expectedRune, r, "%s != %s at (%d,%d)",
// strconv.QuoteRune(expectedRune), strconv.QuoteRune(r), x, y)
}
actual[y] = string(runes)

actual[y] = strings.TrimRight(string(runes), string('\x00'))
assert.Equal(t, str, actual[y])
}
t.Logf("Expected w: %d l: %d", len([]rune(expected[0])), len(expected))
for _, str := range expected {
t.Log(str)
}
t.Logf("Actual w: %d l: %d", len([]rune(actual[0])), len(actual))
t.Logf("Actual w: %d l: %d", sx, sy)
for _, str := range actual {
t.Log(str)
}
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@ require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/avast/retry-go v0.0.0-20180319101611-5469272a8171
github.com/cpuguy83/go-md2man v1.0.8 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/derekparker/delve v1.1.0
github.com/gdamore/encoding v0.0.0-20151215212835-b23993cbb635 // indirect
github.com/gdamore/tcell v0.0.0-20180416163743-2f258105ca8c
github.com/gdamore/tcell v1.1.4
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/lucasb-eyer/go-colorful v0.0.0-20170903184257-231272389856 // indirect
github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a
github.com/magiconair/properties v1.7.6 // indirect
github.com/mattn/go-runewidth v0.0.2 // indirect
github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/pelletier/go-toml v1.1.0 // indirect
github.com/pkg/errors v0.8.0
github.com/rivo/tview v0.0.0-20180419193403-f855bee0205c
github.com/rivo/tview v0.0.0-20190721135419-23dc8a0944e4
github.com/russross/blackfriday v1.5.1 // indirect
github.com/sirupsen/logrus v1.2.0 // indirect
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
Expand Down
17 changes: 17 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/avast/retry-go v0.0.0-20180319101611-5469272a8171 h1:XlIpp6HSsMrVyPaAn1ohRPPXCDIISuSVJBD1TZXXylQ=
github.com/avast/retry-go v0.0.0-20180319101611-5469272a8171/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
github.com/cpuguy83/go-md2man v1.0.8 h1:DwoNytLphI8hzS2Af4D0dfaEaiSq2bN05mEm4R6vf8M=
Expand All @@ -14,8 +15,14 @@ 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 v0.0.0-20151215212835-b23993cbb635 h1:hheUEMzaOie/wKeIc1WPa7CDVuIO5hqQxjS+dwTQEnI=
github.com/gdamore/encoding v0.0.0-20151215212835-b23993cbb635/go.mod h1:yrQYJKKDTrHmbYxI7CYi+/hbdiDT2m4Hj+t0ikCjsrQ=
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 v0.0.0-20180416163743-2f258105ca8c h1:SEZ81CdbjO7Zvqt32CFqMUZYsXUFYAuXrpEirQkXVu8=
github.com/gdamore/tcell v0.0.0-20180416163743-2f258105ca8c/go.mod h1:tqyG50u7+Ctv1w5VX67kLzKcj9YXR/JSBZQq/+mLl1A=
github.com/gdamore/tcell v1.1.2 h1:Afe8cU6SECC06UmvaJ55Jr3Eh0tz/ywLjqWYqjGZp3s=
github.com/gdamore/tcell v1.1.2/go.mod h1:h3kq4HO9l2On+V9ed8w8ewqQEmGCSSHOgQ+2h8uzurE=
github.com/gdamore/tcell v1.1.4 h1:6Bubmk3vZvnL9umQ9qTV2kwNQnjaZ4HLAbxR+xR3ATg=
github.com/gdamore/tcell v1.1.4/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 h1:zLTLjkaOFEFIOxY5BWLFLwh+cL8vOBW4XJ2aqLE/Tf0=
Expand All @@ -35,12 +42,16 @@ github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVY
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/lucasb-eyer/go-colorful v0.0.0-20170903184257-231272389856 h1:r+WvXmgROttp7pckv7TPN7OCUEPXmvhRklOOsL2iPPc=
github.com/lucasb-eyer/go-colorful v0.0.0-20170903184257-231272389856/go.mod h1:NXg0ArsFk0Y01623LgUqoqcouGDB+PwCCQlrwrG6xJ4=
github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4=
github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s=
github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a h1:weJVJJRzAJBFRlAiJQROKQs8oC9vOxvm4rZmBBk0ONw=
github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
github.com/magiconair/properties v1.7.6 h1:U+1DqNen04MdEPgFiIwdOUiqZ8qPa37xgogX/sd3+54=
github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238 h1:+MZW2uvHgN8kYvksEN3f7eFL2wpzk0GxmlFsMybWc7E=
github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw=
Expand All @@ -55,6 +66,10 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/tview v0.0.0-20180419193403-f855bee0205c h1:glHTGj2GpdU/IVxB1lptVQaUi48w72qq8GfkaZpBJtY=
github.com/rivo/tview v0.0.0-20180419193403-f855bee0205c/go.mod h1:J4W+hErFfITUbyFAEXizpmkuxX7ZN56dopxHB4XQhMw=
github.com/rivo/tview v0.0.0-20190721135419-23dc8a0944e4 h1:3L7UVoI/26LdSEPadEc4tNPMW+4vLBJaj31jAlJG4xg=
github.com/rivo/tview v0.0.0-20190721135419-23dc8a0944e4/go.mod h1:+rKjP5+h9HMwWRpAfhIkkQ9KE3m3Nz5rwn7YtUpwgqk=
github.com/rivo/uniseg v0.0.0-20190513083848-b9f5b9457d44 h1:XKCbzPvK4/BbMXoMJOkYP2ANxiAEO0HM1xn6psSbXxY=
github.com/rivo/uniseg v0.0.0-20190513083848-b9f5b9457d44/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rsteube/cobra v0.0.1-zsh-completion-custom h1:Hqbid4kBOEu78syaZ8hCAIjwLZGqraO0zlyytAVNhkY=
github.com/rsteube/cobra v0.0.1-zsh-completion-custom/go.mod h1:pAlNXnbm7kUeUgr/8AEn0Lv+VrT1T6obUvI1mC8KlvA=
github.com/russross/blackfriday v1.5.1 h1:B8ZN6pD4PVofmlDCDUdELeYrbsVIDM/bpjW3v3zgcRc=
Expand Down Expand Up @@ -115,6 +130,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
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/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190107155254-e063def13b29 h1:mtLB/BpwjjSIylF0++D6EG1ExPVEIcFKMMwK6HFmbtU=
Expand Down

0 comments on commit 18d029c

Please sign in to comment.