mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
pkg/gui: Add support for 'notification' popups
Add a new 'Notification()' method to 'IPopupHandler' that makes it easier to show a modal info message to the user. This is simply a convenience wrapper around 'Ask()', so the popup can be closed using both 'Enter' and 'ESC'.
This commit is contained in:
committed by
Jesse Duffield
parent
ac406f57ff
commit
9bccc20888
@ -85,6 +85,10 @@ func (self *RealPopupHandler) ErrorMsg(message string) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (self *RealPopupHandler) Alert(title string, message string) error {
|
||||
return self.Ask(types.AskOpts{Title: title, Prompt: message})
|
||||
}
|
||||
|
||||
func (self *RealPopupHandler) Ask(opts types.AskOpts) error {
|
||||
self.Lock()
|
||||
self.index++
|
||||
@ -147,7 +151,7 @@ func (self *RealPopupHandler) WithLoaderPanel(message string, f func() error) er
|
||||
}
|
||||
|
||||
// returns the content that has currently been typed into the prompt. Useful for
|
||||
// asyncronously updating the suggestions list under the prompt.
|
||||
// asynchronously updating the suggestions list under the prompt.
|
||||
func (self *RealPopupHandler) GetPromptInput() string {
|
||||
return self.getPromptInputFn()
|
||||
}
|
||||
@ -168,6 +172,10 @@ func (self *TestPopupHandler) ErrorMsg(message string) error {
|
||||
return self.OnErrorMsg(message)
|
||||
}
|
||||
|
||||
func (self *TestPopupHandler) Alert(title string, message string) error {
|
||||
panic("not yet implemented")
|
||||
}
|
||||
|
||||
func (self *TestPopupHandler) Ask(opts types.AskOpts) error {
|
||||
return self.OnAsk(opts)
|
||||
}
|
||||
|
Reference in New Issue
Block a user