diff options
Diffstat (limited to 'pkg/gui/merge_panel.go')
-rw-r--r-- | pkg/gui/merge_panel.go | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/pkg/gui/merge_panel.go b/pkg/gui/merge_panel.go index 7d2e8fc52..a2346db6e 100644 --- a/pkg/gui/merge_panel.go +++ b/pkg/gui/merge_panel.go @@ -222,19 +222,39 @@ func (gui *Gui) refreshMergePanel() error { return err } - mainView := gui.getMainView() - mainView.Wrap = false - if err := gui.newStringTask("main", content); err != nil { + if err := gui.scrollToConflict(gui.g); err != nil { return err } - if err := gui.scrollToConflict(gui.g); err != nil { + mainView := gui.getMainView() + mainView.Wrap = false + + if err := gui.newStringTaskWithoutScroll("main", content); err != nil { return err } return nil } +func (gui *Gui) catSelectedFile(g *gocui.Gui) (string, error) { + item, err := gui.getSelectedFile() + if err != nil { + if err != gui.Errors.ErrNoFiles { + return "", err + } + return "", gui.newStringTask("main", gui.Tr.SLocalize("NoFilesDisplay")) + } + if item.Type != "file" { + return "", gui.newStringTask("main", gui.Tr.SLocalize("NotAFile")) + } + cat, err := gui.GitCommand.CatFile(item.Name) + if err != nil { + gui.Log.Error(err) + return "", gui.newStringTask("main", err.Error()) + } + return cat, nil +} + func (gui *Gui) scrollToConflict(g *gocui.Gui) error { panelState := gui.State.Panels.Merging if len(panelState.Conflicts) == 0 { |