Skip to content

Commit dd913df

Browse files
Reordered prompt done callback to avoid accessing out of bound history (zyedidia#3318)
* Reordered prompt done callback to avoid accessing out of bound history * Formatting
1 parent e9bd1b3 commit dd913df

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/info/infobuffer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,12 @@ func (i *InfoBuf) DonePrompt(canceled bool) {
143143
if i.PromptCallback != nil {
144144
if canceled {
145145
i.Replace(i.Start(), i.End(), "")
146-
i.PromptCallback("", true)
147146
h := i.History[i.PromptType]
148147
i.History[i.PromptType] = h[:len(h)-1]
148+
i.PromptCallback("", true)
149149
} else {
150150
resp := string(i.LineBytes(0))
151151
i.Replace(i.Start(), i.End(), "")
152-
i.PromptCallback(resp, false)
153152
h := i.History[i.PromptType]
154153
h[len(h)-1] = resp
155154

@@ -160,6 +159,8 @@ func (i *InfoBuf) DonePrompt(canceled bool) {
160159
break
161160
}
162161
}
162+
163+
i.PromptCallback(resp, false)
163164
}
164165
// i.PromptCallback = nil
165166
}

0 commit comments

Comments
 (0)