mirror of
https://github.com/zyedidia/micro.git
synced 2024-09-11 20:17:31 +03:00
Avoid duplicate entries in history (#1822)
This commit is contained in:
parent
c5bafbc1c5
commit
7e19b68426
@ -145,6 +145,14 @@ func (i *InfoBuf) DonePrompt(canceled bool) {
|
||||
i.PromptCallback(resp, false)
|
||||
h := i.History[i.PromptType]
|
||||
h[len(h)-1] = resp
|
||||
|
||||
// avoid duplicates
|
||||
for j := len(h) - 2; j >= 0; j-- {
|
||||
if h[j] == h[len(h)-1] {
|
||||
i.History[i.PromptType] = append(h[:j], h[j+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
// i.PromptCallback = nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user