XFree86 3.9Ad - xterm patch #64 - 1998/2/7 - T.Dickey This fixes the following problems with xterm: + save/restore the ANSI foreground and background colors with the other visible attributes in the save-cursor and restore-cursor operations. This works around a problem with vim, which apparently assumed that switching between the normal and alternate screens resets the colors (reported by Jim Battle ). It would be nice to implement save/restore cursor as a stack (and solve this type of problem completely), but that would lead to incompatibly with applications which assume they are running with a VT100 or VT220. + corrects behavior of a restore-cursor operation which does not follow a save-cursor (it is supposed to set the character sets to a known initial state). + extends the sunKeyboard resource (and menu toggle) to modify the home, end and delete keys on a Sun or PC editing keypad, making them generate codes compatible with DEC VT220's Find, Select and Remove keys. + corrects a length in checking command-line options, which caused the "-help" message to not work when X was not running. + adds some detail to the man-page (requested by Jason Bacon ) + modify the standalone configure script to ignore the broken nsl and socket libraries on IRIX 6.2 (the ones on 5.2 also are broken, so this change just widens the check for the system version number). -------------------------------------------------------------------------------- aclocal.m4 | 4 +++- charproc.c | 10 +++++----- configure | 2 +- cursor.c | 39 +++++++++++++++++++++++++++++++++------ input.c | 19 +++++++++++++++++++ main.c | 2 +- os2main.c | 2 +- ptyx.h | 28 +++++++++++++++++----------- util.c | 2 +- version.h | 2 +- xterm.h | 1 + xterm.man | 21 +++++++++++++++++---- 12 files changed, 100 insertions, 32 deletions -------------------------------------------------------------------------------- Index: aclocal.m4 --- xterm-63+/aclocal.m4 Mon Jan 26 18:30:53 1998 +++ xterm-64/aclocal.m4 Fri Feb 6 19:37:36 1998 @@ -568,7 +568,9 @@ SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -` cf_have_X_LIBS=no case $SYSTEM_NAME in -irix5*) ;; +changequote(,)dnl +irix[56]*) ;; +changequote([,])dnl clix*) # FIXME: modify the library lookup in autoconf to # allow _s.a suffix ahead of .a Index: charproc.c --- xterm-63+/charproc.c Sun Jan 25 09:19:53 1998 +++ xterm-64/charproc.c Fri Feb 6 06:40:59 1998 @@ -144,7 +144,6 @@ static void dpmodes PROTO((XtermWidget termw, void (*func)(unsigned *p, unsigned mask))); static void report_win_label PROTO((TScreen *screen, int code, XTextProperty *text, Status ok)); static void restoremodes PROTO((XtermWidget termw)); -static void resetCharsets PROTO((TScreen *screen)); static void savemodes PROTO((XtermWidget termw)); static void set_vt_box PROTO((TScreen *screen)); static void unparseputn PROTO((unsigned int n, int fd)); @@ -963,7 +962,7 @@ } #endif /* OPT_ISO_COLORS */ -static void resetCharsets(screen) +void resetCharsets(screen) TScreen *screen; { screen->gsets[0] = 'B'; /* ASCII_G */ @@ -3336,10 +3335,12 @@ if(screen->cursor_state) HideCursor(); + rows = screen->max_row + 1; SwitchBufPtrs(screen); TrackText(0, 0, 0, 0); /* remove any highlighting */ - if((top = -screen->topline) <= screen->max_row) { + + if((top = -screen->topline) < rows) { if(screen->scroll_amt) FlushScroll(screen); if(top == 0) @@ -3351,8 +3352,7 @@ (int) OriginX(screen), (int) top * FontHeight(screen) + screen->border, (unsigned) Width(screen), - (unsigned) (screen->max_row - top + 1) - * FontHeight(screen), + (unsigned) (rows - top) * FontHeight(screen), FALSE); } ScrnRefresh(screen, 0, 0, rows, screen->max_col + 1, False); Index: configure --- xterm-63+/configure Mon Jan 26 18:30:53 1998 +++ xterm-64/configure Fri Feb 6 19:37:41 1998 @@ -2020,7 +2020,7 @@ SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -` cf_have_X_LIBS=no case $SYSTEM_NAME in -irix5*) ;; +irix[56]*) ;; clix*) # FIXME: modify the library lookup in autoconf to # allow _s.a suffix ahead of .a Index: cursor.c --- xterm-63+/cursor.c Sun Jan 11 11:57:36 1998 +++ xterm-64/cursor.c Fri Feb 6 20:27:24 1998 @@ -236,15 +236,25 @@ { register TScreen *screen = &tw->screen; + sc->saved = True; sc->row = screen->cur_row; sc->col = screen->cur_col; sc->flags = tw->flags; sc->curgl = screen->curgl; sc->curgr = screen->curgr; +#if OPT_ISO_COLORS + sc->cur_foreground = tw->cur_foreground; + sc->cur_background = tw->cur_background; + sc->sgr_foreground = tw->sgr_foreground; +#endif memmove( sc->gsets, screen->gsets, sizeof(screen->gsets)); } -#define DECSC_FLAGS (BOLD|BLINK|INVERSE|UNDERLINE|ORIGIN|WRAPAROUND|PROTECTED) +/* + * We save/restore all visible attributes, plus wrapping, origin mode, and the + * selective erase attribute. + */ +#define DECSC_FLAGS (ATTRIBUTES|ORIGIN|WRAPAROUND|PROTECTED) /* * Restore Cursor and Attributes @@ -256,13 +266,30 @@ { register TScreen *screen = &tw->screen; - memmove( screen->gsets, sc->gsets, sizeof(screen->gsets)); - screen->curgl = sc->curgl; - screen->curgr = sc->curgr; + /* Restore the character sets, unless we never did a save-cursor op. + * In that case, we'll reset the character sets. + */ + if (sc->saved) { + memmove( screen->gsets, sc->gsets, sizeof(screen->gsets)); + screen->curgl = sc->curgl; + screen->curgr = sc->curgr; + } else { + resetCharsets(screen); + } + tw->flags &= ~DECSC_FLAGS; tw->flags |= sc->flags & DECSC_FLAGS; - CursorSet (screen, (tw->flags & ORIGIN) ? sc->row - screen->top_marg - : sc->row, sc->col, tw->flags); + CursorSet (screen, + (tw->flags & ORIGIN) + ? sc->row - screen->top_marg + : sc->row, + sc->col, tw->flags); + +#if OPT_ISO_COLORS + tw->sgr_foreground = sc->sgr_foreground; + SGR_Foreground(tw->flags & FG_COLOR ? sc->cur_foreground : -1); + SGR_Background(tw->flags & BG_COLOR ? sc->cur_background : -1); +#endif } /* Index: input.c --- xterm-63+/input.c Mon Dec 29 12:22:34 1997 +++ xterm-64/input.c Thu Feb 5 21:03:19 1998 @@ -143,6 +143,25 @@ reply.a_type = ESC; \ }) +#if OPT_SUNPC_KBD + /* make an DEC editing-keypad from a Sun or PC editing-keypad */ + if (sunKeyboard) { + switch (keysym) { + case XK_Delete: +#ifdef DXK_Remove + keysym = DXK_Remove; +#endif + break; + case XK_Home: + keysym = XK_Find; + break; + case XK_End: + keysym = XK_Select; + break; + } + } +#endif + if (IsPFKey(keysym)) { reply.a_type = SS3; reply.a_final = keysym-XK_KP_F1+'P'; Index: main.c --- xterm-63+/main.c Sun Jan 25 09:19:53 1998 +++ xterm-64/main.c Sun Feb 8 06:09:58 1998 @@ -1117,7 +1117,7 @@ if (argc > 1) { if (!strncmp(argv[1], "-v", 2)) Version(); - if (!strncmp(argv[1], "-h", 2) && strncmp(argv[1], "-hc", 2)) + if (!strncmp(argv[1], "-h", 2) && strncmp(argv[1], "-hc", 3)) Help(); } Index: os2main.c --- xterm-63+/os2main.c Sun Jan 25 09:19:53 1998 +++ xterm-64/os2main.c Sun Feb 8 06:09:54 1998 @@ -774,7 +774,7 @@ if (argc > 1) { if (!strncmp(argv[1], "-v", 2)) Version(); - if (!strncmp(argv[1], "-h", 2) && strncmp(argv[1], "-hc", 2)) + if (!strncmp(argv[1], "-h", 2) && strncmp(argv[1], "-hc", 3)) Help(); } Index: ptyx.h --- xterm-63+/ptyx.h Sun Jan 25 09:19:53 1998 +++ xterm-64/ptyx.h Fri Feb 6 19:27:19 1998 @@ -210,15 +210,6 @@ char a_nastyf; /* Error flag */ } ANSI; -typedef struct { - int row; - int col; - unsigned flags; /* Vt100 saves graphics rendition. Ugh! */ - char curgl; - char curgr; - char gsets[4]; -} SavedCursor; - #define TEK_FONT_LARGE 0 #define TEK_FONT_2 1 #define TEK_FONT_3 2 @@ -539,6 +530,21 @@ #define DoRM(code,value) value = screen->save_modes[code] typedef struct { + Boolean saved; + int row; + int col; + unsigned flags; /* VTxxx saves graphics rendition */ + char curgl; + char curgr; + char gsets[4]; +#if OPT_ISO_COLORS + int cur_foreground; /* current foreground color */ + int cur_background; /* current background color */ + int sgr_foreground; /* current SGR foreground color */ +#endif +} SavedCursor; + +typedef struct { /* These parameters apply to both windows */ Display *display; /* X display for screen */ int respond; /* socket for responses @@ -901,8 +907,8 @@ #define BOLD 0x04 #define BLINK 0x08 /* global flags (also character attributes) */ -#define BG_COLOR 0x10 /* true if background set */ -#define FG_COLOR 0x20 /* true if foreground set */ +#define BG_COLOR 0x10 /* true if background set */ +#define FG_COLOR 0x20 /* true if foreground set */ /* character flags (internal attributes) */ #define PROTECTED 0x40 /* a character is drawn that cannot be erased */ Index: util.c --- xterm-63+/util.c Sun Jan 25 09:19:53 1998 +++ xterm-64/util.c Thu Feb 5 20:20:22 1998 @@ -1400,7 +1400,7 @@ x, y, len * FontWidth(screen), FontHeight(screen)); while (len-- > 0) { - width = XTextWidth(fs, text, 1); + width = XTextWidth(fs, (char *)text, 1); adj = (FontWidth(screen) - width) / 2; (void)drawXtermText(screen, flags, gc, x + adj, y, chrset, text++, 1); x += FontWidth(screen); Index: version.h --- xterm-63+/version.h Sun Jan 25 09:19:53 1998 +++ xterm-64/version.h Sat Feb 7 08:42:36 1998 @@ -6,4 +6,4 @@ * version of xterm has been built. The number in parentheses is my patch * number (T.Dickey). */ -#define XTERM_VERSION "XFree86 3.9Ac(62)" +#define XTERM_VERSION "XFree86 3.9Ad(64)" Index: xterm.h --- xterm-63+/xterm.h Sun Jan 25 09:19:53 1998 +++ xterm-64/xterm.h Fri Feb 6 06:40:56 1998 @@ -71,6 +71,7 @@ extern void VTReset PROTO((int full, int saved)); extern void VTRun PROTO((void)); extern void dotext PROTO((TScreen *screen, int charset, Char *buf, Char *ptr)); +extern void resetCharsets PROTO((TScreen *screen)); extern void set_cursor_gcs PROTO((TScreen *screen)); extern void unparseputc PROTO((int c, int fd)); extern void unparseputc1 PROTO((int c, int fd)); Index: xterm.man --- xterm-63+/xterm.man Sun Jan 25 09:19:53 1998 +++ xterm-64/xterm.man Sun Feb 8 10:28:09 1998 @@ -35,7 +35,7 @@ [\-\fItoolkitoption\fP ...] [\-option ...] .SH DESCRIPTION The \fIxterm\fP program is a terminal emulator for the X Window System. -It provides DEC VT102 and Tektronix 4014 +It provides DEC VT102/VT220 (VTxxx) and Tektronix 4014 compatible terminals for programs that can't use the window system directly. If the underlying operating system supports terminal resizing capabilities (for example, the SIGWINCH signal in systems @@ -56,8 +56,10 @@ menu in the 4014 window. .SH EMULATIONS The VT102 emulation is fairly complete, but does not support -autorepeat or -the blinking character attribute. +autorepeat. +Double-size and blinking characters are partially implemented; +the emulation is functional but does not have the appearance of a real VT102. +The VT220 emulation does not support soft fonts, it is otherwise complete. .IR Termcap (5) entries that work with .I xterm @@ -65,6 +67,8 @@ .I xterm automatically searches the termcap file in this order for these entries and then sets the ``TERM'' and the ``TERMCAP'' environment variables. +You may also use ``vt220,'' but must set the terminal emulation level +with the \fBdecTerminalID\fP resource. .PP Many of the special .I xterm @@ -125,6 +129,14 @@ .PP In either VT102 or Tektronix mode, there are escape sequences to change the name of the windows. +Additionally, in VT102 mode, +\fIxterm\fP implements the window-manipulation control +sequences from \fIdtterm\fP, such as resizing the window, setting its location +on the screen. +.PP +.I Xterm +allows character-based applications to receive mouse events (currently +button-press and release events only) as keyboard control sequences. See \fIXterm Control Sequences\fP for details. .SH OPTIONS The \fIxterm\fP terminal emulator @@ -269,7 +281,7 @@ .TP 8 .B \-fi This option sets the font for active icons if that feature was compiled -in to xterm. +into xterm. .TP 8 .BI \-hc " color" This option specifies the color to use for the background of @@ -1968,6 +1980,7 @@ resize(1), X(1), pty(4), tty(4) .br \fIXterm Control Sequences\fP +(this is the file ctlseqs.ms). .SH BUGS .PP Large pastes do not work on some systems. This is not a bug in