Fix panic when histlist is empty.

This commit is contained in:
Qi Xiao 2016-10-16 19:50:41 +08:00
parent 02a38a7ac3
commit 34e785ce02

View File

@ -68,7 +68,11 @@ func (hl *histlist) ModeTitle(i int) string {
if hl.dedup {
dedup = " (dedup)"
}
return fmt.Sprintf(" HISTORY #%d%s ", hl.index[i], dedup)
idx := ""
if i >= 0 {
idx = fmt.Sprintf(" #%d", hl.index[i])
}
return fmt.Sprintf(" HISTORY%s%s ", idx, dedup)
}
func startHistlist(ed *Editor) {