Clear prompt before callback

Ref #1913
This commit is contained in:
Zachary Yedidia 2020-11-16 14:07:22 -05:00
parent f3b21362f3
commit 7df04a58eb

View file

@ -137,11 +137,13 @@ func (i *InfoBuf) DonePrompt(canceled bool) {
if !hadYN {
if i.PromptCallback != nil {
if canceled {
i.Replace(i.Start(), i.End(), "")
i.PromptCallback("", true)
h := i.History[i.PromptType]
i.History[i.PromptType] = h[:len(h)-1]
} else {
resp := string(i.LineBytes(0))
i.Replace(i.Start(), i.End(), "")
i.PromptCallback(resp, false)
h := i.History[i.PromptType]
h[len(h)-1] = resp
@ -156,7 +158,6 @@ func (i *InfoBuf) DonePrompt(canceled bool) {
}
// i.PromptCallback = nil
}
i.Replace(i.Start(), i.End(), "")
}
if i.YNCallback != nil && hadYN {
i.YNCallback(i.YNResp, canceled)