void-packages/srcpkgs/qemacs/patches/qemacs-0.4.0dev-utf8-tty.patch
2015-03-23 16:02:46 +01:00

31 lines
949 B
Diff

diff --git tty.c tty.c
index bff0a97..21287a4 100644
--- tty.c
+++ tty.c
@@ -95,7 +95,6 @@ typedef struct TTYState {
/* input handling */
enum InputState input_state;
int input_param;
- int utf8_state;
int utf8_index;
unsigned char buf[10];
char *term_name;
@@ -413,12 +412,14 @@ static void tty_read_handler(void *opaque)
/* charset handling */
if (s->charset == &charset_utf8) {
- if (ts->utf8_state == 0) {
- const char *p = cs8(ts->buf);
+ /* Make sure utf8 input works correctly 20040314 <damm@opensource.se> */
+ ts->utf8_index++;
+ if (utf8_length[ts->buf[0]] == ts->utf8_index) {
+ const char *p;
+ p = (const char *)ts->buf;
ch = utf8_decode(&p);
- } else {
- ts->utf8_state = utf8_length[ts->buf[0]] - 1;
ts->utf8_index = 0;
+ } else {
return;
}
} else {