Thu Feb 17 15:13:20 PST 2000 Michael Jennings <mej@eterm.org>
Fixed a bug with background colors and proportional fonts. Also added an escape sequence, \e]30;<filename>\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. SVN revision: 2090
This commit is contained in:
parent
738565cd80
commit
98797354ac
|
@ -3188,3 +3188,12 @@ Wed Feb 16 14:58:51 PST 2000 Michael Jennings <mej@eterm.org>
|
|||
Fix the XIM input positioning to work with the buttonbar.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Thu Feb 17 15:13:20 PST 2000 Michael Jennings <mej@eterm.org>
|
||||
|
||||
Fixed a bug with background colors and proportional fonts. Also added
|
||||
an escape sequence, \e]30;<filename>\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.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
@ -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 */
|
||||
|
|
42
src/screen.c
42
src/screen.c
|
@ -9,16 +9,19 @@ static const char cvs_ident[] = "$Id$";
|
|||
#include "feature.h"
|
||||
|
||||
/* includes */
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xmd.h> /* 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 *
|
||||
|
|
|
@ -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);
|
||||
|
|
17
src/term.c
17
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;
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue