Split improvements

This commit is contained in:
Zachary Yedidia
2019-01-05 16:27:04 -05:00
parent 23f5e9c770
commit e4e99b03d3
7 changed files with 125 additions and 35 deletions

View File

@@ -115,7 +115,10 @@ func (i *InfoBuf) YNPrompt(prompt string, donecb func(bool, bool)) {
// DonePrompt finishes the current prompt and indicates whether or not it was canceled
func (i *InfoBuf) DonePrompt(canceled bool) {
if i.PromptCallback != nil && !i.HasYN {
hadYN := i.HasYN
i.HasPrompt = false
i.HasYN = false
if i.PromptCallback != nil && !hadYN {
if canceled {
i.PromptCallback("", true)
h := i.History[i.PromptType]
@@ -127,11 +130,9 @@ func (i *InfoBuf) DonePrompt(canceled bool) {
h[len(h)-1] = resp
}
}
if i.YNCallback != nil && i.HasYN {
if i.YNCallback != nil && hadYN {
i.YNCallback(i.YNResp, canceled)
}
i.HasPrompt = false
i.HasYN = false
i.PromptCallback = nil
i.EventCallback = nil
i.YNCallback = nil