diff --git a/ChangeLog b/ChangeLog index b68a19e..869554e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3188,3 +3188,12 @@ Wed Feb 16 14:58:51 PST 2000 Michael Jennings Fix the XIM input positioning to work with the buttonbar. ------------------------------------------------------------------------------- +Thu Feb 17 15:13:20 PST 2000 Michael Jennings + + Fixed a bug with background colors and proportional fonts. Also added + an escape sequence, \e]30;\a, to dump the scrollback buffer + to a file. You will not get colors, or bold, or underlining, or any + other rendering information. Just the text. Linebreaks will appear + as they do on the screen. + +------------------------------------------------------------------------------- diff --git a/src/feature.h b/src/feature.h index 3f6780f..7296802 100644 --- a/src/feature.h +++ b/src/feature.h @@ -219,10 +219,7 @@ #define NO_VT100_ANS /* Allow changing of the foreground and background colors with "\E]39;color^G" */ -/* #define XTERM_COLOR_CHANGE */ - -/* Exports TERM=xterm-color instead of just TERM=xterm */ -/* #define DEFINE_XTERM_COLOR */ +#define XTERM_COLOR_CHANGE /* Disable automatic de-iconify on bell altogether */ /* #define NO_MAPALERT */ diff --git a/src/screen.c b/src/screen.c index e9620a6..27b0b06 100644 --- a/src/screen.c +++ b/src/screen.c @@ -9,16 +9,19 @@ static const char cvs_ident[] = "$Id$"; #include "feature.h" /* includes */ +#include #ifdef HAVE_SYS_TIME_H # include #endif #include +#include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_SYS_IOCTL_H # include #endif +#include #include #include /* CARD32 */ @@ -2009,7 +2012,7 @@ scr_refresh(int type) * Actually do the drawing of the string here */ if (fprop) { - if (rvid) { + if (back != bgColor) { SWAP_IT(gcvalue.foreground, gcvalue.background, ltmp); gcmask |= (GCForeground | GCBackground); XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue); @@ -2242,6 +2245,43 @@ scr_dump(void) } } +/* Dump the entire contents of the scrollback buffer to a file */ +void +scr_dump_to_file(const char *fname) +{ + int outfd; + char *buff, *src, *dest; + unsigned long row, col, rows, cols; + + REQUIRE(fname != NULL); + + rows = TermWin.nrow + TermWin.saveLines; + cols = TermWin.ncol; + D_SCREEN(("Dumping to file \"%s\". %d rows, %d cols\n", fname, rows, cols)); + + /* Remove it if it's there. If this fails, we don't + care, because open() will do the right thing. */ + unlink(fname); + + /* Only open if it's a new file, and open with permissions 0600 */ + outfd = open(fname, O_CREAT | O_EXCL | O_NDELAY | O_WRONLY, S_IRUSR | S_IWUSR); + if (outfd < 0) { + D_SCREEN(("Unable to open \"%s\" for writing -- %s\n", fname, strerror(errno))); + return; + } + buff = MALLOC(cols + 1); + for (row = 0; row < rows; row++) { + if (screen.text[row]) { + for (src = screen.text[row], dest = buff, col = 0; col < cols; col++) *dest++ = *src++; + *dest++ = '\n'; + *dest = 0; + write(outfd, buff, dest - buff); + } + } + close(outfd); + FREE(buff); +} + /* ------------------------------------------------------------------------- * * CHARACTER SELECTION * diff --git a/src/screen.h b/src/screen.h index 3016ac0..400d94d 100644 --- a/src/screen.h +++ b/src/screen.h @@ -264,6 +264,7 @@ extern void scr_refresh(int); extern int scr_strmatch(unsigned long, unsigned long, const char *); extern void scr_search_scrollback(char *); extern void scr_dump(void); +extern void scr_dump_to_file(const char *); extern void selection_check(void); extern void PasteIt(unsigned char *, unsigned int); extern void selection_paste(Window, unsigned, int); diff --git a/src/term.c b/src/term.c index 9a23426..fd8733f 100644 --- a/src/term.c +++ b/src/term.c @@ -2082,16 +2082,23 @@ xterm_seq(int op, const char *str) set_window_color(bgColor, str); #endif break; + case XTerm_DumpScreen: + nstr = (char *) strsep(&tnstr, ";"); + if (nstr && *nstr) { + scr_dump_to_file(nstr); + } + break; case XTerm_logfile: + nstr = (char *) strsep(&tnstr, ";"); + if (nstr && *nstr && BOOL_OPT_ISTRUE(nstr)) { + /* Logging on */ + } else { + /* Logging off */ + } break; case XTerm_font: change_font(0, str); break; -#ifdef ETERM_COMMAND_MODE - case ETerm_command_mode: - fprintf(stderr, "ETerm_command_mode\n"); - break; -#endif default: D_CMD(("Unsupported xterm escape sequence operator: 0x%02x\n", op)); break; diff --git a/src/term.h b/src/term.h index bbcfb16..07e4939 100644 --- a/src/term.h +++ b/src/term.h @@ -73,6 +73,7 @@ # define XTerm_EtermSeq 6 /* Eterm proprietary escape sequences */ # define XTerm_EtermIPC 7 /* Eterm escape code/text IPC interface */ # define XTerm_Pixmap 20 /* new bg pixmap */ +# define XTerm_DumpScreen 30 /* Dump contents of scrollback to a file */ # define XTerm_restoreFG 39 /* change default fg color */ # define XTerm_restoreBG 49 /* change default bg color */ diff --git a/utils/Ettable.c b/utils/Ettable.c index a382a5f..3aff3d0 100644 --- a/utils/Ettable.c +++ b/utils/Ettable.c @@ -51,5 +51,15 @@ main(void) printf("| '%c' | %3d | 0x%02x | %c%03o |\n", (i == 127 ? ' ' : i), i, i, (i > '\077' ? '0' : ' '), i); } printf("+-----------+---------+-------------+--------+\n"); + + printf("+---------------+---------+-------------+-------+\n"); + printf("| ACS Character | Decimal | Hexadecimal | Octal |\n"); + printf("+---------------+---------+-------------+-------+\n"); + printf("\033)0"); + + for (i = 1; i < 32; i++) { + printf("| \016%c\017 (%c) | %3d | 0x%02x | %03o |\n", i + 0x5e, i + 0x5e, i, i, i); + } + printf("+---------------+---------+-------------+-------+\n"); return 0; }