1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-05-31 23:19:40 +02:00

Remove return value of CreatePopupPanel

This commit is contained in:
Stefan Haller 2024-09-05 10:40:59 +02:00
parent 6f0182f11c
commit b15a1c7ae7
3 changed files with 10 additions and 9 deletions

View File

@ -183,7 +183,7 @@ func runeForMask(mask bool) rune {
return 0 return 0
} }
func (self *ConfirmationHelper) CreatePopupPanel(ctx goContext.Context, opts types.CreatePopupPanelOpts) error { func (self *ConfirmationHelper) CreatePopupPanel(ctx goContext.Context, opts types.CreatePopupPanelOpts) {
self.c.Mutexes().PopupMutex.Lock() self.c.Mutexes().PopupMutex.Lock()
defer self.c.Mutexes().PopupMutex.Unlock() defer self.c.Mutexes().PopupMutex.Unlock()
@ -197,7 +197,7 @@ func (self *ConfirmationHelper) CreatePopupPanel(ctx goContext.Context, opts typ
if currentPopupOpts != nil && !currentPopupOpts.HasLoader { if currentPopupOpts != nil && !currentPopupOpts.HasLoader {
self.c.Log.Error("ignoring create popup panel because a popup panel is already open") self.c.Log.Error("ignoring create popup panel because a popup panel is already open")
cancel() cancel()
return nil return
} }
// remove any previous keybindings // remove any previous keybindings
@ -231,7 +231,6 @@ func (self *ConfirmationHelper) CreatePopupPanel(ctx goContext.Context, opts typ
self.c.State().GetRepoState().SetCurrentPopupOpts(&opts) self.c.State().GetRepoState().SetCurrentPopupOpts(&opts)
self.c.Context().Push(self.c.Contexts().Confirmation) self.c.Context().Push(self.c.Contexts().Confirmation)
return nil
} }
func underlineLinks(text string) string { func underlineLinks(text string) string {

View File

@ -671,8 +671,8 @@ func NewGui(
gui.PopupHandler = popup.NewPopupHandler( gui.PopupHandler = popup.NewPopupHandler(
cmn, cmn,
func(ctx goContext.Context, opts types.CreatePopupPanelOpts) error { func(ctx goContext.Context, opts types.CreatePopupPanelOpts) {
return gui.helpers.Confirmation.CreatePopupPanel(ctx, opts) gui.helpers.Confirmation.CreatePopupPanel(ctx, opts)
}, },
func() error { return gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) }, func() error { return gui.c.Refresh(types.RefreshOptions{Mode: types.ASYNC}) },
func() { gui.State.ContextMgr.Pop() }, func() { gui.State.ContextMgr.Pop() },

View File

@ -12,7 +12,7 @@ import (
type PopupHandler struct { type PopupHandler struct {
*common.Common *common.Common
createPopupPanelFn func(context.Context, types.CreatePopupPanelOpts) error createPopupPanelFn func(context.Context, types.CreatePopupPanelOpts)
onErrorFn func() error onErrorFn func() error
popContextFn func() popContextFn func()
currentContextFn func() types.Context currentContextFn func() types.Context
@ -28,7 +28,7 @@ var _ types.IPopupHandler = &PopupHandler{}
func NewPopupHandler( func NewPopupHandler(
common *common.Common, common *common.Common,
createPopupPanelFn func(context.Context, types.CreatePopupPanelOpts) error, createPopupPanelFn func(context.Context, types.CreatePopupPanelOpts),
onErrorFn func() error, onErrorFn func() error,
popContextFn func(), popContextFn func(),
currentContextFn func() types.Context, currentContextFn func() types.Context,
@ -94,16 +94,17 @@ func (self *PopupHandler) Alert(title string, message string) error {
} }
func (self *PopupHandler) Confirm(opts types.ConfirmOpts) error { func (self *PopupHandler) Confirm(opts types.ConfirmOpts) error {
return self.createPopupPanelFn(context.Background(), types.CreatePopupPanelOpts{ self.createPopupPanelFn(context.Background(), types.CreatePopupPanelOpts{
Title: opts.Title, Title: opts.Title,
Prompt: opts.Prompt, Prompt: opts.Prompt,
HandleConfirm: opts.HandleConfirm, HandleConfirm: opts.HandleConfirm,
HandleClose: opts.HandleClose, HandleClose: opts.HandleClose,
}) })
return nil
} }
func (self *PopupHandler) Prompt(opts types.PromptOpts) error { func (self *PopupHandler) Prompt(opts types.PromptOpts) error {
return self.createPopupPanelFn(context.Background(), types.CreatePopupPanelOpts{ self.createPopupPanelFn(context.Background(), types.CreatePopupPanelOpts{
Title: opts.Title, Title: opts.Title,
Prompt: opts.InitialContent, Prompt: opts.InitialContent,
Editable: true, Editable: true,
@ -114,6 +115,7 @@ func (self *PopupHandler) Prompt(opts types.PromptOpts) error {
AllowEditSuggestion: opts.AllowEditSuggestion, AllowEditSuggestion: opts.AllowEditSuggestion,
Mask: opts.Mask, Mask: opts.Mask,
}) })
return nil
} }
// returns the content that has currently been typed into the prompt. Useful for // returns the content that has currently been typed into the prompt. Useful for