mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +02:00
align Gui struct with GitCommand
This commit is contained in:
parent
03b946cc8f
commit
01ea5813a8
@ -41,8 +41,6 @@ type AppConfigurer interface {
|
|||||||
GetUserConfigDir() string
|
GetUserConfigDir() string
|
||||||
GetAppState() *AppState
|
GetAppState() *AppState
|
||||||
SaveAppState() error
|
SaveAppState() error
|
||||||
SetIsNewRepo(bool)
|
|
||||||
GetIsNewRepo() bool
|
|
||||||
ReloadUserConfig() error
|
ReloadUserConfig() error
|
||||||
ShowCommandLogOnStartup() bool
|
ShowCommandLogOnStartup() bool
|
||||||
}
|
}
|
||||||
@ -166,37 +164,22 @@ func loadUserConfig(configFiles []string, base *UserConfig) (*UserConfig, error)
|
|||||||
return base, nil
|
return base, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIsNewRepo returns known repo boolean
|
|
||||||
func (c *AppConfig) GetIsNewRepo() bool {
|
|
||||||
return c.IsNewRepo
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetIsNewRepo set if the current repo is known
|
|
||||||
func (c *AppConfig) SetIsNewRepo(toSet bool) {
|
|
||||||
c.IsNewRepo = toSet
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetDebug returns debug flag
|
|
||||||
func (c *AppConfig) GetDebug() bool {
|
func (c *AppConfig) GetDebug() bool {
|
||||||
return c.Debug
|
return c.Debug
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetVersion returns debug flag
|
|
||||||
func (c *AppConfig) GetVersion() string {
|
func (c *AppConfig) GetVersion() string {
|
||||||
return c.Version
|
return c.Version
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCommit returns debug flag
|
|
||||||
func (c *AppConfig) GetCommit() string {
|
func (c *AppConfig) GetCommit() string {
|
||||||
return c.Commit
|
return c.Commit
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBuildDate returns debug flag
|
|
||||||
func (c *AppConfig) GetBuildDate() string {
|
func (c *AppConfig) GetBuildDate() string {
|
||||||
return c.BuildDate
|
return c.BuildDate
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetName returns debug flag
|
|
||||||
func (c *AppConfig) GetName() string {
|
func (c *AppConfig) GetName() string {
|
||||||
return c.Name
|
return c.Name
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ func (gui *Gui) getMidSectionWeights() (int, int) {
|
|||||||
currentWindow := gui.currentWindow()
|
currentWindow := gui.currentWindow()
|
||||||
|
|
||||||
// we originally specified this as a ratio i.e. .20 would correspond to a weight of 1 against 4
|
// we originally specified this as a ratio i.e. .20 would correspond to a weight of 1 against 4
|
||||||
sidePanelWidthRatio := gui.Config.GetUserConfig().Gui.SidePanelWidth
|
sidePanelWidthRatio := gui.UserConfig.Gui.SidePanelWidth
|
||||||
// we could make this better by creating ratios like 2:3 rather than always 1:something
|
// we could make this better by creating ratios like 2:3 rather than always 1:something
|
||||||
mainSectionWeight := int(1/sidePanelWidthRatio) - 1
|
mainSectionWeight := int(1/sidePanelWidthRatio) - 1
|
||||||
sideSectionWeight := 1
|
sideSectionWeight := 1
|
||||||
@ -115,7 +115,7 @@ func (gui *Gui) splitMainPanelSideBySide() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
mainPanelSplitMode := gui.Config.GetUserConfig().Gui.MainPanelSplitMode
|
mainPanelSplitMode := gui.UserConfig.Gui.MainPanelSplitMode
|
||||||
width, height := gui.g.Size()
|
width, height := gui.g.Size()
|
||||||
|
|
||||||
switch mainPanelSplitMode {
|
switch mainPanelSplitMode {
|
||||||
@ -143,7 +143,7 @@ func (gui *Gui) getExtrasWindowSize(screenHeight int) int {
|
|||||||
} else if screenHeight < 40 {
|
} else if screenHeight < 40 {
|
||||||
baseSize = 1
|
baseSize = 1
|
||||||
} else {
|
} else {
|
||||||
baseSize = gui.Config.GetUserConfig().Gui.CommandLogSize
|
baseSize = gui.UserConfig.Gui.CommandLogSize
|
||||||
}
|
}
|
||||||
|
|
||||||
frameSize := 2
|
frameSize := 2
|
||||||
@ -259,7 +259,7 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box {
|
|||||||
fullHeightBox("stash"),
|
fullHeightBox("stash"),
|
||||||
}
|
}
|
||||||
} else if height >= 28 {
|
} else if height >= 28 {
|
||||||
accordionMode := gui.Config.GetUserConfig().Gui.ExpandFocusedSidePanel
|
accordionMode := gui.UserConfig.Gui.ExpandFocusedSidePanel
|
||||||
accordionBox := func(defaultBox *boxlayout.Box) *boxlayout.Box {
|
accordionBox := func(defaultBox *boxlayout.Box) *boxlayout.Box {
|
||||||
if accordionMode && defaultBox.Window == currentWindow {
|
if accordionMode && defaultBox.Window == currentWindow {
|
||||||
return &boxlayout.Box{
|
return &boxlayout.Box{
|
||||||
|
@ -41,11 +41,11 @@ func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry) {
|
|||||||
func (gui *Gui) printCommandLogHeader() {
|
func (gui *Gui) printCommandLogHeader() {
|
||||||
introStr := fmt.Sprintf(
|
introStr := fmt.Sprintf(
|
||||||
gui.Tr.CommandLogHeader,
|
gui.Tr.CommandLogHeader,
|
||||||
gui.getKeyDisplay(gui.Config.GetUserConfig().Keybinding.Universal.ExtrasMenu),
|
gui.getKeyDisplay(gui.UserConfig.Keybinding.Universal.ExtrasMenu),
|
||||||
)
|
)
|
||||||
fmt.Fprintln(gui.Views.Extras, style.FgCyan.Sprint(introStr))
|
fmt.Fprintln(gui.Views.Extras, style.FgCyan.Sprint(introStr))
|
||||||
|
|
||||||
if gui.Config.GetUserConfig().Gui.ShowRandomTip {
|
if gui.UserConfig.Gui.ShowRandomTip {
|
||||||
fmt.Fprintf(
|
fmt.Fprintf(
|
||||||
gui.Views.Extras,
|
gui.Views.Extras,
|
||||||
"%s: %s",
|
"%s: %s",
|
||||||
@ -56,7 +56,7 @@ func (gui *Gui) printCommandLogHeader() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) getRandomTip() string {
|
func (gui *Gui) getRandomTip() string {
|
||||||
config := gui.Config.GetUserConfig().Keybinding
|
config := gui.UserConfig.Keybinding
|
||||||
|
|
||||||
formattedKey := func(key string) string {
|
formattedKey := func(key string) string {
|
||||||
return gui.getKeyDisplay(key)
|
return gui.getKeyDisplay(key)
|
||||||
|
@ -15,12 +15,12 @@ func (gui *Gui) handleCommitConfirm() error {
|
|||||||
return gui.createErrorPanel(gui.Tr.CommitWithoutMessageErr)
|
return gui.createErrorPanel(gui.Tr.CommitWithoutMessageErr)
|
||||||
}
|
}
|
||||||
flags := []string{}
|
flags := []string{}
|
||||||
skipHookPrefix := gui.Config.GetUserConfig().Git.SkipHookPrefix
|
skipHookPrefix := gui.UserConfig.Git.SkipHookPrefix
|
||||||
if skipHookPrefix != "" && strings.HasPrefix(message, skipHookPrefix) {
|
if skipHookPrefix != "" && strings.HasPrefix(message, skipHookPrefix) {
|
||||||
flags = append(flags, "--no-verify")
|
flags = append(flags, "--no-verify")
|
||||||
}
|
}
|
||||||
|
|
||||||
if gui.Config.GetUserConfig().Git.Commit.SignOff {
|
if gui.UserConfig.Git.Commit.SignOff {
|
||||||
flags = append(flags, "--signoff")
|
flags = append(flags, "--signoff")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@ func (gui *Gui) handleCommitMessageFocused() error {
|
|||||||
message := utils.ResolvePlaceholderString(
|
message := utils.ResolvePlaceholderString(
|
||||||
gui.Tr.CommitMessageConfirm,
|
gui.Tr.CommitMessageConfirm,
|
||||||
map[string]string{
|
map[string]string{
|
||||||
"keyBindClose": gui.getKeyDisplay(gui.Config.GetUserConfig().Keybinding.Universal.Return),
|
"keyBindClose": gui.getKeyDisplay(gui.UserConfig.Keybinding.Universal.Return),
|
||||||
"keyBindConfirm": gui.getKeyDisplay(gui.Config.GetUserConfig().Keybinding.Universal.Confirm),
|
"keyBindConfirm": gui.getKeyDisplay(gui.UserConfig.Keybinding.Universal.Confirm),
|
||||||
"keyBindNewLine": gui.getKeyDisplay(gui.Config.GetUserConfig().Keybinding.Universal.AppendNewline),
|
"keyBindNewLine": gui.getKeyDisplay(gui.UserConfig.Keybinding.Universal.AppendNewline),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ func (gui *Gui) getBufferLength(view *gocui.View) string {
|
|||||||
|
|
||||||
// RenderCommitLength is a function.
|
// RenderCommitLength is a function.
|
||||||
func (gui *Gui) RenderCommitLength() {
|
func (gui *Gui) RenderCommitLength() {
|
||||||
if !gui.Config.GetUserConfig().Gui.CommitLength.Show {
|
if !gui.UserConfig.Gui.CommitLength.Show {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,7 +733,7 @@ func (gui *Gui) handleOpenLogMenu() error {
|
|||||||
opensMenu: true,
|
opensMenu: true,
|
||||||
onPress: func() error {
|
onPress: func() error {
|
||||||
onSelect := func(value string) {
|
onSelect := func(value string) {
|
||||||
gui.Config.GetUserConfig().Git.Log.ShowGraph = value
|
gui.UserConfig.Git.Log.ShowGraph = value
|
||||||
gui.render()
|
gui.render()
|
||||||
}
|
}
|
||||||
return gui.createMenu(gui.Tr.LogMenuTitle, []*menuItem{
|
return gui.createMenu(gui.Tr.LogMenuTitle, []*menuItem{
|
||||||
@ -766,7 +766,7 @@ func (gui *Gui) handleOpenLogMenu() error {
|
|||||||
opensMenu: true,
|
opensMenu: true,
|
||||||
onPress: func() error {
|
onPress: func() error {
|
||||||
onSelect := func(value string) error {
|
onSelect := func(value string) error {
|
||||||
gui.Config.GetUserConfig().Git.Log.Order = value
|
gui.UserConfig.Git.Log.Order = value
|
||||||
return gui.WithWaitingStatus(gui.Tr.LcLoadingCommits, func() error {
|
return gui.WithWaitingStatus(gui.Tr.LcLoadingCommits, func() error {
|
||||||
return gui.refreshSidePanels(refreshOptions{mode: SYNC, scope: []RefreshableView{COMMITS}})
|
return gui.refreshSidePanels(refreshOptions{mode: SYNC, scope: []RefreshableView{COMMITS}})
|
||||||
})
|
})
|
||||||
|
@ -173,7 +173,7 @@ func (gui *Gui) prepareConfirmationPanel(
|
|||||||
suggestionsView.FgColor = theme.GocuiDefaultTextColor
|
suggestionsView.FgColor = theme.GocuiDefaultTextColor
|
||||||
gui.setSuggestions(findSuggestionsFunc(""))
|
gui.setSuggestions(findSuggestionsFunc(""))
|
||||||
suggestionsView.Visible = true
|
suggestionsView.Visible = true
|
||||||
suggestionsView.Title = fmt.Sprintf(gui.Tr.SuggestionsTitle, gui.Config.GetUserConfig().Keybinding.Universal.TogglePanel)
|
suggestionsView.Title = fmt.Sprintf(gui.Tr.SuggestionsTitle, gui.UserConfig.Keybinding.Universal.TogglePanel)
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.g.Update(func(g *gocui.Gui) error {
|
gui.g.Update(func(g *gocui.Gui) error {
|
||||||
@ -240,7 +240,7 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error {
|
|||||||
handler func() error
|
handler func() error
|
||||||
}
|
}
|
||||||
|
|
||||||
keybindingConfig := gui.Config.GetUserConfig().Keybinding
|
keybindingConfig := gui.UserConfig.Keybinding
|
||||||
onSuggestionConfirm := gui.wrappedPromptConfirmationFunction(
|
onSuggestionConfirm := gui.wrappedPromptConfirmationFunction(
|
||||||
opts.handlersManageFocus,
|
opts.handlersManageFocus,
|
||||||
opts.handleConfirmPrompt,
|
opts.handleConfirmPrompt,
|
||||||
@ -305,7 +305,7 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) clearConfirmationViewKeyBindings() {
|
func (gui *Gui) clearConfirmationViewKeyBindings() {
|
||||||
keybindingConfig := gui.Config.GetUserConfig().Keybinding
|
keybindingConfig := gui.UserConfig.Keybinding
|
||||||
_ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Confirm), gocui.ModNone)
|
_ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Confirm), gocui.ModNone)
|
||||||
_ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone)
|
_ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone)
|
||||||
_ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Return), gocui.ModNone)
|
_ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Return), gocui.ModNone)
|
||||||
|
@ -57,7 +57,7 @@ func (gui *Gui) handleCloseCredentialsView() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleCredentialsViewFocused() error {
|
func (gui *Gui) handleCredentialsViewFocused() error {
|
||||||
keybindingConfig := gui.Config.GetUserConfig().Keybinding
|
keybindingConfig := gui.UserConfig.Keybinding
|
||||||
|
|
||||||
message := utils.ResolvePlaceholderString(
|
message := utils.ResolvePlaceholderString(
|
||||||
gui.Tr.CloseConfirm,
|
gui.Tr.CloseConfirm,
|
||||||
|
@ -296,7 +296,7 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand config.CustomCommand
|
|||||||
|
|
||||||
func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
|
func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
|
||||||
bindings := []*Binding{}
|
bindings := []*Binding{}
|
||||||
customCommands := gui.Config.GetUserConfig().CustomCommands
|
customCommands := gui.UserConfig.CustomCommands
|
||||||
|
|
||||||
for _, customCommand := range customCommands {
|
for _, customCommand := range customCommands {
|
||||||
var viewName string
|
var viewName string
|
||||||
|
@ -16,7 +16,7 @@ func (gui *Gui) IncreaseContextInDiffView() error {
|
|||||||
return gui.surfaceError(err)
|
return gui.surfaceError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = gui.Config.GetUserConfig().Git.DiffContextSize + 1
|
gui.UserConfig.Git.DiffContextSize = gui.UserConfig.Git.DiffContextSize + 1
|
||||||
return gui.currentStaticContext().HandleRenderToMain()
|
return gui.currentStaticContext().HandleRenderToMain()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,14 +24,14 @@ func (gui *Gui) IncreaseContextInDiffView() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) DecreaseContextInDiffView() error {
|
func (gui *Gui) DecreaseContextInDiffView() error {
|
||||||
old_size := gui.Config.GetUserConfig().Git.DiffContextSize
|
old_size := gui.UserConfig.Git.DiffContextSize
|
||||||
|
|
||||||
if isShowingDiff(gui) && old_size > 1 {
|
if isShowingDiff(gui) && old_size > 1 {
|
||||||
if err := gui.CheckCanChangeContext(); err != nil {
|
if err := gui.CheckCanChangeContext(); err != nil {
|
||||||
return gui.surfaceError(err)
|
return gui.surfaceError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = old_size - 1
|
gui.UserConfig.Git.DiffContextSize = old_size - 1
|
||||||
return gui.currentStaticContext().HandleRenderToMain()
|
return gui.currentStaticContext().HandleRenderToMain()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,12 +46,12 @@ func TestIncreasesContextInDiffViewByOneInContextWithDiff(t *testing.T) {
|
|||||||
gui := NewDummyGui()
|
gui := NewDummyGui()
|
||||||
context := c(gui)
|
context := c(gui)
|
||||||
setupGuiForTest(gui)
|
setupGuiForTest(gui)
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = 1
|
gui.UserConfig.Git.DiffContextSize = 1
|
||||||
_ = gui.pushContextDirect(context)
|
_ = gui.pushContextDirect(context)
|
||||||
|
|
||||||
_ = gui.IncreaseContextInDiffView()
|
_ = gui.IncreaseContextInDiffView()
|
||||||
|
|
||||||
assert.Equal(t, 2, gui.Config.GetUserConfig().Git.DiffContextSize, string(context.GetKey()))
|
assert.Equal(t, 2, gui.UserConfig.Git.DiffContextSize, string(context.GetKey()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,12 +72,12 @@ func TestDoesntIncreaseContextInDiffViewInContextWithoutDiff(t *testing.T) {
|
|||||||
gui := NewDummyGui()
|
gui := NewDummyGui()
|
||||||
context := c(gui)
|
context := c(gui)
|
||||||
setupGuiForTest(gui)
|
setupGuiForTest(gui)
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = 1
|
gui.UserConfig.Git.DiffContextSize = 1
|
||||||
_ = gui.pushContextDirect(context)
|
_ = gui.pushContextDirect(context)
|
||||||
|
|
||||||
_ = gui.IncreaseContextInDiffView()
|
_ = gui.IncreaseContextInDiffView()
|
||||||
|
|
||||||
assert.Equal(t, 1, gui.Config.GetUserConfig().Git.DiffContextSize, string(context.GetKey()))
|
assert.Equal(t, 1, gui.UserConfig.Git.DiffContextSize, string(context.GetKey()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,12 +96,12 @@ func TestDecreasesContextInDiffViewByOneInContextWithDiff(t *testing.T) {
|
|||||||
gui := NewDummyGui()
|
gui := NewDummyGui()
|
||||||
context := c(gui)
|
context := c(gui)
|
||||||
setupGuiForTest(gui)
|
setupGuiForTest(gui)
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = 2
|
gui.UserConfig.Git.DiffContextSize = 2
|
||||||
_ = gui.pushContextDirect(context)
|
_ = gui.pushContextDirect(context)
|
||||||
|
|
||||||
_ = gui.DecreaseContextInDiffView()
|
_ = gui.DecreaseContextInDiffView()
|
||||||
|
|
||||||
assert.Equal(t, 1, gui.Config.GetUserConfig().Git.DiffContextSize, string(context.GetKey()))
|
assert.Equal(t, 1, gui.UserConfig.Git.DiffContextSize, string(context.GetKey()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,19 +122,19 @@ func TestDoesntDecreaseContextInDiffViewInContextWithoutDiff(t *testing.T) {
|
|||||||
gui := NewDummyGui()
|
gui := NewDummyGui()
|
||||||
context := c(gui)
|
context := c(gui)
|
||||||
setupGuiForTest(gui)
|
setupGuiForTest(gui)
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = 2
|
gui.UserConfig.Git.DiffContextSize = 2
|
||||||
_ = gui.pushContextDirect(context)
|
_ = gui.pushContextDirect(context)
|
||||||
|
|
||||||
_ = gui.DecreaseContextInDiffView()
|
_ = gui.DecreaseContextInDiffView()
|
||||||
|
|
||||||
assert.Equal(t, 2, gui.Config.GetUserConfig().Git.DiffContextSize, string(context.GetKey()))
|
assert.Equal(t, 2, gui.UserConfig.Git.DiffContextSize, string(context.GetKey()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDoesntIncreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *testing.T) {
|
func TestDoesntIncreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *testing.T) {
|
||||||
gui := NewDummyGui()
|
gui := NewDummyGui()
|
||||||
setupGuiForTest(gui)
|
setupGuiForTest(gui)
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = 2
|
gui.UserConfig.Git.DiffContextSize = 2
|
||||||
_ = gui.pushContextDirect(gui.State.Contexts.CommitFiles)
|
_ = gui.pushContextDirect(gui.State.Contexts.CommitFiles)
|
||||||
gui.GitCommand.PatchManager.Start("from", "to", false, false)
|
gui.GitCommand.PatchManager.Start("from", "to", false, false)
|
||||||
|
|
||||||
@ -150,13 +150,13 @@ func TestDoesntIncreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *test
|
|||||||
_ = gui.IncreaseContextInDiffView()
|
_ = gui.IncreaseContextInDiffView()
|
||||||
|
|
||||||
assert.Equal(t, 1, errorCount)
|
assert.Equal(t, 1, errorCount)
|
||||||
assert.Equal(t, 2, gui.Config.GetUserConfig().Git.DiffContextSize)
|
assert.Equal(t, 2, gui.UserConfig.Git.DiffContextSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDoesntDecreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *testing.T) {
|
func TestDoesntDecreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *testing.T) {
|
||||||
gui := NewDummyGui()
|
gui := NewDummyGui()
|
||||||
setupGuiForTest(gui)
|
setupGuiForTest(gui)
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = 2
|
gui.UserConfig.Git.DiffContextSize = 2
|
||||||
_ = gui.pushContextDirect(gui.State.Contexts.CommitFiles)
|
_ = gui.pushContextDirect(gui.State.Contexts.CommitFiles)
|
||||||
gui.GitCommand.PatchManager.Start("from", "to", false, false)
|
gui.GitCommand.PatchManager.Start("from", "to", false, false)
|
||||||
|
|
||||||
@ -171,15 +171,15 @@ func TestDoesntDecreaseContextInDiffViewInContextWhenInPatchBuildingMode(t *test
|
|||||||
|
|
||||||
_ = gui.DecreaseContextInDiffView()
|
_ = gui.DecreaseContextInDiffView()
|
||||||
|
|
||||||
assert.Equal(t, 2, gui.Config.GetUserConfig().Git.DiffContextSize)
|
assert.Equal(t, 2, gui.UserConfig.Git.DiffContextSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDecreasesContextInDiffViewNoFurtherThanOne(t *testing.T) {
|
func TestDecreasesContextInDiffViewNoFurtherThanOne(t *testing.T) {
|
||||||
gui := NewDummyGui()
|
gui := NewDummyGui()
|
||||||
setupGuiForTest(gui)
|
setupGuiForTest(gui)
|
||||||
gui.Config.GetUserConfig().Git.DiffContextSize = 1
|
gui.UserConfig.Git.DiffContextSize = 1
|
||||||
|
|
||||||
_ = gui.DecreaseContextInDiffView()
|
_ = gui.DecreaseContextInDiffView()
|
||||||
|
|
||||||
assert.Equal(t, 1, gui.Config.GetUserConfig().Git.DiffContextSize)
|
assert.Equal(t, 1, gui.UserConfig.Git.DiffContextSize)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch rune, mod gocui.Modifier, allowMultiline bool) bool {
|
func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch rune, mod gocui.Modifier, allowMultiline bool) bool {
|
||||||
newlineKey, ok := gui.getKey(gui.Config.GetUserConfig().Keybinding.Universal.AppendNewline).(gocui.Key)
|
newlineKey, ok := gui.getKey(gui.UserConfig.Keybinding.Universal.AppendNewline).(gocui.Key)
|
||||||
if !ok {
|
if !ok {
|
||||||
newlineKey = gocui.KeyAltEnter
|
newlineKey = gocui.KeyAltEnter
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ func (gui *Gui) handleIgnoreFile() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleWIPCommitPress() error {
|
func (gui *Gui) handleWIPCommitPress() error {
|
||||||
skipHookPrefix := gui.Config.GetUserConfig().Git.SkipHookPrefix
|
skipHookPrefix := gui.UserConfig.Git.SkipHookPrefix
|
||||||
if skipHookPrefix == "" {
|
if skipHookPrefix == "" {
|
||||||
return gui.createErrorPanel(gui.Tr.SkipHookPrefixNotConfigured)
|
return gui.createErrorPanel(gui.Tr.SkipHookPrefixNotConfigured)
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ func (gui *Gui) handleWIPCommitPress() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) commitPrefixConfigForRepo() *config.CommitPrefixConfig {
|
func (gui *Gui) commitPrefixConfigForRepo() *config.CommitPrefixConfig {
|
||||||
cfg, ok := gui.Config.GetUserConfig().Git.CommitPrefixes[utils.GetCurrentRepoName()]
|
cfg, ok := gui.UserConfig.Git.CommitPrefixes[utils.GetCurrentRepoName()]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -354,7 +354,7 @@ func (gui *Gui) commitPrefixConfigForRepo() *config.CommitPrefixConfig {
|
|||||||
|
|
||||||
func (gui *Gui) prepareFilesForCommit() error {
|
func (gui *Gui) prepareFilesForCommit() error {
|
||||||
noStagedFiles := len(gui.stagedFiles()) == 0
|
noStagedFiles := len(gui.stagedFiles()) == 0
|
||||||
if noStagedFiles && gui.Config.GetUserConfig().Gui.SkipNoStagedFilesWarning {
|
if noStagedFiles && gui.UserConfig.Gui.SkipNoStagedFilesWarning {
|
||||||
err := gui.GitCommand.WithSpan(gui.Tr.Spans.StageAllFiles).StageAll()
|
err := gui.GitCommand.WithSpan(gui.Tr.Spans.StageAllFiles).StageAll()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -458,7 +458,7 @@ func (gui *Gui) handleCommitEditorPress() error {
|
|||||||
|
|
||||||
args := []string{"commit"}
|
args := []string{"commit"}
|
||||||
|
|
||||||
if gui.Config.GetUserConfig().Git.Commit.SignOff {
|
if gui.UserConfig.Git.Commit.SignOff {
|
||||||
args = append(args, "--signoff")
|
args = append(args, "--signoff")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ func (gui *Gui) push(opts pushOpts) error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err != nil && !opts.force && strings.Contains(err.Error(), "Updates were rejected") {
|
if err != nil && !opts.force && strings.Contains(err.Error(), "Updates were rejected") {
|
||||||
forcePushDisabled := gui.Config.GetUserConfig().Git.DisableForcePushing
|
forcePushDisabled := gui.UserConfig.Git.DisableForcePushing
|
||||||
if forcePushDisabled {
|
if forcePushDisabled {
|
||||||
_ = gui.createErrorPanel(gui.Tr.UpdatesRejectedAndForcePushDisabled)
|
_ = gui.createErrorPanel(gui.Tr.UpdatesRejectedAndForcePushDisabled)
|
||||||
return
|
return
|
||||||
@ -846,7 +846,7 @@ func getSuggestedRemote(remotes []*models.Remote) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) requestToForcePush() error {
|
func (gui *Gui) requestToForcePush() error {
|
||||||
forcePushDisabled := gui.Config.GetUserConfig().Git.DisableForcePushing
|
forcePushDisabled := gui.UserConfig.Git.DisableForcePushing
|
||||||
if forcePushDisabled {
|
if forcePushDisabled {
|
||||||
return gui.createErrorPanel(gui.Tr.ForcePushDisabled)
|
return gui.createErrorPanel(gui.Tr.ForcePushDisabled)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ func (gui *Gui) prevScreenMode() error {
|
|||||||
|
|
||||||
func (gui *Gui) scrollUpView(view *gocui.View) error {
|
func (gui *Gui) scrollUpView(view *gocui.View) error {
|
||||||
ox, oy := view.Origin()
|
ox, oy := view.Origin()
|
||||||
newOy := int(math.Max(0, float64(oy-gui.Config.GetUserConfig().Gui.ScrollHeight)))
|
newOy := int(math.Max(0, float64(oy-gui.UserConfig.Gui.ScrollHeight)))
|
||||||
return view.SetOrigin(ox, newOy)
|
return view.SetOrigin(ox, newOy)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,12 +86,12 @@ func (gui *Gui) scrollDownView(view *gocui.View) error {
|
|||||||
func (gui *Gui) linesToScrollDown(view *gocui.View) int {
|
func (gui *Gui) linesToScrollDown(view *gocui.View) int {
|
||||||
_, oy := view.Origin()
|
_, oy := view.Origin()
|
||||||
y := oy
|
y := oy
|
||||||
canScrollPastBottom := gui.Config.GetUserConfig().Gui.ScrollPastBottom
|
canScrollPastBottom := gui.UserConfig.Gui.ScrollPastBottom
|
||||||
if !canScrollPastBottom {
|
if !canScrollPastBottom {
|
||||||
_, sy := view.Size()
|
_, sy := view.Size()
|
||||||
y += sy
|
y += sy
|
||||||
}
|
}
|
||||||
scrollHeight := gui.Config.GetUserConfig().Gui.ScrollHeight
|
scrollHeight := gui.UserConfig.Gui.ScrollHeight
|
||||||
scrollableLines := view.ViewLinesHeight() - y
|
scrollableLines := view.ViewLinesHeight() - y
|
||||||
if scrollableLines < 0 {
|
if scrollableLines < 0 {
|
||||||
return 0
|
return 0
|
||||||
|
@ -47,7 +47,7 @@ func (gui *Gui) RunAndStream(cmdObj oscommands.ICmdObj, waitingStatus string, on
|
|||||||
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
_ = gui.refreshSidePanels(refreshOptions{mode: ASYNC})
|
||||||
return gui.surfaceError(
|
return gui.surfaceError(
|
||||||
fmt.Errorf(
|
fmt.Errorf(
|
||||||
gui.Tr.GitCommandFailed, gui.Config.GetUserConfig().Keybinding.Universal.ExtrasMenu,
|
gui.Tr.GitCommandFailed, gui.UserConfig.Keybinding.Universal.ExtrasMenu,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,8 @@ type Gui struct {
|
|||||||
suggestionsAsyncHandler *tasks.AsyncHandler
|
suggestionsAsyncHandler *tasks.AsyncHandler
|
||||||
|
|
||||||
PopupHandler PopupHandler
|
PopupHandler PopupHandler
|
||||||
|
|
||||||
|
IsNewRepo bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type listPanelState struct {
|
type listPanelState struct {
|
||||||
@ -371,7 +373,7 @@ func (gui *Gui) resetState(filterPath string, reuseState bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showTree := gui.Config.GetUserConfig().Gui.ShowFileTree
|
showTree := gui.UserConfig.Gui.ShowFileTree
|
||||||
|
|
||||||
contexts := gui.contextTree()
|
contexts := gui.contextTree()
|
||||||
|
|
||||||
@ -455,7 +457,7 @@ func NewGui(cmn *common.Common, gitCommand *commands.GitCommand, oSCommand *osco
|
|||||||
gui.OnRunCommand = onRunCommand
|
gui.OnRunCommand = onRunCommand
|
||||||
gui.PopupHandler = &RealPopupHandler{gui: gui}
|
gui.PopupHandler = &RealPopupHandler{gui: gui}
|
||||||
|
|
||||||
authors.SetCustomAuthors(gui.Config.GetUserConfig().Gui.AuthorColors)
|
authors.SetCustomAuthors(gui.UserConfig.Gui.AuthorColors)
|
||||||
|
|
||||||
return gui, nil
|
return gui, nil
|
||||||
}
|
}
|
||||||
@ -505,7 +507,7 @@ func (gui *Gui) Run() error {
|
|||||||
if err := gui.Config.ReloadUserConfig(); err != nil {
|
if err := gui.Config.ReloadUserConfig(); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
userConfig := gui.Config.GetUserConfig()
|
userConfig := gui.UserConfig
|
||||||
g.SearchEscapeKey = gui.getKey(userConfig.Keybinding.Universal.Return)
|
g.SearchEscapeKey = gui.getKey(userConfig.Keybinding.Universal.Return)
|
||||||
g.NextSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.NextMatch)
|
g.NextSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.NextMatch)
|
||||||
g.PrevSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.PrevMatch)
|
g.PrevSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.PrevMatch)
|
||||||
@ -521,7 +523,7 @@ func (gui *Gui) Run() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gui.waitForIntro.Add(1)
|
gui.waitForIntro.Add(1)
|
||||||
if gui.Config.GetUserConfig().Git.AutoFetch {
|
if gui.UserConfig.Git.AutoFetch {
|
||||||
go utils.Safe(gui.startBackgroundFetch)
|
go utils.Safe(gui.startBackgroundFetch)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,8 +709,8 @@ func (gui *Gui) goEvery(interval time.Duration, stop chan struct{}, function fun
|
|||||||
|
|
||||||
func (gui *Gui) startBackgroundFetch() {
|
func (gui *Gui) startBackgroundFetch() {
|
||||||
gui.waitForIntro.Wait()
|
gui.waitForIntro.Wait()
|
||||||
isNew := gui.Config.GetIsNewRepo()
|
isNew := gui.IsNewRepo
|
||||||
userConfig := gui.Config.GetUserConfig()
|
userConfig := gui.UserConfig
|
||||||
if !isNew {
|
if !isNew {
|
||||||
time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second)
|
time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second)
|
||||||
}
|
}
|
||||||
@ -729,7 +731,7 @@ func (gui *Gui) startBackgroundFetch() {
|
|||||||
|
|
||||||
// setColorScheme sets the color scheme for the app based on the user config
|
// setColorScheme sets the color scheme for the app based on the user config
|
||||||
func (gui *Gui) setColorScheme() error {
|
func (gui *Gui) setColorScheme() error {
|
||||||
userConfig := gui.Config.GetUserConfig()
|
userConfig := gui.UserConfig
|
||||||
theme.UpdateTheme(userConfig.Gui.Theme)
|
theme.UpdateTheme(userConfig.Gui.Theme)
|
||||||
|
|
||||||
gui.g.FgColor = theme.InactiveBorderColor
|
gui.g.FgColor = theme.InactiveBorderColor
|
||||||
|
@ -204,7 +204,7 @@ func (gui *Gui) getKey(key string) interface{} {
|
|||||||
|
|
||||||
// GetInitialKeybindings is a function.
|
// GetInitialKeybindings is a function.
|
||||||
func (gui *Gui) GetInitialKeybindings() []*Binding {
|
func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
config := gui.Config.GetUserConfig().Keybinding
|
config := gui.UserConfig.Keybinding
|
||||||
|
|
||||||
bindings := []*Binding{
|
bindings := []*Binding{
|
||||||
{
|
{
|
||||||
|
@ -374,7 +374,7 @@ func (gui *Gui) onInitialViewsCreation() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !gui.Config.GetUserConfig().DisableStartupPopups {
|
if !gui.UserConfig.DisableStartupPopups {
|
||||||
popupTasks := []func(chan struct{}) error{}
|
popupTasks := []func(chan struct{}) error{}
|
||||||
storedPopupVersion := gui.Config.GetAppState().StartupPopupVersion
|
storedPopupVersion := gui.Config.GetAppState().StartupPopupVersion
|
||||||
if storedPopupVersion < StartupPopupVersion {
|
if storedPopupVersion < StartupPopupVersion {
|
||||||
|
@ -145,7 +145,7 @@ func (gui *Gui) tagsListContext() IListContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) branchCommitsListContext() IListContext {
|
func (gui *Gui) branchCommitsListContext() IListContext {
|
||||||
parseEmoji := gui.Config.GetUserConfig().Git.ParseEmoji
|
parseEmoji := gui.UserConfig.Git.ParseEmoji
|
||||||
return &ListContext{
|
return &ListContext{
|
||||||
BasicContext: &BasicContext{
|
BasicContext: &BasicContext{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
@ -188,7 +188,7 @@ func (gui *Gui) branchCommitsListContext() IListContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) subCommitsListContext() IListContext {
|
func (gui *Gui) subCommitsListContext() IListContext {
|
||||||
parseEmoji := gui.Config.GetUserConfig().Git.ParseEmoji
|
parseEmoji := gui.UserConfig.Git.ParseEmoji
|
||||||
return &ListContext{
|
return &ListContext{
|
||||||
BasicContext: &BasicContext{
|
BasicContext: &BasicContext{
|
||||||
ViewName: "branches",
|
ViewName: "branches",
|
||||||
@ -229,7 +229,7 @@ func (gui *Gui) subCommitsListContext() IListContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) shouldShowGraph() bool {
|
func (gui *Gui) shouldShowGraph() bool {
|
||||||
value := gui.Config.GetUserConfig().Git.Log.ShowGraph
|
value := gui.UserConfig.Git.Log.ShowGraph
|
||||||
switch value {
|
switch value {
|
||||||
case "always":
|
case "always":
|
||||||
return true
|
return true
|
||||||
@ -244,7 +244,7 @@ func (gui *Gui) shouldShowGraph() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) reflogCommitsListContext() IListContext {
|
func (gui *Gui) reflogCommitsListContext() IListContext {
|
||||||
parseEmoji := gui.Config.GetUserConfig().Git.ParseEmoji
|
parseEmoji := gui.UserConfig.Git.ParseEmoji
|
||||||
return &ListContext{
|
return &ListContext{
|
||||||
BasicContext: &BasicContext{
|
BasicContext: &BasicContext{
|
||||||
ViewName: "commits",
|
ViewName: "commits",
|
||||||
@ -387,7 +387,7 @@ func (gui *Gui) getListContexts() []IListContext {
|
|||||||
func (gui *Gui) getListContextKeyBindings() []*Binding {
|
func (gui *Gui) getListContextKeyBindings() []*Binding {
|
||||||
bindings := make([]*Binding, 0)
|
bindings := make([]*Binding, 0)
|
||||||
|
|
||||||
keybindingConfig := gui.Config.GetUserConfig().Keybinding
|
keybindingConfig := gui.UserConfig.Keybinding
|
||||||
|
|
||||||
for _, listContext := range gui.getListContexts() {
|
for _, listContext := range gui.getListContexts() {
|
||||||
listContext := listContext
|
listContext := listContext
|
||||||
|
@ -29,7 +29,7 @@ func (i *menuItem) ID() string {
|
|||||||
// specific functions
|
// specific functions
|
||||||
|
|
||||||
func (gui *Gui) getMenuOptions() map[string]string {
|
func (gui *Gui) getMenuOptions() map[string]string {
|
||||||
keybindingConfig := gui.Config.GetUserConfig().Keybinding
|
keybindingConfig := gui.UserConfig.Keybinding
|
||||||
|
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
gui.getKeyDisplay(keybindingConfig.Universal.Return): gui.Tr.LcClose,
|
gui.getKeyDisplay(keybindingConfig.Universal.Return): gui.Tr.LcClose,
|
||||||
|
@ -227,7 +227,7 @@ func (gui *Gui) centerYPos(view *gocui.View, y int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) getMergingOptions() map[string]string {
|
func (gui *Gui) getMergingOptions() map[string]string {
|
||||||
keybindingConfig := gui.Config.GetUserConfig().Keybinding
|
keybindingConfig := gui.UserConfig.Keybinding
|
||||||
|
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
fmt.Sprintf("%s %s", gui.getKeyDisplay(keybindingConfig.Universal.PrevItem), gui.getKeyDisplay(keybindingConfig.Universal.NextItem)): gui.Tr.LcSelectHunk,
|
fmt.Sprintf("%s %s", gui.getKeyDisplay(keybindingConfig.Universal.PrevItem), gui.getKeyDisplay(keybindingConfig.Universal.NextItem)): gui.Tr.LcSelectHunk,
|
||||||
|
@ -73,6 +73,6 @@ func (gui *Gui) createPullRequest(from string, to string) error {
|
|||||||
|
|
||||||
func (gui *Gui) getHostingServiceMgr() *hosting_service.HostingServiceMgr {
|
func (gui *Gui) getHostingServiceMgr() *hosting_service.HostingServiceMgr {
|
||||||
remoteUrl := gui.GitCommand.GetRemoteURL()
|
remoteUrl := gui.GitCommand.GetRemoteURL()
|
||||||
configServices := gui.Config.GetUserConfig().Services
|
configServices := gui.UserConfig.Services
|
||||||
return hosting_service.NewHostingServiceMgr(gui.Log, gui.Tr, remoteUrl, configServices)
|
return hosting_service.NewHostingServiceMgr(gui.Log, gui.Tr, remoteUrl, configServices)
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ func (gui *Gui) handleTopLevelReturn() error {
|
|||||||
return gui.dispatchSwitchToRepo(path, true)
|
return gui.dispatchSwitchToRepo(path, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if gui.Config.GetUserConfig().QuitOnTopLevelReturn {
|
if gui.UserConfig.QuitOnTopLevelReturn {
|
||||||
return gui.handleQuit()
|
return gui.handleQuit()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ func (gui *Gui) quit() error {
|
|||||||
return gui.createUpdateQuitConfirmation()
|
return gui.createUpdateQuitConfirmation()
|
||||||
}
|
}
|
||||||
|
|
||||||
if gui.Config.GetUserConfig().ConfirmOnQuit {
|
if gui.UserConfig.ConfirmOnQuit {
|
||||||
return gui.ask(askOpts{
|
return gui.ask(askOpts{
|
||||||
title: "",
|
title: "",
|
||||||
prompt: gui.Tr.ConfirmQuit,
|
prompt: gui.Tr.ConfirmQuit,
|
||||||
|
@ -57,7 +57,7 @@ func (gui *Gui) genericMergeCommand(command string) error {
|
|||||||
// we should end up with a command like 'git merge --continue'
|
// we should end up with a command like 'git merge --continue'
|
||||||
|
|
||||||
// it's impossible for a rebase to require a commit so we'll use a subprocess only if it's a merge
|
// it's impossible for a rebase to require a commit so we'll use a subprocess only if it's a merge
|
||||||
if status == commands.REBASE_MODE_MERGING && command != REBASE_OPTION_ABORT && gui.Config.GetUserConfig().Git.Merging.ManualCommit {
|
if status == commands.REBASE_MODE_MERGING && command != REBASE_OPTION_ABORT && gui.UserConfig.Git.Merging.ManualCommit {
|
||||||
sub := gitCommand.NewCmdObj("git " + commandType + " --" + command)
|
sub := gitCommand.NewCmdObj("git " + commandType + " --" + command)
|
||||||
if sub != nil {
|
if sub != nil {
|
||||||
return gui.runSubprocessWithSuspenseAndRefresh(sub)
|
return gui.runSubprocessWithSuspenseAndRefresh(sub)
|
||||||
|
@ -39,7 +39,7 @@ func (gui *Gui) handleCreateRecentReposMenu() error {
|
|||||||
|
|
||||||
func (gui *Gui) handleShowAllBranchLogs() error {
|
func (gui *Gui) handleShowAllBranchLogs() error {
|
||||||
cmdObj := gui.OSCommand.NewCmdObj(
|
cmdObj := gui.OSCommand.NewCmdObj(
|
||||||
gui.Config.GetUserConfig().Git.AllBranchesLogCmd,
|
gui.UserConfig.Git.AllBranchesLogCmd,
|
||||||
)
|
)
|
||||||
task := NewRunPtyTask(cmdObj.GetCmd())
|
task := NewRunPtyTask(cmdObj.GetCmd())
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ func (gui *Gui) updateRecentRepoList() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
known, recentRepos := newRecentReposList(recentRepos, currentRepo)
|
known, recentRepos := newRecentReposList(recentRepos, currentRepo)
|
||||||
gui.Config.SetIsNewRepo(known)
|
gui.IsNewRepo = known
|
||||||
gui.Config.GetAppState().RecentRepos = recentRepos
|
gui.Config.GetAppState().RecentRepos = recentRepos
|
||||||
return gui.Config.SaveAppState()
|
return gui.Config.SaveAppState()
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ func (gui *Gui) handleSearch() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) onSelectItemWrapper(innerFunc func(int) error) func(int, int, int) error {
|
func (gui *Gui) onSelectItemWrapper(innerFunc func(int) error) func(int, int, int) error {
|
||||||
keybindingConfig := gui.Config.GetUserConfig().Keybinding
|
keybindingConfig := gui.UserConfig.Keybinding
|
||||||
|
|
||||||
return func(y int, index int, total int) error {
|
return func(y int, index int, total int) error {
|
||||||
if total == 0 {
|
if total == 0 {
|
||||||
|
@ -100,7 +100,7 @@ func (gui *Gui) handleResetSelection() error {
|
|||||||
return gui.applySelection(true, state)
|
return gui.applySelection(true, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !gui.Config.GetUserConfig().Gui.SkipUnstageLineWarning {
|
if !gui.UserConfig.Gui.SkipUnstageLineWarning {
|
||||||
return gui.ask(askOpts{
|
return gui.ask(askOpts{
|
||||||
title: gui.Tr.UnstageLinesTitle,
|
title: gui.Tr.UnstageLinesTitle,
|
||||||
prompt: gui.Tr.UnstageLinesPrompt,
|
prompt: gui.Tr.UnstageLinesPrompt,
|
||||||
|
@ -45,7 +45,7 @@ func (gui *Gui) refreshStashEntries() error {
|
|||||||
// specific functions
|
// specific functions
|
||||||
|
|
||||||
func (gui *Gui) handleStashApply() error {
|
func (gui *Gui) handleStashApply() error {
|
||||||
skipStashWarning := gui.Config.GetUserConfig().Gui.SkipStashWarning
|
skipStashWarning := gui.UserConfig.Gui.SkipStashWarning
|
||||||
|
|
||||||
apply := func() error {
|
apply := func() error {
|
||||||
return gui.stashDo("apply")
|
return gui.stashDo("apply")
|
||||||
@ -65,7 +65,7 @@ func (gui *Gui) handleStashApply() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleStashPop() error {
|
func (gui *Gui) handleStashPop() error {
|
||||||
skipStashWarning := gui.Config.GetUserConfig().Gui.SkipStashWarning
|
skipStashWarning := gui.UserConfig.Gui.SkipStashWarning
|
||||||
|
|
||||||
pop := func() error {
|
pop := func() error {
|
||||||
return gui.stashDo("pop")
|
return gui.stashDo("pop")
|
||||||
|
@ -36,7 +36,7 @@ func (gui *Gui) onBackgroundUpdateCheckFinish(newVersion string, err error) erro
|
|||||||
if newVersion == "" {
|
if newVersion == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if gui.Config.GetUserConfig().Update.Method == "background" {
|
if gui.UserConfig.Update.Method == "background" {
|
||||||
gui.startUpdating(newVersion)
|
gui.startUpdating(newVersion)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ func (gui *Gui) renderDisplayStringsAtPos(v *gocui.View, y int, displayStrings [
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) globalOptionsMap() map[string]string {
|
func (gui *Gui) globalOptionsMap() map[string]string {
|
||||||
keybindingConfig := gui.Config.GetUserConfig().Keybinding
|
keybindingConfig := gui.UserConfig.Keybinding
|
||||||
|
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
fmt.Sprintf("%s/%s", gui.getKeyDisplay(keybindingConfig.Universal.ScrollUpMain), gui.getKeyDisplay(keybindingConfig.Universal.ScrollDownMain)): gui.Tr.LcScroll,
|
fmt.Sprintf("%s/%s", gui.getKeyDisplay(keybindingConfig.Universal.ScrollUpMain), gui.getKeyDisplay(keybindingConfig.Universal.ScrollDownMain)): gui.Tr.LcScroll,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user