diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-01 12:30:48 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-03-04 00:12:23 +1100 |
commit | 355f1615aba5b0b75485596fee0ae93d054081d4 (patch) | |
tree | 81a932f5ec7ae0bed07d114e7d8bf37cdaf6a08a /pkg/gui/gui.go | |
parent | 113252b0ae3cb4d9f978398a6292b7f4737034ff (diff) |
supporing custom pagers step 1
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 70c3c3f51..9289c4e31 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -211,6 +211,9 @@ type guiState struct { Searching searchingState ScreenMode int SideView *gocui.View + Ptmx *os.File + PrevMainWidth int + PrevMainHeight int } // for now the split view will always be on @@ -247,6 +250,7 @@ func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *comma }, ScreenMode: SCREEN_NORMAL, SideView: nil, + Ptmx: nil, } gui := &Gui{ @@ -811,6 +815,15 @@ func (gui *Gui) layout(g *gocui.Gui) error { } } + mainViewWidth, mainViewHeight := gui.getMainView().Size() + if mainViewWidth != gui.State.PrevMainWidth || mainViewHeight != gui.State.PrevMainHeight { + gui.State.PrevMainWidth = mainViewWidth + gui.State.PrevMainHeight = mainViewHeight + if err := gui.onResize(); err != nil { + return err + } + } + // here is a good place log some stuff // if you download humanlog and do tail -f development.log | humanlog // this will let you see these branches as prettified json @@ -942,7 +955,7 @@ func (gui *Gui) startBackgroundFetch() { // Run setup the gui with keybindings and start the mainloop func (gui *Gui) Run() error { - g, err := gocui.NewGui(gocui.OutputNormal, OverlappingEdges) + g, err := gocui.NewGui(gocui.Output256, OverlappingEdges) if err != nil { return err } |