Copyright 1997,1998 by Thomas E. Dickey

Contents

This file contains a list of the changes that I have made for XFree86 xterm, from the notes that I add when submitting a patch.

You should note that other changes have been made as well, by other people, to fix bugs and correct ifdef's for portability. All of these are summarized in the XFree86 CHANGELOG (found in the unbundled tree, xc/programs/Xserver/hw/xfree86).

Patch #68 - 1998/3/4 - XFree86 3.9Ad and 3.3.1z

This corrects another problem with the logic for highlightColor resource. As reported by David Dawes:
I've just noticed a problem with with the "inverse" control sequence (ESC[7m) with the 3.3.2 xterm. What it does is sets the background black, and the text the usual foreground colour rather than simply swapping the foreground/background.
This appears to be because when I added logic to check that the highlightColor was distinct from foreground and background colors, I did not add a further check to see that it was not black (I would make an explicit check for the resource not being set, but see nothing definite in the headers that would let me reference an explicitly-undefined Pixel value, though there are some implications in xpm.h). But this should work.

Patch #67 - 1998/2/23 - XFree86 3.9Ad and 3.3.1e

This patch does the following:

Patch #66 - 1998/2/16 - XFree86 3.9Ad and 3.3.1d

This fixes the problem reported with failure to build the resize program (BSDI, OSF/1) due to not having <termcap.h>, by changing the ifdef to one that would be set only if the file exists (not currently specified, except by the standalone configure script). We do not really need to include <termcap.h> to build, but only for a clean compile, since it may declare the tgetent() prototype. I also updated the man-page for resize, since I had recently noticed that it can be used to resize xterm using the "Sun" control sequences option.

Patch #65 - 1998/2/14 - XFree86 3.9Ad and 3.3.1c

This is a small patch to xterm's 8-bit terminal description. I noticed while testing ncurses that I had specified the wrong (VT100-style) codes for the F1-F4. Xterm only uses VT220-style function keys in 8-bit mode.

Patch #64 - 1998/2/8 - XFree86 3.9Ad

This fixes the following problems with xterm:

Patch #63 - 1998/2/5 - XFree86 3.9Ad

This is another patch from Bjorn Helgaas <helgaas@rsn.hp.com>, which I've reviewed (and learned some). Following are his notes:

I poked around some more and finally got xterm-62 to build and run cleanly on HP-UX 10.20. Here are the patches. They look sort of ugly, so here's a little explanation:

The problem on HP-UX was that we were linking with -lcurses rather than -ltermcap due to the second bullet above, and apparently something in HP-UX curses is broken. This seems very strange, because the only thing used is tgetent, which should affect any tty/pty configuration, but I lost interest in tracking down the exact problem.

Patch #62 - 1998/1/23 - XFree86 3.9Ac

This is a patch mostly by Bjorn Helgaas <helgaas@dhc.net> (I added the os2main.c change, and a little of the documentation). From Bjorn's description:

Patch #61 - 1998/1/17 - XFree86 3.9Ac

This patch modifies the reset behavior of xterm slightly:

Patch #60 - 1998/1/10 - XFree86 3.9Ab

This fixes some minor bugs and adds new functionality:

Patch #59 - 1998/1/5 - XFree86 3.9Ab

My last patch has an off-by-one error in the comparison for argc. Douglas Kosovic <douglask@dstc.edu.au> showed me where (he got a core dump). Also, I think this explains Clint Olsen's problem, but the symptoms were more subtle (EINVAL for a system call if the -display option is omitted).

Patch #58 - 1998/1/3 - XFree86 3.9Ab

This patch does the following:

Patch #57 - 1997/12/26 - XFree86 3.9Aa

This patch is mostly concerned with the standalone configure script; a few minor corrections are added:

Patch #56 - 1997/11/28 - XFree86 3.9x

This patch is based on analysis by Arfst Ludwig <arfst@luxor.IN-Berlin.DE>, who reported:

