Fix #185 - Terminate on RuneError

This commit is contained in:
Junegunn Choi 2015-04-14 23:19:33 +09:00
parent 3a9d1df026
commit 2d68cb8639
2 changed files with 4 additions and 0 deletions

View File

@ -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
----- -----

View File

@ -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}
} }