[comp.emacs] MicroEMACS 3.8l standout bugs

george@rebel.UUCP (George M. Sipe) (08/06/87)

The recently posted version of MicroEMACS (3.8l) does not include the
standout patches required for terminals with embedded attributes (which
require a display position for standout begin/end - e.g. most TVI, LSI,
Qume, etc. terminals and compatible).  I have re-integrated the patch
previously posted for release 3.8i for the 3.8l release.  Hopefully,
this patch will be in the 3.9 release.  If FIXSG is set (defined as set
when TERMCAP is set), then for terminal entries which have non-zero
'sg' attributes defined, the mode lines will be properly managed.

I have tested the patch on a variety of terminals without any
problems.  No problems were reported from the use of this patch in the
previous release.  The patch in context diff format appears below.
Note that before applying the patch, you may have to remove trailing
carriage returns which were in the 'arc' source files.

I am (still) working on (#definable) patches which will provide greater
GNU Emacs compatibility.  These patches will change the default key
bindings and function names.  They will also change the appearance of
the mode line and other cosmetic changes.  Further, I hope to have an
automated method of 'GNUifying' the documentation.  This is taking
longer to complete than I hoped, not because of any technical problems
but rather because I simply haven't had the time to work on them.

George M. Sipe,		Phone: (404) 662-1533
Tolerant Systems, 6961 Peachtree Industrial, Norcross, GA  30071
UUCP: ...!{decvax,hplabs,ihnp4,linus,rutgers,seismo}!gatech!rebel!george


*** display.c_orig	Wed Aug  5 17:01:54 1987
--- display.c	Wed Aug  5 17:03:14 1987
***************
*** 604,609
  	register int nbflag;	/* non-blanks to the right flag? */
  	int rev;		/* reverse video flag */
  	int req;		/* reverse video request flag */
  
  
  	/* set up pointers to virtual and physical lines */

--- 604,612 -----
  	register int nbflag;	/* non-blanks to the right flag? */
  	int rev;		/* reverse video flag */
  	int req;		/* reverse video request flag */
+ #if	TERMCAP & FIXSG & REVSTA
+ 	int sook;		/* standout ok flag */
+ #endif
  
  
  	/* set up pointers to virtual and physical lines */
***************
*** 636,642
  
  		/* scan through the line and dump it to the screen and
  		   the virtual screen array				*/
! 		cp3 = &vp1->v_text[term.t_ncol];
  		while (cp1 < cp3) {
  			TTputc(*cp1);
  			++ttcol;

--- 639,653 -----
  
  		/* scan through the line and dump it to the screen and
  		   the virtual screen array				*/
! #if	TERMCAP & FIXSG & REVSTA
! 		if (req && SG > 0) {		/* Skip over 'spaces' */
! 		    ttcol += SG;
! 		    cp1 += SG;
! 		    cp2 += SG;
! 		    cp3 = &vp1->v_text[term.t_ncol-SG];
! 		} else
! #endif
! 			cp3 = &vp1->v_text[term.t_ncol];
  		while (cp1 < cp3) {
  			TTputc(*cp1);
  			++ttcol;
***************
*** 683,688
  	cp3 = &vp1->v_text[term.t_ncol];
  	cp4 = &vp2->v_text[term.t_ncol];
  
  	while (cp3[-1] == cp4[-1]) {
  		--cp3;
  		--cp4;

--- 694,706 -----
  	cp3 = &vp1->v_text[term.t_ncol];
  	cp4 = &vp2->v_text[term.t_ncol];
  
+ #if	TERMCAP & FIXSG & REVSTA
+ 	if (req && SG > 0)			/* Adjust for 'spaces' */
+ 	    sook = (cp1 - &vp1->v_text[0]) > 0;
+ 	else
+ 	    sook = FALSE;
+ #endif
+ 
  	while (cp3[-1] == cp4[-1]) {
  		--cp3;
  		--cp4;
***************
*** 703,708
  
  	movecursor(row, cp1 - &vp1->v_text[0]);	/* Go to start of line. */
  #if	REVSTA
  	TTrev(rev);
  #endif
  

--- 721,729 -----
  
  	movecursor(row, cp1 - &vp1->v_text[0]);	/* Go to start of line. */
  #if	REVSTA
+ #if	TERMCAP & FIXSG
+ 	if (!sook) TTrev(rev);
+ #else
  	TTrev(rev);
  #endif
  #endif
***************
*** 705,710
  #if	REVSTA
  	TTrev(rev);
  #endif
  
  	while (cp1 != cp5) {		/* Ordinary. */
  		TTputc(*cp1);

--- 726,732 -----
  #else
  	TTrev(rev);
  #endif
+ #endif
  
  	while (cp1 != cp5) {		/* Ordinary. */
  		TTputc(*cp1);
***************
*** 718,723
  			*cp2++ = *cp1++;
  	}
  #if	REVSTA
  	TTrev(FALSE);
  #endif
  	vp1->v_flag &= ~VFCHG;		/* flag this line as updated */

--- 740,748 -----
  			*cp2++ = *cp1++;
  	}
  #if	REVSTA
+ #if	TERMCAP & FIXSG
+ 	if (!sook) TTrev(FALSE);
+ #else
  	TTrev(FALSE);
  #endif
  #endif
***************
*** 720,725
  #if	REVSTA
  	TTrev(FALSE);
  #endif
  	vp1->v_flag &= ~VFCHG;		/* flag this line as updated */
  	return(TRUE);
  #endif

--- 745,751 -----
  #else
  	TTrev(FALSE);
  #endif
+ #endif
  	vp1->v_flag &= ~VFCHG;		/* flag this line as updated */
  	return(TRUE);
  #endif
***************
*** 761,766
  #endif
  		lchar = '-';
  
      vtputc(lchar);
      bp = wp->w_bufp;
  

--- 787,796 -----
  #endif
  		lchar = '-';
  
+ #if	TERMCAP & FIXSG & REVSTA
+     if (revexist && SG > 0)			/* Initial spaces. */
+ 	for (i = 0; i < SG; ++i) vtputc(' ');
+ #endif
      vtputc(lchar);
      bp = wp->w_bufp;
  
***************
*** 848,853
          ++n;
          }
  
      while (n < term.t_ncol)             /* Pad to full width. */
          {
          vtputc(lchar);

--- 878,887 -----
          ++n;
          }
  
+ #if	TERMCAP & FIXSG & REVSTA
+     if (revexist && SG > 0)		/* Adjust for standouts. */
+ 	n += SG * 3;
+ #endif
      while (n < term.t_ncol)             /* Pad to full width. */
          {
          vtputc(lchar);
***************
*** 853,858
          vtputc(lchar);
          ++n;
          }
  }
  
  upmode()	/* update all the mode lines */

--- 887,901 -----
          vtputc(lchar);
          ++n;
          }
+ #if	TERMCAP & FIXSG & REVSTA
+ /* The 'so' position will show as a reverse space, while the 'se'
+    position will be a normal space.  To balance the (visible)
+    reverse spaces at each end of the mode line, twice as many
+    spaces must exist at the end than do at the beginning.
+ */
+     if (revexist && SG > 0)		/* Trailing spaces. */
+ 	for (i = 0; i < SG * 2; ++i) vtputc(' ');
+ #endif
  }
  
  upmode()	/* update all the mode lines */
*** edef.h_orig	Wed Aug  5 17:01:55 1987
--- edef.h	Wed Aug  5 17:03:24 1987
***************
*** 112,117
  char	tap[NPAT];			/* Reversed pattern array.	*/
  char	rpat[NPAT];			/* replacement pattern		*/
  
  /* The variable matchlen holds the length of the matched
   * string - used by the replace functions.
   * The variable patmatch holds the string that satisfies

--- 112,121 -----
  char	tap[NPAT];			/* Reversed pattern array.	*/
  char	rpat[NPAT];			/* replacement pattern		*/
  
+ #if	FIXSG & REVSTA
+ int	SG;				/* number of standout glitches	*/
+ #endif
+ 
  /* The variable matchlen holds the length of the matched
   * string - used by the replace functions.
   * The variable patmatch holds the string that satisfies
***************
*** 223,228
  extern	char    pat[];                  /* Search pattern		*/
  extern	char	tap[];			/* Reversed pattern array.	*/
  extern	char	rpat[];			/* replacement pattern		*/
  
  extern	unsigned int	matchlen;	/* length of found string	*/
  extern	unsigned int	mlenold;	/* previous length of found str	*/

--- 227,236 -----
  extern	char    pat[];                  /* Search pattern		*/
  extern	char	tap[];			/* Reversed pattern array.	*/
  extern	char	rpat[];			/* replacement pattern		*/
+ 
+ #if	FIXSG & REVSTA
+ extern	int	SG;			/* number of standout glitches	*/
+ #endif
  
  extern	unsigned int	matchlen;	/* length of found string	*/
  extern	unsigned int	mlenold;	/* previous length of found str	*/
*** estruct.h_orig	Wed Aug  5 17:01:57 1987
--- estruct.h	Wed Aug  5 17:03:32 1987
***************
*** 69,74
  #define VT100   0                       /* Handle VT100 style keypad.   */
  #define RAINBOW 0                       /* Use Rainbow fast video.      */
  #define TERMCAP 1                       /* Use TERMCAP                  */
  #define	IBMPC	0			/* IBM-PC CGA/MONO/EGA driver	*/
  #define	DG10	0			/* Data General system/10	*/
  #define	TIPC	0			/* TI Profesional PC driver	*/

--- 69,75 -----
  #define VT100   0                       /* Handle VT100 style keypad.   */
  #define RAINBOW 0                       /* Use Rainbow fast video.      */
  #define TERMCAP 1                       /* Use TERMCAP                  */
+ #define	FIXSG	TERMCAP			/* Fix stand-out glitch		*/
  #define	IBMPC	0			/* IBM-PC CGA/MONO/EGA driver	*/
  #define	DG10	0			/* Data General system/10	*/
  #define	TIPC	0			/* TI Profesional PC driver	*/
*** tcap.c_orig	Wed Aug  5 17:01:58 1987
--- tcap.c	Wed Aug  5 17:03:38 1987
***************
*** 117,122
  	SO = tgetstr("so", &p);
  	if (SO != NULL)
  		revexist = TRUE;
  
          if(CL == NULL || CM == NULL || UP == NULL)
          {

--- 117,125 -----
  	SO = tgetstr("so", &p);
  	if (SO != NULL)
  		revexist = TRUE;
+ #if	FIXSG & REVSTA
+ 	SG = tgetnum("sg");	/* standout glitch 	*/
+ #endif
  
          if(CL == NULL || CM == NULL || UP == NULL)
          {
***************
*** 167,173
  int state;		/* FALSE = normal video, TRUE = reverse video */
  
  {
! 	static int revstate = FALSE;
  	if (state) {
  		if (SO != NULL)
  			putpad(SO);

--- 170,178 -----
  int state;		/* FALSE = normal video, TRUE = reverse video */
  
  {
! 	static int oldstate = TRUE + TRUE;
! 	if (state == oldstate) return;
! 	oldstate = state;
  	if (state) {
  		if (SO != NULL)
  			putpad(SO);
-- 
George M. Sipe,		Phone: (404) 662-1533
Tolerant Systems, 6961 Peachtree Industrial, Norcross, GA  30071
UUCP: ...!{decvax,hplabs,ihnp4,linus,rutgers,seismo}!gatech!rebel!george