Setting the following resources xterm (all current versions) receives a segmentation fault on <Btn2Up> after scrolling:

	  *XTerm*VT100*translations:    #override \
	      ~Shift~Ctrl<Btn2Up>: insert-selection(PRIMARY, CUT_BUFFER0)\n\
	      Shift~Ctrl<Btn2Up>:  insert-selection(CLIPBOARD, CUT_BUFFER1)\n\
	      ~Shift<BtnUp>:       select-end(PRIMARY, CUT_BUFFER0)\n\
	      Shift<BtnUp>:        select-end(CLIPBOARD, CUT_BUFFER1)
(The above resources intention is to be able to paste the latest selection even if the xterm was cleared.)

And here is how it works (and a fix!): The widget given to the action handler as first argument is not guaranteed to be a XtermWidget (it can be the ScrollbarWidget). Instead of accessing the widget's member directly XtDisplay gives the required pointer in a safe way.

I noticed that this was not the only instance (by reading the code, and testing with his example), and extended the solution to check the widget-class to ensure that it is indeed xterm's widget class before attempting to use it in the context of translations.

Patch #55 - 1997/11/25 - XFree86 3.9x

This fixes the segmentation violation noted by Rogier Wolff about a month ago. He'd set xterm to 400 (rows) by 150 columns, which broke because there were limited buffers (200 rows) used for juggling data when adding or deleting lines and for switching between alternate and normal screens. I replaced this by an allocated buffer.

The bug is simple to test if you set titeInhibit false.

Patch #54 - 1997/10/17 - XFree86 3.9s

This patch does the following:

Patch #53 - 1997/10/12 - XFree86 3.9r

This patch adds a fix and implements a new feature (as well as some minor typos):

Patch #52 - 1997/9/29 - XFree86 3.9q

This patch addresses bugs and requests reported by Some of the changes are interrelated (it was an unusually busy week).

Patch #51 - 1997/9/15 - XFree86 3.9p

Most of this patch is related to the standalone configure script, though there are fixes/enhancements as well: I've tested the configure script on Linux, SunOS 4.1.3, Solaris 2.5.1, IRIX 5.2 and 6.2, AIX 3.2.5 and CLIX 3.1 (all but the last run properly as well).

Patch #50 - 1997/8/22 - XFree86 3.9m

This is a collection of small fixes, and a couple of minor enhancements:

Patch #49 - 1997/8/10 - XFree86 3.9k

This patch implements the VT100/VT220 Media Copy (i.e., print-screen) control sequences.

Patch #48 - 1997/7/26 - XFree86 3.9j

This patch does the following (all but the first affect only the standalone configure script):

Patch #47 - 1997/7/13 - XFree86 3.9i

This patch does the following

Patch #46 - 1997/7/4 - XFree86 3.9h

This is a patch to provide test-support for some work I'm doing on ncurses. It does not modify the normal configuration of xterm; the code is compiled if the standalone configure option "--enable-xmc-glitch" is specified.

Patch #45 - 1997/7/2 - XFree86 3.9h

This fixes the problem reported with xterm's cursor color versus the background (the second chunk in this patch) and also removes some duplicate initialization of the cursor GC's. If the cursor color at startup is the same as the background, then xterm will use the reverse GC, ignoring the setting of the colorMode resource.

Patch #44 - 1997/6/22 - XFree86 3.9g

This implements the first part of the VT100 doublesize characters for xterm, as well as fixing a handful of bugs:

Patch #43 - 1997/6/10 - XFree86 3.9d

Here's a fix for two problems:

Patch #42 - 1997/6/8 - XFree86 3.2Xl

Bram Moolenaar reported that the cursor color changed unexpectedly while scrolling. The cause was that it used the same GC's as the logic that draws the ANSI colors. The bug only appears if the cursorColor resource isn't set, and has been present since the initial implementation early last year. (The same bug also appears in rxvt ;-). Here's a fix.

