From 7df04a58ebfe4279ee82098ba3b62f41cc5fae63 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Mon, 16 Nov 2020 14:07:22 -0500 Subject: [PATCH] Clear prompt before callback Ref #1913 --- internal/info/infobuffer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/info/infobuffer.go b/internal/info/infobuffer.go index 048e3cb2..e88701a4 100644 --- a/internal/info/infobuffer.go +++ b/internal/info/infobuffer.go @@ -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)