[net.micro.amiga] Hours of endless enjoyment from MicroEmacs, just for the asking

DEC.BANKS@MARLBORO.DEC.COM (04/11/86)

From: Dawn Banks <DEC.BANKS@MARLBORO.DEC.COM>

I've tripped across a bug in the ditributed version of MicroEmacs
wherein the editor will go into an infinite loop if you're trying to
display a tab at the end of a screen line.  Actually, this will happen
with any display whose width is not evenly divisible by eight, which
is the case with the Amiga MicroEmacs, at 77 characters per line.

In Display.c, there are two occurances of:

      if (vtcol >= term.t_ncol)
          vp->v_text[term.t_ncol - 1] = '$';
      else if (c == '\t')

that most certainly should be replaced with something like

      if (vtcol >= term.t_ncol) {
	  vtcol = (vtcol + 0x07) & ~0x07;
          vp->v_text[term.t_ncol - 1] = '$';
	  }
      else if (c == '\t')

Of course there are better ways to fix this.  What's happening is that
the code that expands tabs keeps outputting spaces until vtcol is
sitting at a tab stop (last three bits are zero).  If you're at the
end of the line, vtcol never gets incremented, and therefore never
ends in three zeros, so we loop forever.

{insert generic disclaimer here}

Enjoy.

					D. Banks
					ARPA: DEC.BANKS@DEC-MARLORO.ARPA
   --------