diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-08-29 13:04:29 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-09-20 13:30:49 +0200 |
commit | 864a9ada57f2fd5b6d372ba5fc127dd87d53436e (patch) | |
tree | 930dc6a305928b08b8ff4137be6aac10e000faee /pkg/gui/popup | |
parent | f3e9d50d945d7ea2bc905d1d1c6006ec93f95305 (diff) |
Remove unused WithLoaderPanel code
Diffstat (limited to 'pkg/gui/popup')
-rw-r--r-- | pkg/gui/popup/popup_handler.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/pkg/gui/popup/popup_handler.go b/pkg/gui/popup/popup_handler.go index eab468e46..cd34bc20e 100644 --- a/pkg/gui/popup/popup_handler.go +++ b/pkg/gui/popup/popup_handler.go @@ -3,11 +3,9 @@ package popup import ( "context" "strings" - "time" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/common" - gctx "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/sasha-s/go-deadlock" @@ -25,7 +23,6 @@ type PopupHandler struct { withWaitingStatusFn func(message string, f func(gocui.Task) error) toastFn func(message string) getPromptInputFn func() string - onWorker func(func(gocui.Task)) inDemo func() bool } @@ -41,7 +38,6 @@ func NewPopupHandler( withWaitingStatusFn func(message string, f func(gocui.Task) error), toastFn func(message string), getPromptInputFn func() string, - onWorker func(func(gocui.Task)), inDemo func() bool, ) *PopupHandler { return &PopupHandler{ @@ -55,7 +51,6 @@ func NewPopupHandler( withWaitingStatusFn: withWaitingStatusFn, toastFn: toastFn, getPromptInputFn: getPromptInputFn, - onWorker: onWorker, inDemo: inDemo, } } @@ -128,47 +123,6 @@ func (self *PopupHandler) Prompt(opts types.PromptOpts) error { }) } -func (self *PopupHandler) WithLoaderPanel(message string, f func(gocui.Task) error) error { - index := 0 - self.Lock() - self.index++ - index = self.index - self.Unlock() - - ctx, cancel := context.WithCancel(context.Background()) - - err := self.createPopupPanelFn(ctx, types.CreatePopupPanelOpts{ - Prompt: message, - HasLoader: true, - }) - if err != nil { - self.Log.Error(err) - cancel() - return nil - } - - self.onWorker(func(task gocui.Task) { - // emulating a delay due to network latency - if self.inDemo() { - time.Sleep(500 * time.Millisecond) - } - - if err := f(task); err != nil { - self.Log.Error(err) - } - - cancel() - - self.Lock() - if index == self.index && self.currentContextFn().GetKey() == gctx.CONFIRMATION_CONTEXT_KEY { - _ = self.popContextFn() - } - self.Unlock() - }) - - return nil -} - // returns the content that has currently been typed into the prompt. Useful for // asynchronously updating the suggestions list under the prompt. func (self *PopupHandler) GetPromptInput() string { |