[7974] in Athena Bugs

home help back first fref pref prev next nref lref last post

Fix for more for automargins

daemon@ATHENA.MIT.EDU (epeisach@ATHENA.MIT.EDU)
Mon Aug 19 10:20:17 1991

From: epeisach@ATHENA.MIT.EDU
Date: Mon, 19 Aug 91 10:20:39 -0400
To: bugs@ATHENA.MIT.EDU


The following is based on 4.3tahoe and ultrix. (It is amazing how few
differences exist between the sources). We thought the bug was in
turning on the "am" field in the termcap. The real bug is that "xn" is
not being parsed.

The following patch may not directly apply to the sources for more, but
will be close. 

The variable Wrap is enabled if am is set.
eatnl is set if xn is set.

Under bsd we already have the xn in the xterm termcap. The am is
missing.

Test case:
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

our more would drop a character at the end, with this fix it doesn't.


*** /tmp/,RCSt1a01644	Mon Aug 19 10:17:07 1991
--- more.c	Mon Aug 19 10:03:47 1991
***************
*** 94,100 ****
  int		inwait, Pause, errors;
  int		within;	/* true if we are within a file,
  			false if we are between files */
! int		hard, dumb, noscroll, hardtabs, clreol;
  int		catch_susp;	/* We should catch the SIGTSTP signal */
  char		**fnames;	/* The list of file names */
  int		nfiles;		/* Number of files left to process */
--- 95,101 ----
  int		inwait, Pause, errors;
  int		within;	/* true if we are within a file,
  			false if we are between files */
! int		hard, dumb, noscroll, hardtabs, clreol, eatnl;
  int		catch_susp;	/* We should catch the SIGTSTP signal */
  char		**fnames;	/* The list of file names */
  int		nfiles;		/* Number of files left to process */
***************
*** 898,903 ****
--- 901,909 ----
  	}
      }
      colflg = column == Mcol && fold_opt;
+     if (colflg && eatnl && Wrap) {
+ 	*p++ = '\n'; /* simulate normal wrap */
+     }
      *length = p - Line;
      *p = 0;
      return (column);
***************
*** 1625,1630 ****
--- 1639,1646 ----
  		hard++;	/* Hard copy terminal */
  		Lpp = 24;
  	    }
+ 	    if (tgetflag("xn"))
+ 		eatnl++; /* Eat newline at last column + 1; dec, concept */
  	    if (Mcol <= 0)
  		Mcol = 80;
  

home help back first fref pref prev next nref lref last post