- if (c > 255) { /* function key hit */
- if (cl==0) { /* if first character then */
- *string = EOS; /* terminate string */
- return c; /* return it */
- }
- t_honk_horn(); /* complain */
- } else {
- if (mode_insert) {
- insert_space(curline, sizeof(curline));
- }
- curline[cp++] = c; /* store character in line being built */
- t_char((char)c); /* echo character to terminal */
- if (cp > cl) {
- cl = cp; /* keep current length */
- }
- }
- break;
- } /* end switch */
+ if (c > 255) { /* function key hit */
+ if (cl==0) { /* if first character then */
+ *string = EOS; /* terminate string */
+ return c; /* return it */
+ }
+ t_honk_horn(); /* complain */
+ } else {
+ if ((c & 0xC0) == 0xC0) {
+ if ((c & 0xFC) == 0xFC) {
+ more = 5;
+ } else if ((c & 0xF8) == 0xF8) {
+ more = 4;
+ } else if ((c & 0xF0) == 0xF0) {
+ more = 3;
+ } else if ((c & 0xE0) == 0xE0) {
+ more = 2;
+ } else {
+ more = 1;
+ }
+ } else {
+ more = 0;
+ }
+ if (mode_insert) {
+ insert_space(curline, sizeof(curline));
+ }
+ curline[cp++] = c; /* store character in line being built */
+ t_char(c); /* echo character to terminal */
+ while (more--) {
+ c= input_char();
+ insert_hole(curline, sizeof(curline));
+ curline[cp++] = c; /* store character in line being built */
+ t_char(c); /* echo character to terminal */
+ }
+ if (cp > cl) {
+ cl = cp; /* keep current length */
+ curline[cp] = 0;
+ }
+ }
+ break;
+ } /* end switch */