diff -u nano-behem/nano.c nano-behem-new/nano.c --- nano-behem/nano.c Mon Jul 8 22:04:46 2002 +++ nano-behem-new/nano.c Mon Jul 8 21:59:36 2002 @@ -2141,7 +2141,13 @@ if (*line == ' ') space_loc = cur_loc; assert(*line != '\t'); - goal -= (iscntrl((int)*line) ? 2 : 1); + + if (iscntrl(*line)) + goal -= 2; + else if ((unsigned char) *line >= 0x80 && (unsigned char) *line <= 0x9f) + goal -= 4; + else + goal--; } if (goal >= 0) /* In fact, the whole line displays shorter than goal. */ diff -u nano-behem/winio.c nano-behem-new/winio.c --- nano-behem/winio.c Mon Jul 8 22:04:47 2002 +++ nano-behem-new/winio.c Mon Jul 8 22:03:30 2002 @@ -89,6 +89,8 @@ length += tabsize - length % tabsize; else if (iscntrl((int)*c)) length += 2; + else if ((unsigned char) *c >= 0x80 && (unsigned char) *c <= 0x9f) + length += 4; else length++; } @@ -116,6 +118,8 @@ length += tabsize - (length % tabsize); else if (iscntrl((int)*buf)) length += 2; + else if ((unsigned char) *buf >= 0x80 && (unsigned char) *buf <= 0x9f) + length += 4; else length++; } @@ -958,12 +962,13 @@ converted[pos++] = '@'; else converted[pos++] = *original + 64; - } else if ((unsigned char)*original >= 0x80 && (unsigned char)*original <= 0x9f) + } else if ((unsigned char)*original >= 0x80 && (unsigned char)*original <= 0x9f) { /* xterm treats some of these characters as commands and screws up the display if we print them, so print .'s instead. elvis does this too. */ - converted[pos++] = '.'; - else + sprintf(converted + pos, "\\%hho", (unsigned char) *original); + pos += 4; + } else converted[pos++] = *original; } converted[pos] = '\0';