Fix panic when replace-query is triggered on empty result set

This commit is contained in:
Junegunn Choi 2017-12-03 23:48:59 +09:00
parent 04aa2992e7
commit 9c47739c0e
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -1571,7 +1571,7 @@ func (t *Terminal) Loop() {
case actPrintQuery:
req(reqPrintQuery)
case actReplaceQuery:
if t.cy < t.merger.Length() {
if t.cy >= 0 && t.cy < t.merger.Length() {
t.input = t.merger.Get(t.cy).item.text.ToRunes()
t.cx = len(t.input)
}