[net.sources] faster paging in JOVE

km@cadre.ARPA (Ken Mitchum) (09/18/85)

After a summer off doing what I'm paid to do, I have again returned to Jove.
I have made many changes, which I will try to document on the net at some
point. Here is an easy one you might want:


----------------------------------------------------------------------------

1) The commands "next-page" and "prev-page" work very slowly in the
Jove/msdos as originally written, especially when using the 43 line screen.
The problem is that line inserts/deletes, while being quicker than screen
rewrites in most situations, are actually slower to figure out while moving
to the next page. The real solution is to recode DoIDline() in disp.c.
However, the following kludge works just as well, and takes little brains:

   A) Partway through DoIDline() in disp.c, replace the following lines:


	if (!CanScroll)
		CanScroll =1;
		return;		/* We should never have been called! */


	with:

	if (!CanScroll) {
#ifndef UNIX		
		CanScroll =1;
#endif		
		return;		/* We should never have been called! */
	}

	B) Replace the functions NextPage() and PrevPage() in draw.c with
these versions:

NextPage()
{
	LINE	*newline;

	if (exp_p)
		UpScroll();
	else {
		newline = next_line(curwind->w_top, curwind->w_height +
			curwind->w_height/3);
		curwind->w_line = newline;
		DotTo(newline, 0);
#ifndef UNIX
		CanScroll = 0;
#endif
	}
}

PrevPage()
{
	LINE	*newline;

	if (exp_p)
		DownScroll();
	else {
		newline = prev_line(curwind->w_top, curwind->w_height/3);
		curwind->w_line = newline;
		DotTo(newline, 0);
#ifndef UNIX
		CanScroll = 0;
#endif
	}
}

---------------------------------------------------------------------

2) I have rewritten "temp.c" and am in the process of extending Jove's
line storage to a virtual scheme using both memory and a tempfile. The
result requires more memory, but is faster, particularly when using Jove
with a floppy-based system. In addition, there is no code from "vi"
involved. I will post information on this in the future.


  -Ken Mitchum
  (km@cadre.arpa)

km@cadre.ARPA (Ken Mitchum) (09/18/85)

>
>	B) Replace the functions NextPage() and PrevPage() in draw.c with
>these versions:
>
>PrevPage()
>{
>	LINE	*newline;
>
>	if (exp_p)
>		DownScroll();
>	else {
>		newline = prev_line(curwind->w_top, curwind->w_height/3);
>		curwind->w_line = newline;
>		DotTo(newline, 0);
>#ifndef UNIX
>		CanScroll = 0;
>#endif
>	}
>}

While the above works, the following guarantees that a succession of
prev-page next-page commands will return to the same line:

PrevPage()
{
	LINE	*newline;
	int p = (curwind->w_height & 1) ? 1 : 2;

	if (exp_p)
		DownScroll();
	else {
		newline = prev_line(curwind->w_top, curwind->w_height/3 +p);
		curwind->w_line = newline;
		DotTo(newline, 0);
#ifndef UNIX
		CanScroll = 0;
#endif
	}
}

Sorry, but I did not discover the error until after the posting.

  -Ken Mitchum
  (km@cadre.arpa)