Remove PopupHandler index and mutex

It doesn't seem to be used.
This commit is contained in:
Stefan Haller 2024-04-14 14:59:42 +02:00
parent 145795c0b0
commit 8a77e51576

View file

@ -8,13 +8,10 @@ import (
"github.com/jesseduffield/lazygit/pkg/common"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/sasha-s/go-deadlock"
)
type PopupHandler struct {
*common.Common
index int
deadlock.Mutex
createPopupPanelFn func(context.Context, types.CreatePopupPanelOpts) error
onErrorFn func() error
popContextFn func() error
@ -44,7 +41,6 @@ func NewPopupHandler(
) *PopupHandler {
return &PopupHandler{
Common: common,
index: 0,
createPopupPanelFn: createPopupPanelFn,
onErrorFn: onErrorFn,
popContextFn: popContextFn,
@ -93,10 +89,6 @@ func (self *PopupHandler) Error(err error) error {
}
func (self *PopupHandler) ErrorMsg(message string) error {
self.Lock()
self.index++
self.Unlock()
// Need to set bold here explicitly; otherwise it gets cancelled by the red colouring.
coloredMessage := style.FgRed.SetBold().Sprint(strings.TrimSpace(message))
if err := self.onErrorFn(); err != nil {
@ -111,10 +103,6 @@ func (self *PopupHandler) Alert(title string, message string) error {
}
func (self *PopupHandler) Confirm(opts types.ConfirmOpts) error {
self.Lock()
self.index++
self.Unlock()
return self.createPopupPanelFn(context.Background(), types.CreatePopupPanelOpts{
Title: opts.Title,
Prompt: opts.Prompt,
@ -124,10 +112,6 @@ func (self *PopupHandler) Confirm(opts types.ConfirmOpts) error {
}
func (self *PopupHandler) Prompt(opts types.PromptOpts) error {
self.Lock()
self.index++
self.Unlock()
return self.createPopupPanelFn(context.Background(), types.CreatePopupPanelOpts{
Title: opts.Title,
Prompt: opts.InitialContent,