diff --git a/edit.c b/edit.c index 6900be1..1e7a1e7 100644 --- a/edit.c +++ b/edit.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.85 2007/03/10 00:23:31 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.86 2007/03/10 00:36:44 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -1503,6 +1503,7 @@ x_insert(int c) * Should allow tab and control chars. */ if (c == 0) { + invmbs: left = 0; x_e_putc2(7); return KSTD; @@ -1519,10 +1520,12 @@ x_insert(int c) return (KSTD); } if (left) { - /* flush invalid multibyte */ - str[pos] = '\0'; - while (save_arg--) - x_ins(str); + if (x_curprefix == -1) { + /* flush invalid multibyte */ + str[pos] = '\0'; + while (save_arg--) + x_ins(str); + } left = 0; } if ((c >= 0xC2) && (c < 0xE0)) @@ -1534,7 +1537,8 @@ x_insert(int c) pos = 1; str[0] = c; return (KSTD); - } + } else if (c > 0x7F) + goto invmbs; } left = 0; str[0] = c;