From 2d68cb8639a78ec6b7e88dd71e2ce1a638e5f8ea Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 14 Apr 2015 23:19:33 +0900 Subject: [PATCH] Fix #185 - Terminate on RuneError --- CHANGELOG.md | 1 + src/curses/curses.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index edaf674..0fd89e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ CHANGELOG ### Bug fixes - Fixed Unicode case handling (#186) +- Fixed to terminate on RuneError (#185) 0.9.7 ----- diff --git a/src/curses/curses.go b/src/curses/curses.go index d6aafd7..f3ad143 100644 --- a/src/curses/curses.go +++ b/src/curses/curses.go @@ -420,6 +420,9 @@ func GetChar() Event { return Event{int(_buf[0]), 0, nil} } r, rsz := utf8.DecodeRune(_buf) + if r == utf8.RuneError { + return Event{ESC, 0, nil} + } sz = rsz return Event{Rune, r, nil} }