Patch #41 - 1997/5/28 - XFree86 3.2Xl

Some nits found by Darren Hiebert (missing part of install-rule, incorrect assignment for --enable-color-mode option).

Patch #40 - 1997/5/26 - XFree86 3.2Xl

Patch for the configure script's logic for obtaining imake predefined symbols.

Patch #39 - 1997/5/24 - XFree86 3.2Xl

This patch does the following: (both changes also modify the configure script)

Patch #38 - 1997/5/22 - XFree86 3.2Xh

This implements a simple configuration script with autoconf (to which I'll add more options later). It does the following: It does not make tests for the things that imake does (that's another project), instead it uses a hybrid of the autoconf tests for libraries and adds imake's compiler options (which are necessary in some cases to get main.c to compile).

Patch #37 - 1997/5/7 - XFree86 3.9a

This corrects a minor, but annoying error in the vt220 emulation: the DECUDK is only supposed to be interpreted for _shifted_ function keys.

Patch #36 - 1997/1/16 - XFree86 3.2r

This corrects something that I overlooked in patch #27 (21-aug-1996), which is that when trimming the region to be repainted for the highlightSelection resource of xterm, I still have to paint the background past the highlighted region. This only happens when I first do a selection in a window that's partly off-screen, then move the window on-screen.

Patch #35 - 1997/1/7 - XFree86 3.2o

This patch does the following:

Patch #34 - 1997/1/5 - XFree86 3.2o

This patch does the following: I got the description of DECSTR from a vt420 user's manual. I'll do some testing with vttest to ensure that there's nothing else to do than what was documented.

Patch #33 - 1996/11/24 - XFree86 3.2

