diff -up or/diffutils-2.8.1/src/side.c diffutils-2.8.1/src/side.c --- or/diffutils-2.8.1/src/side.c 2002-02-07 19:17:04.000000000 +0100 +++ diffutils-2.8.1/src/side.c 2009-09-17 10:17:36.000000000 +0200 @@ -60,6 +60,31 @@ tab_from_to (unsigned int from, unsigned return to; } + +static int +is_ctrl(char c, const char* cc) +{ +#if 0 + static int in_ctrl=0; + if (c==27) + { + in_ctrl=1; + } + else if (c=='m') + { + in_ctrl=0; + return 1; + } + return in_ctrl; +#else + return ( ( (c=='[') && ((*(cc-1)==27)) ) || + ( isdigit(c) && ((*(cc-2)==27) || + (*(cc-3)==27)) ) || + ( (c=='m') && ((*(cc-3)==27) || + (*(cc-4)==27)) ) ); +#endif +} + /* * Print the text for half an sdiff line. This means truncate to width * observing tabs, and trim a trailing newline. Returns the last column @@ -136,7 +161,7 @@ print_half_line (char const *const *line break; default: - if (! ISPRINT (c)) + if ( is_ctrl (c,text_pointer-1) || (! ISPRINT (c)) ) goto control_char; /* falls through */ case ' ':