[comp.emacs] MicroEMACS 3.8i standout bugs

george@rebel.UUCP (07/11/87)

The recently posted version of MicroEMACS (3.8i) continues a tradition
whereby certain terminals may not be used -- to run on a terminal which
requires a display position for standout begin/end.  I have a patch
which addresses this problem.  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.  The patch in context diff format appears below.  Note that
before applying the patch, you may have to "unexpand" (without -a) the
source files.  It appears that the leading tabs were somehow removed
before it was posted.

I am 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 capability is important for those of us who use the GNU editor and
who must be able to easily move between GNU and MicroEMACS.

Comments?

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



*** estruct.h_orig	Thu May 28 13:25:45 1987
--- estruct.h	Thu May 28 13:26:41 1987
***************
*** 69,74
  #define VT100   0                       /* Handle VT100 style keypad.   */
  #define RAINBOW 0                       /* Use Rainbow fast video.      */
  #define TERMCAP 0                       /* Use TERMCAP                  */
  #define	IBMPC	1			/* 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 0                       /* Use TERMCAP                  */
+ #define	FIXSG	TERMCAP			/* Fix stand-out glitch		*/
  #define	IBMPC	1			/* IBM-PC CGA/MONO/EGA driver	*/
  #define	DG10	0			/* Data General system/10	*/
  #define	TIPC	0			/* TI Profesional PC driver	*/
*** edef.h_orig	Thu May 28 13:25:30 1987
--- edef.h	Thu May 28 13:25:29 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	*/
*** tcap.c_orig	Thu May 28 13:25:28 1987
--- tcap.c	Thu May 28 13:25:27 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);
*** display.c_orig	Thu May 28 13:25:27 1987
--- display.c	Thu May 28 13:29:11 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 */


-- 
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

blarson@castor.usc.edu (Bob Larson) (07/22/87)

In article <384@rebel.UUCP> george@rebel.UUCP (George M. Sipe) writes:
>I am 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.

Are you unaware of MicroGnuEmacs (mg)?  mg 1b is avaiable for ftp from
jade.berkeley.edu in pub/mg/mg1b.tar.Z (compressed tar).  (mg 1a
appered in mod.sources, and should be avaiable from archive sites.) Mg
is a small, portable, emacs-like (no extention language) editor
designed to act as much as practical like GNU Emacs, and has no direct
association with the GNU project.

Mg was based on v30 rather than Laurence's 3.6 because we felt that a
clean, mostly bug-free base was more important than the few additional
features 3.6 offered.  (This was the consensus of the short-lived
microemacs mailing list, the major decenting opinion was Dave Laurence.
The original mg autors met via that list.)  Since then, mg and
Laurence's microemacs have diverged.

** Personal opinion, Asbestos suit on **
From what I have seen about the number of patch versions of Dave
Laurence's microemacs, he still needs better beta testing (does he
have any?) on a wider variety of machines.  We did at least 4 beta
distributions of mg before releasing either version. 
** normal mode on **

If you are interested in doing development/support of mg, send a note
to mg-support@ucbvax.berkeley.edu .  (Several people have expressed an
interest in having a version for messydos, but so far nobody has
volenteered to do the work.)
--
Bob Larson		Arpa: Blarson@Ecla.Usc.Edu
Uucp: {sdcrdcf,seismo!cit-vax}!oberon!castor!blarson
"How well do we use our freedom to choose the illusions we create?" -- Timbuk3