This adds to the reset-fix by Matthieu Herrb <Mathieu.Herrb@mipnet.fr> a small change to make xterm able to output 8-bit characters in VT100 mode. Applications that run on real VT100's don't do that anyway, and this feature should be removed sometime after finishing off the VT220 emulation (VT220's can do 8-bit characters). That would be a good time to change the default terminal-id to 220.

Patch #32 - 1996/11/21 - XFree86 3.2

This implements the REP (repeat) control for xterm. That isn't part of the DEC VTxxx series, but is defined in ISO 6429. (Note that the base xterm terminal description is not changed -- I added a variant, "xterm-rep").

Patch #31 - 1996/11/16 - XFree86 3.2

This implements vt52 emulation in xterm (ifdef'd so it can be removed). I've been using it for testing for the past month or so.

Patch #30 - 1996/11/16 - XFree86 3.2

From bug-report by <auroux@clipper.ens.fr> (Denis Auroux), missing reset to ground state. I checked through the rest of that table and found another, in the unimplemented MC (screen print).

Patch #29 - 1996/9/15 - XFree86 3.1.2Gb

This patch does the following: All of these changes are based on vttest 2.6

(Most of the volume in the patch is to add 2 more state tables for parsing the 2nd/3rd device-attribute controls).

Patch #28 - 1996/8/31 - XFree86 3.1.2F

This patch corrects the following reported by Roland Rosenfeld <roland@spinnaker.rhein.de>: Roland also complained that he couldn't use box characters with
	-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1
but that's a known xterm limitation (the box characters must be part of the font, in the first 32 locations).

Patch #27 - 1996/8/21 - XFree86 3.1.2Ek

This patch fixes one of my long-term gripes: xterm's selection doesn't clearly show what's being selected (as per David's request, it's controlled by a resource, which defaults to the older behavior).

Patch #26 - 1996/8/20 - XFree86 3.1.2Ei

Here's a patch to fix a problem with xterm's cut/paste and another to modify the appearance of the highlighting while selecting. (The changes are independent, so you can see if the change to screen.c is desirable).

Patch #25 - 1996/8/18 - XFree86 3.1.2Ei

Here's a correction for two minor bugs that I picked up in testing, plus some lint (from Solaris 2.5) where NULL was used incorrectly:

Patch #24 - 1996/8/11 - XFree86 3.1.2Ee

This patch does several things. In effect, xterm can (I think) do a reasonably good job of emulating vt220 and vt320 terminals (as well as it was doing vt100, at any rate ;-).

It does NOT do:

Anyway, I:

I'll be continuing to test this patch for a while, but don't expect to add any new functionality (it passes all of the current tests I've built in vttest, but I need to make more tests)..

Patch #23 - 1996/7/31 - XFree86 3.1.2Ec

This removes the blinking cursor I added last week (for performance reasons). Time-permitting, I'll revisit this after 3.2 is released (there will be more work after XFree86 3.2, I assume).

Patch #22 - 1996/7/26 - XFree86 3.1.2Ec

I looked more closely at my "double-negative" and realized that I had been confused by the default color scheme (black on white) in combination with reverse video. However, I did see that the original_fg and original_bg data weren't really used - so I removed that logic.

Also:

Patch #21 - 1996/7/24 - XFree86 3.1.2Ec

This patch does the following:

Patch #20 - 1996/7/24 - XFree86 3.1.2Ec

This documents the changes in control sequences for window operations that I added in my previous patch. I'm testing another patch that allows the user to use less memory if colors aren't needed.

Patch #19 - 1996/7/21 - XFree86 3.1.2Ec

This patch does the following:

Patch #18 - 1996/7/18 - XFree86 3.1.2Ec

This implements the following:

Patch #17 - 1996/7/2 - XFree86 3.1.2Eb

This patch implements for xterm several minor features from ISO 6429 which are useful for terminfo applications. The HPA and VPA control sequences allow cursor movement along a row or column, cutting down a little on the characters transmitted. The other codes allow resetting specific graphic rendition attributes without modifying the other attributes. (now if someone just had time to implement blinking cursors...)

Patch #16 - 1996/6/25 - XFree86 3.1.2Ea

Adam Tla/lka <atlka@pg.gda.pl> told me a couple of weeks ago that I'd missed some of the background coloring in xterm. I investigated, and found that while I'd picked up on the clear-to-bottom and clear-to-end-of-line operations, I'd overlooked the insert/delete lines. Just so I wouldn't overlook any more of these, I updated a copy of vttest to test ISO colors and bce (background color erase). This patch introduces a new function, ClearCurBackground, whose calls replace the direct XClearArea calls that I'd overlooked. (There's also a few compiler warnings fixed, etc ;-)

Patch #15 - 1996/5/29 - XFree86 3.1.2E

This fixes the problem reported by David Dawes, by making the 50msec select timeout for the Xaw3d arrow scrollbar a resource. (I made it a boolean for a variety of reasons -- to make it a number, you'd need an additional resource, to avoid breaking the logic).

Patch #14 - 1996/5/12 - XFree86 3.1.2Dj

This patch brings the termcap and terminfo descriptions for xterm up to date. I made the following changes:

Patch #13 - 1996/4/23 - XFree86 3.1.2Df

This corrects my earlier changes for colors - the inner border of the xterm was getting painted with the wrong color, since I'd moved the call to set the background into the logic that tracks SGR information.

Patch #12 - 1996/3/16 - XFree86 3.1.2Dc

This corrects a memory leak in xterm that happens whenever one switches fonts.

Patch #11 - 1996/3/5 - XFree86 3.1.2Db

This patch corrects the behavior of the ANSI colors in xterm when reverse video is used, as well as some other lesser sins:

Patch #10 - 1996/2/14 - XFree86 3.1.2Cd

I observed an occasional glitch in the xterm's color behavior; a clear to end of line would get a color that had been used in a program that supposedly reset colors. I traced this down to the way xterm was modifying colors of GC's on the fly; it didn't restore the original color of the GC, even though it would later be used in functions (such as ClearRight) that assumed (my error) that the GC would have the current foreground or background color.

I fixed this by resetting the GC's colors with a new function 'resetXtermGC()', and direct calls on SGR_Foreground/SGR_Background, as appropriate and using a new function 'updatedXtermGC()' to encapsulate the logic that modifies the GC's color. (I also removed some commented-out code that was trying to do this -- the problem was a little more obscure).

Patch #9 - 1996/2/10 - XFree86 3.1.2Cb

This patch fixes the remaining problems that I had making xterm run with x11r5, as well as a couple of other bugs. It follows my patch from yesterday, that added ifdef's for some of the input-method resources.

Patch #8 - 1996/2/9 - XFree86 3.1.2Cb

This is mostly a documentation patch for xterm. It describes the color control sequences in more detail, and documents some other features of xterm that aren't described elsewhere.

I've also added a couple of ifdef's to fix (part of) the problem that I'm working on (making the program work properly on x11r5, where I'm doing memory testing -- I have a "good" version from mid-January, but my resync version doesn't work properly on x11r5). I'm not done with that yet.

Patch #7 - 1996/1/28 - XFree86 3.1.2n

I did a (clean) build of 3.1.2n on Linux 1.2.13 (ELF). I've got an S3 card.

This fixes the following in the 3.1.2n xterm:

I built this version (with a minor nit that I'll patch soon) on SunOS 4.1.3 so that I can test it some more with Purify.

btw: the changes made in Xpoll.h won't work on some older systems, because fd_set isn't a defined type (I've got one machine at least that this applies to).

Patch #6 - 1996/1/8

This patch does all of the SGR foreground/background fixes (i.e., clearing the screen after an SGR color is set causes that color to be used in the foreground and/or background). If the FG_COLOR and/or BG_COLOR flags aren't set, then the xterm foreground and background default to the window's values. This usage is consistent with various types of hardware (especially the IBM PC), and is also used in rxvt.

Patch #5 - 1996/1/7

This patch modifies the object code, by replacing indexing expressions with temporary variables with the full indexing expression. At first glance, this seems inefficient (it did to me ;-), until remembering comments made in the compilers newsgroups that trying to "help" the compiler doesn't really work that well. A good optimizing compiler can do a better job than the programmer can. (There's a moral in the use of 'register' variables also, but I won't fix those...).

Anyway, the revised code generates a smaller object...

Patch #4 - 1996/1/7

When setting up for this phase, I saw that you'd corrected the bug that I found in ClearLeft. I decided to make this series of patches anyway, since readability never hurt (and there's the potential for finding another bug while reviewing this set).

Patch #3 - 1996/1/7

This is my third (and final cleanup) patch for xterm. It gets rid of the unused stuff, and converts several functions to static (thereby reducing their scope).

At this point, the only compile warnings I've got (on Linux) are those about the select arguments (int vs fd_set type), and a missing declaration for waitpid. Those both are hard to get right without autoconfigure.

The next patches will address the functional changes...

Patch #2 - 1996/1/7

This is my second patch to xterm. It corrects most of the gcc warnings (except for some that are due to X header files ;-). I compared objects to keep track of the changes that don't affect the object code (n/c) versus those that do.

At this point, I'm compiling (fairly) clean with gcc options

	-Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wnested-externs
(I also compiled with -Wshadow, but while that found some things that I wanted to find, there's far too many warnings from the X headers to be usable in this context).

The changes:

Patch #1 - 1996/1/6

This is my first cleanup patch for xterm. It addresses all of the gcc warnings for -Wall, -Wmissing-prototypes and -Wstrict-prototypes that I can change without modifying the object code. (I'm compiling this with gcc 2.7.0 for an aout target, which makes it simple to compare objects. When I do ELF-only, I've got a tool that compares that sort of thing as well).

Briefly, this patch adds (and uses) two header files in the xterm directory:

	proto.h
	xterm.h
I expect this to be the biggest patch by far. However (barring a misplaced prototype), it shouldn't break anything, since the intent of the patch is to provide missing declarations.