diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-16 14:46:53 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 1dd7307fde033dae5fececac15810a99e26c3d91 (patch) | |
tree | 4e851c9e3229a6fe3b4191f6311d05d7a9142960 /pkg/gui/popup | |
parent | a90b6efded49abcfa2516db794d7875b0396f558 (diff) |
start moving commit panel handlers into controller
more
and more
move rebase commit refreshing into existing abstraction
and more
and more
WIP
and more
handling clicks
properly fix merge conflicts
update cheatsheet
lots more preparation to start moving things into controllers
WIP
better typing
expand on remotes controller
moving more code into controllers
Diffstat (limited to 'pkg/gui/popup')
-rw-r--r-- | pkg/gui/popup/popup_handler.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/gui/popup/popup_handler.go b/pkg/gui/popup/popup_handler.go index adc276d5f..bba0e52a8 100644 --- a/pkg/gui/popup/popup_handler.go +++ b/pkg/gui/popup/popup_handler.go @@ -19,6 +19,8 @@ type IPopupHandler interface { WithLoaderPanel(message string, f func() error) error WithWaitingStatus(message string, f func() error) error Menu(opts CreateMenuOptions) error + Toast(message string) + GetPromptInput() string } type CreateMenuOptions struct { @@ -74,6 +76,8 @@ type RealPopupHandler struct { closePopupFn func() error createMenuFn func(CreateMenuOptions) error withWaitingStatusFn func(message string, f func() error) error + toastFn func(message string) + getPromptInputFn func() string } var _ IPopupHandler = &RealPopupHandler{} @@ -85,6 +89,8 @@ func NewPopupHandler( closePopupFn func() error, createMenuFn func(CreateMenuOptions) error, withWaitingStatusFn func(message string, f func() error) error, + toastFn func(message string), + getPromptInputFn func() string, ) *RealPopupHandler { return &RealPopupHandler{ Common: common, @@ -94,6 +100,8 @@ func NewPopupHandler( closePopupFn: closePopupFn, createMenuFn: createMenuFn, withWaitingStatusFn: withWaitingStatusFn, + toastFn: toastFn, + getPromptInputFn: getPromptInputFn, } } @@ -101,6 +109,10 @@ func (self *RealPopupHandler) Menu(opts CreateMenuOptions) error { return self.createMenuFn(opts) } +func (self *RealPopupHandler) Toast(message string) { + self.toastFn(message) +} + func (self *RealPopupHandler) WithWaitingStatus(message string, f func() error) error { return self.withWaitingStatusFn(message, f) } @@ -188,6 +200,12 @@ func (self *RealPopupHandler) WithLoaderPanel(message string, f func() error) er return nil } +// returns the content that has currently been typed into the prompt. Useful for +// asyncronously updating the suggestions list under the prompt. +func (self *RealPopupHandler) GetPromptInput() string { + return self.getPromptInputFn() +} + type TestPopupHandler struct { OnErrorMsg func(message string) error OnAsk func(opts AskOpts) error @@ -221,3 +239,11 @@ func (self *TestPopupHandler) WithWaitingStatus(message string, f func() error) func (self *TestPopupHandler) Menu(opts CreateMenuOptions) error { panic("not yet implemented") } + +func (self *TestPopupHandler) Toast(message string) { + panic("not yet implemented") +} + +func (self *TestPopupHandler) CurrentInput() string { + panic("not yet implemented") +} |