diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-19 18:41:57 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | 2f5d5034dbe4523c44faa58ba6f30c2fef06c128 (patch) | |
tree | bce2590230ef9bc560da11f376c4187c9db0067a /pkg/gui/files_panel.go | |
parent | a32947e7a777cb1f1bc16ea9693bd3d01519ea4b (diff) |
good progress
Diffstat (limited to 'pkg/gui/files_panel.go')
-rw-r--r-- | pkg/gui/files_panel.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index b116271db..b3b9b8b70 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -102,8 +102,9 @@ func (gui *Gui) refreshFiles() error { } gui.g.Update(func(g *gocui.Gui) error { - displayStrings := presentation.GetFileListDisplayStrings(gui.State.Files, gui.State.Diff.Ref) - gui.renderDisplayStrings(filesView, displayStrings) + if err := gui.renderFiles(); err != nil { + return err + } if g.CurrentView() == filesView || (g.CurrentView() == gui.getMainView() && g.CurrentView().Context == "merging") { newSelectedFile := gui.getSelectedFile() @@ -116,6 +117,18 @@ func (gui *Gui) refreshFiles() error { return nil } +func (gui *Gui) renderFiles() error { + filesView := gui.getFilesView() + if filesView == nil { + // if the filesView hasn't been instantiated yet we just return + return nil + } + + displayStrings := presentation.GetFileListDisplayStrings(gui.State.Files, gui.State.Diff.Ref) + gui.renderDisplayStrings(filesView, displayStrings) + return nil +} + // specific functions func (gui *Gui) stagedFiles() []*commands.File { |