Do not match jump labels beyond the screen limit

This commit is contained in:
Junegunn Choi 2016-05-18 22:45:34 +09:00
parent e53535cc61
commit 13330738b8
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -1155,7 +1155,7 @@ func (t *Terminal) Loop() {
changed = string(previousInput) != string(t.input)
} else {
if mapkey == C.Rune {
if idx := strings.IndexRune(t.jumpLabels, event.Char); idx >= 0 {
if idx := strings.IndexRune(t.jumpLabels, event.Char); idx >= 0 && idx < t.maxItems() && idx < t.merger.Length() {
t.cy = idx + t.offset
if t.jumping == jumpAcceptEnabled {
req(reqClose)