mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-10 22:42:00 +02:00
Merge pull request #1927 from HiromasaNojima/option_always_show_unstaged_staged_panels
This commit is contained in:
@@ -54,6 +54,7 @@ gui:
|
|||||||
showCommandLog: true
|
showCommandLog: true
|
||||||
showIcons: false
|
showIcons: false
|
||||||
commandLogSize: 8
|
commandLogSize: 8
|
||||||
|
splitDiff: 'auto' # one of 'auto' | 'always'
|
||||||
git:
|
git:
|
||||||
paging:
|
paging:
|
||||||
colorArg: always
|
colorArg: always
|
||||||
|
@@ -46,6 +46,7 @@ type GuiConfig struct {
|
|||||||
ShowBottomLine bool `yaml:"showBottomLine"`
|
ShowBottomLine bool `yaml:"showBottomLine"`
|
||||||
ShowIcons bool `yaml:"showIcons"`
|
ShowIcons bool `yaml:"showIcons"`
|
||||||
CommandLogSize int `yaml:"commandLogSize"`
|
CommandLogSize int `yaml:"commandLogSize"`
|
||||||
|
SplitDiff string `yaml:"splitDiff"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ThemeConfig struct {
|
type ThemeConfig struct {
|
||||||
@@ -360,6 +361,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
ShowRandomTip: true,
|
ShowRandomTip: true,
|
||||||
ShowIcons: false,
|
ShowIcons: false,
|
||||||
CommandLogSize: 8,
|
CommandLogSize: 8,
|
||||||
|
SplitDiff: "auto",
|
||||||
},
|
},
|
||||||
Git: GitConfig{
|
Git: GitConfig{
|
||||||
Paging: PagingConfig{
|
Paging: PagingConfig{
|
||||||
|
@@ -53,21 +53,25 @@ func (gui *Gui) filesRenderToMain() error {
|
|||||||
|
|
||||||
gui.resetMergeStateWithLock()
|
gui.resetMergeStateWithLock()
|
||||||
|
|
||||||
cmdObj := gui.git.WorkingTree.WorktreeFileDiffCmdObj(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.IgnoreWhitespaceInDiffView)
|
|
||||||
|
|
||||||
mainContext := gui.State.Contexts.Normal
|
mainContext := gui.State.Contexts.Normal
|
||||||
if node.File != nil {
|
if node.File != nil {
|
||||||
mainContext = gui.State.Contexts.Staging
|
mainContext = gui.State.Contexts.Staging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
split := gui.c.UserConfig.Gui.SplitDiff == "always" || (node.GetHasUnstagedChanges() && node.GetHasStagedChanges())
|
||||||
|
mainShowsStaged := !split && node.GetHasStagedChanges()
|
||||||
|
|
||||||
|
cmdObj := gui.git.WorkingTree.WorktreeFileDiffCmdObj(node, false, mainShowsStaged, gui.IgnoreWhitespaceInDiffView)
|
||||||
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
|
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
|
||||||
title: gui.c.Tr.UnstagedChanges,
|
title: gui.c.Tr.UnstagedChanges,
|
||||||
task: NewRunPtyTask(cmdObj.GetCmd()),
|
task: NewRunPtyTask(cmdObj.GetCmd()),
|
||||||
context: mainContext,
|
context: mainContext,
|
||||||
}}
|
}}
|
||||||
|
if mainShowsStaged {
|
||||||
|
refreshOpts.main.title = gui.c.Tr.StagedChanges
|
||||||
|
}
|
||||||
|
|
||||||
if node.GetHasUnstagedChanges() {
|
if split {
|
||||||
if node.GetHasStagedChanges() {
|
|
||||||
cmdObj := gui.git.WorkingTree.WorktreeFileDiffCmdObj(node, false, true, gui.IgnoreWhitespaceInDiffView)
|
cmdObj := gui.git.WorkingTree.WorktreeFileDiffCmdObj(node, false, true, gui.IgnoreWhitespaceInDiffView)
|
||||||
|
|
||||||
refreshOpts.secondary = &viewUpdateOpts{
|
refreshOpts.secondary = &viewUpdateOpts{
|
||||||
@@ -76,9 +80,6 @@ func (gui *Gui) filesRenderToMain() error {
|
|||||||
context: mainContext,
|
context: mainContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
refreshOpts.main.title = gui.c.Tr.StagedChanges
|
|
||||||
}
|
|
||||||
|
|
||||||
return gui.refreshMainViews(refreshOpts)
|
return gui.refreshMainViews(refreshOpts)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user