1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00

fix merge conflict panel not rendering

This commit is contained in:
Jesse Duffield 2021-04-11 10:05:19 +10:00
parent e092da5f78
commit a9fbc9eda1
4 changed files with 14 additions and 17 deletions

View File

@ -64,7 +64,7 @@ func (gui *Gui) createAllViews() error {
gui.Views.SearchPrefix.BgColor = gocui.ColorDefault
gui.Views.SearchPrefix.FgColor = gocui.ColorGreen
gui.Views.SearchPrefix.Frame = false
gui.setViewContent(gui.Views.SearchPrefix, SEARCH_PREFIX)
gui.setViewContentSync(gui.Views.SearchPrefix, SEARCH_PREFIX)
gui.Views.Stash.Title = gui.Tr.StashTitle
gui.Views.Stash.FgColor = theme.GocuiDefaultTextColor
@ -248,7 +248,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
gui.Views.CommitFiles.Visible = gui.getViewNameForWindow(gui.State.Contexts.CommitFiles.GetWindowName()) == "commitFiles"
if gui.State.OldInformation != informationStr {
gui.setViewContent(gui.Views.Information, informationStr)
gui.setViewContentSync(gui.Views.Information, informationStr)
gui.State.OldInformation = informationStr
}

View File

@ -92,10 +92,7 @@ func (gui *Gui) refreshLineByLinePanel(diff string, secondaryDiff string, second
return false, nil
}
gui.g.Update(func(*gocui.Gui) error {
gui.setViewContent(gui.Views.Secondary, secondaryPatchParser.Render(-1, -1, nil))
return nil
})
gui.setViewContent(gui.Views.Secondary, secondaryPatchParser.Render(-1, -1, nil))
return false, nil
}
@ -228,10 +225,7 @@ func (gui *Gui) refreshMainViewForLineByLine(state *lBlPanelState) error {
gui.Views.Main.Highlight = true
gui.Views.Main.Wrap = false
gui.g.Update(func(*gocui.Gui) error {
gui.setViewContent(gui.Views.Main, colorDiff)
return nil
})
gui.setViewContent(gui.Views.Main, colorDiff)
return nil
}

View File

@ -5,7 +5,6 @@ import (
"strings"
"github.com/fatih/color"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/gui/presentation"
"github.com/jesseduffield/lazygit/pkg/utils"
@ -42,10 +41,7 @@ func (gui *Gui) refreshStatus() {
repoName := utils.GetCurrentRepoName()
status += fmt.Sprintf("%s → %s ", repoName, name)
gui.g.Update(func(*gocui.Gui) error {
gui.setViewContent(gui.Views.Status, status)
return nil
})
gui.setViewContent(gui.Views.Status, status)
}
func runeCount(str string) int {

View File

@ -201,11 +201,18 @@ func (gui *Gui) cleanString(s string) string {
return utils.NormalizeLinefeeds(output)
}
func (gui *Gui) setViewContent(v *gocui.View, s string) {
func (gui *Gui) setViewContentSync(v *gocui.View, s string) {
v.Clear()
fmt.Fprint(v, gui.cleanString(s))
}
func (gui *Gui) setViewContent(v *gocui.View, s string) {
gui.g.Update(func(*gocui.Gui) error {
gui.setViewContentSync(v, s)
return nil
})
}
// renderString resets the origin of a view and sets its content
func (gui *Gui) renderString(view *gocui.View, s string) {
gui.g.Update(func(*gocui.Gui) error {
@ -220,7 +227,7 @@ func (gui *Gui) renderStringSync(view *gocui.View, s string) error {
if err := view.SetCursor(0, 0); err != nil {
return err
}
gui.setViewContent(view, s)
gui.setViewContentSync(view, s)
return nil
}