From 3fa2d15fb899c937900083fd7de696599371ce47 Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Wed, 26 Dec 2018 22:49:25 +0800 Subject: Implement displaying CJK contents --- termui/bug_table.go | 10 +++++----- termui/input_popup.go | 4 ++-- termui/label_select.go | 8 ++++---- termui/msg_popup.go | 4 ++-- termui/show_bug.go | 12 ++++++------ termui/termui.go | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) (limited to 'termui') diff --git a/termui/bug_table.go b/termui/bug_table.go index 1545dbc9..fb281d74 100644 --- a/termui/bug_table.go +++ b/termui/bug_table.go @@ -9,7 +9,7 @@ import ( "github.com/MichaelMure/git-bug/util/colors" "github.com/MichaelMure/git-bug/util/text" "github.com/dustin/go-humanize" - "github.com/jroimartin/gocui" + "github.com/jesseduffield/gocui" ) const bugTableView = "bugTableView" @@ -53,7 +53,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { return nil } - v, err := g.SetView(bugTableHeaderView, -1, -1, maxX, 3) + v, err := g.SetView(bugTableHeaderView, -1, -1, maxX, 3, 0) if err != nil { if err != gocui.ErrUnknownView { @@ -66,7 +66,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { v.Clear() bt.renderHeader(v, maxX) - v, err = g.SetView(bugTableView, -1, 1, maxX, maxY-3) + v, err = g.SetView(bugTableView, -1, 1, maxX, maxY-3, 0) if err != nil { if err != gocui.ErrUnknownView { @@ -97,7 +97,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { v.Clear() bt.render(v, maxX) - v, err = g.SetView(bugTableFooterView, -1, maxY-4, maxX, maxY) + v, err = g.SetView(bugTableFooterView, -1, maxY-4, maxX, maxY, 0) if err != nil { if err != gocui.ErrUnknownView { @@ -110,7 +110,7 @@ func (bt *bugTable) layout(g *gocui.Gui) error { v.Clear() bt.renderFooter(v, maxX) - v, err = g.SetView(bugTableInstructionView, -1, maxY-2, maxX, maxY) + v, err = g.SetView(bugTableInstructionView, -1, maxY-2, maxX, maxY, 0) if err != nil { if err != gocui.ErrUnknownView { diff --git a/termui/input_popup.go b/termui/input_popup.go index db0ec619..7500168f 100644 --- a/termui/input_popup.go +++ b/termui/input_popup.go @@ -3,7 +3,7 @@ package termui import ( "io/ioutil" - "github.com/jroimartin/gocui" + "github.com/jesseduffield/gocui" ) const inputPopupView = "inputPopupView" @@ -46,7 +46,7 @@ func (ip *inputPopup) layout(g *gocui.Gui) error { x0 := (maxX - width) / 2 y0 := (maxY - height) / 2 - v, err := g.SetView(inputPopupView, x0, y0, x0+width, y0+height) + v, err := g.SetView(inputPopupView, x0, y0, x0+width, y0+height, 0) if err != nil { if err != gocui.ErrUnknownView { return err diff --git a/termui/label_select.go b/termui/label_select.go index 244001df..c93dd833 100644 --- a/termui/label_select.go +++ b/termui/label_select.go @@ -6,7 +6,7 @@ import ( "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/cache" - "github.com/jroimartin/gocui" + "github.com/jesseduffield/gocui" ) const labelSelectView = "labelSelectView" @@ -105,7 +105,7 @@ func (ls *labelSelect) layout(g *gocui.Gui) error { x0 := 1 y0 := 0 - ls.scroll - v, err := g.SetView(labelSelectView, x0, 0, x0+width, maxY-2) + v, err := g.SetView(labelSelectView, x0, 0, x0+width, maxY-2, 0) if err != nil { if err != gocui.ErrUnknownView { return err @@ -116,7 +116,7 @@ func (ls *labelSelect) layout(g *gocui.Gui) error { for i, label := range ls.labels { viewname := fmt.Sprintf("view%d", i) - v, err := g.SetView(viewname, x0+2, y0, x0+width-2, y0+2) + v, err := g.SetView(viewname, x0+2, y0, x0+width-2, y0+2, 0) if err != nil && err != gocui.ErrUnknownView { return err } @@ -131,7 +131,7 @@ func (ls *labelSelect) layout(g *gocui.Gui) error { y0 += 2 } - v, err = g.SetView(labelSelectInstructionsView, -1, maxY-2, maxX, maxY) + v, err = g.SetView(labelSelectInstructionsView, -1, maxY-2, maxX, maxY, 0) ls.childViews = append(ls.childViews, labelSelectInstructionsView) if err != nil { if err != gocui.ErrUnknownView { diff --git a/termui/msg_popup.go b/termui/msg_popup.go index 0ce390dc..af752106 100644 --- a/termui/msg_popup.go +++ b/termui/msg_popup.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/MichaelMure/git-bug/util/text" - "github.com/jroimartin/gocui" + "github.com/jesseduffield/gocui" ) const msgPopupView = "msgPopupView" @@ -50,7 +50,7 @@ func (ep *msgPopup) layout(g *gocui.Gui) error { x0 := (maxX - width) / 2 y0 := (maxY - height) / 2 - v, err := g.SetView(msgPopupView, x0, y0, x0+width, y0+height) + v, err := g.SetView(msgPopupView, x0, y0, x0+width, y0+height, 0) if err != nil { if err != gocui.ErrUnknownView { return err diff --git a/termui/show_bug.go b/termui/show_bug.go index a1f4b3fe..49754d83 100644 --- a/termui/show_bug.go +++ b/termui/show_bug.go @@ -10,7 +10,7 @@ import ( "github.com/MichaelMure/git-bug/util/colors" "github.com/MichaelMure/git-bug/util/git" "github.com/MichaelMure/git-bug/util/text" - "github.com/jroimartin/gocui" + "github.com/jesseduffield/gocui" ) const showBugView = "showBugView" @@ -48,7 +48,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { maxX, maxY := g.Size() sb.childViews = nil - v, err := g.SetView(showBugView, 0, 0, maxX*2/3, maxY-2) + v, err := g.SetView(showBugView, 0, 0, maxX*2/3, maxY-2, 0) if err != nil { if err != gocui.ErrUnknownView { @@ -65,7 +65,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { return err } - v, err = g.SetView(showBugSidebarView, maxX*2/3+1, 0, maxX-1, maxY-2) + v, err = g.SetView(showBugSidebarView, maxX*2/3+1, 0, maxX-1, maxY-2, 0) if err != nil { if err != gocui.ErrUnknownView { @@ -82,7 +82,7 @@ func (sb *showBug) layout(g *gocui.Gui) error { return err } - v, err = g.SetView(showBugInstructionView, -1, maxY-2, maxX, maxY) + v, err = g.SetView(showBugInstructionView, -1, maxY-2, maxX, maxY, 0) if err != nil { if err != gocui.ErrUnknownView { @@ -382,7 +382,7 @@ func emptyMessagePlaceholder() string { } func (sb *showBug) createOpView(g *gocui.Gui, name string, x0 int, y0 int, maxX int, height int, selectable bool) (*gocui.View, error) { - v, err := g.SetView(name, x0, y0, maxX, y0+height+1) + v, err := g.SetView(name, x0, y0, maxX, y0+height+1, 0) if err != nil && err != gocui.ErrUnknownView { return nil, err @@ -402,7 +402,7 @@ func (sb *showBug) createOpView(g *gocui.Gui, name string, x0 int, y0 int, maxX } func (sb *showBug) createSideView(g *gocui.Gui, name string, x0 int, y0 int, maxX int, height int) (*gocui.View, error) { - v, err := g.SetView(name, x0, y0, maxX, y0+height+1) + v, err := g.SetView(name, x0, y0, maxX, y0+height+1, 0) if err != nil && err != gocui.ErrUnknownView { return nil, err diff --git a/termui/termui.go b/termui/termui.go index 9f68efcc..d11a57ba 100644 --- a/termui/termui.go +++ b/termui/termui.go @@ -5,7 +5,7 @@ import ( "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/input" "github.com/MichaelMure/git-bug/util/git" - "github.com/jroimartin/gocui" + "github.com/jesseduffield/gocui" "github.com/pkg/errors" ) @@ -69,7 +69,7 @@ func Run(cache *cache.RepoCache) error { } func initGui(action func(ui *termUI) error) { - g, err := gocui.NewGui(gocui.OutputNormal) + g, err := gocui.NewGui(gocui.OutputNormal, false) if err != nil { ui.gError <- err -- cgit