This is a patch against rxvt-2.6.3. It provides an interface for applications running in the rxvt window that allows them to request contents of rectangular areas from the currently inactive screen buffer. To indicate presence of this extension, the environment variable RXVT_EXT is set by rxvt to the extension protocol version, which is "1.0" for this implementation. GNU Midnight Commander uses this extension to display last lines of the command output when the panels are active. To enable this, select menu "Options->Layout..." and find "output lines" in it. If you don't see "output lines", the rxvt extension has not been detected. Using "+" and "-" set the number of output lines you want to see. Save the configuration and enjoy! The patch was written by Paul Sheer Adapted to rxvt-2.6.3 by Pavel Roskin Suggestsions and comments should be sent to the mailing list mc-devel@gnome.org --- src/command.c +++ src/command.c @@ -2461,6 +2461,78 @@ process_print_pipe(void) #endif /* PRINTPIPE */ /*}}} */ +/*{{{ */ +/* rxvt extensions */ + +static void +this_putc (int fd, int c) +{ + unsigned char t; + + if (c < 0) { + t = '\n'; + write (fd, &t, 1); + return; + } + t = (c / 16) + 'A'; + while (write (fd, &t, 1) != 1) ; + t = (c % 16) + 'A'; + while (write (fd, &t, 1) != 1) ; +} + +/* write the range y1 <= row < y2 of lines from the swap screen to y at the screen */ +static void +write_lines (int fd, int y1, int y2) +{ + int i, y, nrow, ncol; + + nrow = TermWin.nrow; + ncol = TermWin.ncol; + + if (y1 >= nrow) + y1 = nrow - 1; + if (y2 >= nrow) + y2 = nrow - 1; + if (y1 < 0) + y1 = 0; + if (y2 < 0) + y2 = 0; + if (y1 >= y2) + return; + + for (y = y1; y < y2; y++) { + for (i = 0; i < ncol; i++) + this_putc (fd, swap.text[y][i]); + this_putc (fd, -1); + } + this_putc (fd, -1); +} + +static void +write_saved_lines (void) +{ + int y1, y2; + + y1 = (cmd_getc () - 'A') * 26; + y1 += cmd_getc () - 'A'; + y2 = (cmd_getc () - 'A') * 26; + y2 += cmd_getc () - 'A'; + cmd_getc (); + write_lines (cmd_fd, y1, y2); +} + +static void +rxvt_extended_modes (void) +{ + switch (cmd_getc ()) { + case 'L': + /* write saved lines */ + write_saved_lines (); + break; + } +} +/*}}} */ + /*{{{ process escape sequences */ /* INTPROTO */ void @@ -2513,6 +2585,10 @@ process_escape_seq(void) break; case '@': (void)cmd_getc(); + break; + /* rxvt extensions */ + case 'C': + rxvt_extended_modes (); break; case 'D': scr_index(UP); --- src/main.c +++ src/main.c @@ -1334,6 +1334,9 @@ init_env(void) #ifdef RXVT_TERMINFO putenv("TERMINFO=" RXVT_TERMINFO); #endif + /* rxvt extensions */ + putenv ("RXVT_EXT=1.0"); + if (Xdepth <= 2) putenv("COLORTERM=" COLORTERMENV "-mono"); else