Fix #185 - Terminate on RuneError

pull/189/head
Junegunn Choi 9 years ago
parent 3a9d1df026
commit 2d68cb8639

@ -7,6 +7,7 @@ CHANGELOG
### Bug fixes ### Bug fixes
- Fixed Unicode case handling (#186) - Fixed Unicode case handling (#186)
- Fixed to terminate on RuneError (#185)
0.9.7 0.9.7
----- -----

@ -420,6 +420,9 @@ func GetChar() Event {
return Event{int(_buf[0]), 0, nil} return Event{int(_buf[0]), 0, nil}
} }
r, rsz := utf8.DecodeRune(_buf) r, rsz := utf8.DecodeRune(_buf)
if r == utf8.RuneError {
return Event{ESC, 0, nil}
}
sz = rsz sz = rsz
return Event{Rune, r, nil} return Event{Rune, r, nil}
} }

Loading…
Cancel
Save