in the utf-8 mode, invalid multibytes are now handled more strongly:
• if it's in x_literal() (“quote” / ^V) mode, it's accepted like now • if it's a mb sequence start, it's rejected with a beep • if it's a mb continuation, the whole sequence is silently rejected this makes command line editing when accidentally hitting, e.g. with my mircvs://contrib/samples/dot.Xmodmap, Mode_switch-x much more ro- bust.
This commit is contained in:
parent
d306d5a9e4
commit
db81d72dea
8
edit.c
8
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) {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user