1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00

more standardisation

This commit is contained in:
Jesse Duffield 2020-08-18 22:41:14 +10:00
parent 6c270b6e26
commit 9c866fd49c
2 changed files with 7 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import (
"strings" "strings"
"github.com/fatih/color" "github.com/fatih/color"
"github.com/go-errors/errors"
"github.com/golang-collections/collections/stack" "github.com/golang-collections/collections/stack"
"github.com/jesseduffield/gocui" "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands"
@ -255,17 +256,17 @@ func (gui *Gui) refreshMergePanel() error {
func (gui *Gui) catSelectedFile(g *gocui.Gui) (string, error) { func (gui *Gui) catSelectedFile(g *gocui.Gui) (string, error) {
item := gui.getSelectedFile() item := gui.getSelectedFile()
if item == nil { if item == nil {
return "", gui.newStringTask("main", gui.Tr.SLocalize("NoFilesDisplay")) return "", errors.New(gui.Tr.SLocalize("NoFilesDisplay"))
} }
if item.Type != "file" { if item.Type != "file" {
return "", gui.newStringTask("main", gui.Tr.SLocalize("NotAFile")) return "", errors.New(gui.Tr.SLocalize("NotAFile"))
} }
cat, err := gui.GitCommand.CatFile(item.Name) cat, err := gui.GitCommand.CatFile(item.Name)
if err != nil { if err != nil {
gui.Log.Error(err) gui.Log.Error(err)
return "", gui.newStringTask("main", err.Error()) return "", err
} }
return cat, nil return cat, nil
} }

View File

@ -266,6 +266,9 @@ func (gui *Gui) currentViewName() string {
func (gui *Gui) resizeCurrentPopupPanel() error { func (gui *Gui) resizeCurrentPopupPanel() error {
v := gui.g.CurrentView() v := gui.g.CurrentView()
if v == nil {
return nil
}
if gui.isPopupPanel(v.Name()) { if gui.isPopupPanel(v.Name()) {
return gui.resizePopupPanel(v) return gui.resizePopupPanel(v)
} }