diff --git a/ChangeLog b/ChangeLog index 196765c..d0bd378 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5168,3 +5168,8 @@ Mon Jan 19 21:02:30 2004 Michael Jennings (mej) Patch from David Lloyd for overstrike support. ---------------------------------------------------------------------- +Wed Feb 11 14:06:20 2004 Michael Jennings (mej) + +Fixed handling of escape sequences while printing. Pointed out by +Tom A. Cox . +---------------------------------------------------------------------- diff --git a/src/term.c b/src/term.c index c28138f..85ba3f7 100644 --- a/src/term.c +++ b/src/term.c @@ -850,7 +850,6 @@ void process_print_pipe(void) { const char *const escape_seq = "\033[4i"; - const char *const rev_escape_seq = "i4[\033"; int index; FILE *fd; @@ -858,14 +857,18 @@ process_print_pipe(void) for (index = 0; index < 4; /* nil */ ) { unsigned char ch = cmd_getc(); - if (ch == escape_seq[index]) + if (ch == escape_seq[index]) { index++; - else if (index) - for ( /*nil */ ; index > 0; index--) - fputc(rev_escape_seq[index - 1], fd); + } else if (index) { + int i; - if (index == 0) + for (i = 0; index > 0; i++, index--) { + fputc(escape_seq[i], fd); + } + } + if (index == 0) { fputc(ch, fd); + } } pclose_printer(fd); }