+
+ /* states 102-106 are for UTF-8 decoding */
+
+ if ((c & 0xE0) == 0xC0) { /* 110xxxxx: 11 bits, 2 bytes */
+ state->unicruds = 1;
+ state->unicrud[0] = c;
+ state->escstate = 102;
+ break;
+ } else if ((c & 0xF0) == 0xE0) { /* 1110xxxx: 16 bits, 3 bytes */
+ state->unicruds = 1;
+ state->unicrud[0] = c;
+ state->escstate = 103;
+ break;
+ } else if ((c & 0xF8) == 0xF0) { /* 11110xxx: 21 bits, 4 bytes */
+ state->unicruds = 1;
+ state->unicrud[0] = c;
+ state->escstate = 104;
+ break;
+ } else if ((c & 0xFC) == 0xF8) { /* 111110xx: 26 bits, 5 bytes */
+ state->unicruds = 1;
+ state->unicrud[0] = c;
+ state->escstate = 105;
+ break;
+ } else if ((c & 0xFE) == 0xFC) { /* 1111110x: 31 bits, 6 bytes */
+ state->unicruds = 1;
+ state->unicrud[0] = c;
+ state->escstate = 106;
+ break;
+ }
+
+ PRINT:
+
+ /* If the cursor is in column 39 and we print a character, then
+ that character shows up in column 39, and the cursor is no
+ longer visible on the screen (it's in "column 40".) If
+ another character is printed, then that character shows up in
+ column 0, and the cursor moves to column 1.
+
+ This is empirically what xterm and gnome-terminal do, so that
+ must be the right thing. (In xterm, the cursor vanishes,
+ whereas; in gnome-terminal, the cursor overprints the
+ character in col 39.)
+ */