Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!sri-spam!ames!sdcsvax!ucbvax!cs.brown.EDU!jb From: jb@cs.brown.EDU (Jim Bloom) Newsgroups: comp.windows.x Subject: bug in X.V10R4 version of xterm Message-ID: <8709102135.AA01600@archer.cs.brown.edu> Date: Thu, 10-Sep-87 17:35:26 EDT Article-I.D.: archer.8709102135.AA01600 Posted: Thu Sep 10 17:35:26 1987 Date-Received: Sat, 12-Sep-87 10:54:32 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 44 Xterm has some problems on an Encore. It seems to lose state whenever it scrolls backwards (usually seen in editors). After looking through the code I discovered that ScrnInsertLine() assumes that it is safe to do a bcopy() when the source and destination overlap. In this case, dest = src + off. If the trivial version of bcopy written in C is used, the bcopy yields bogus results. On most machines, a block move instruction is used. The VAX movc3 does this correctly, but other versions do not. To fix this problem, I have modified the code to not assume anything about overlapping data areas. Jim *** screen.c.old Thu Sep 10 17:17:08 1987 --- screen.c Thu Sep 10 17:17:08 1987 *************** *** 95,106 **** for (i = 2 * n - 1; i >= 0; i--) bzero ((char *) save [i], size); ! /* move down lines */ ! bcopy ((char *) &sb [2 * where], (char *) &sb [2 * (where + n)], 2 * sizeof (char *) * (last - where)); ! /* reuse storage for new lines at where */ ! bcopy ((char *)save, (char *) &sb[2 * where], 2 * sizeof(char *) * n); } --- 95,107 ---- for (i = 2 * n - 1; i >= 0; i--) bzero ((char *) save [i], size); ! /* Copy lines down into temporary storage */ ! bcopy ((char *) &sb [2 * where], (char *) &save [2 * n], 2 * sizeof (char *) * (last - where)); ! /* Copy everything back reusing saved storage */ ! bcopy ((char *)save, (char *) &sb[2 * where], ! 2 * sizeof (char *) * (n + last - where)); }