#include "ded.h" #include "char.h" #include "ter.h" /************************************************************************ * * * copyright Richard Bornat 1981 * * * ************************************************************************/ #define TMARGIN 2 #define BMARGIN 2 split_row(arow, acol) int *arow, *acol; { register int r = *arow, c = *acol; register int fline = topl+r; int up; /* split strategy is - split down on top line - split up on bottom line - with hardware support, split down unless in bottom margin and screen is blank from top margin to cursor - without support, split down in top margin (to preserve context), elsewhere take cheaper alternative */ if (r==LASTINROW) up=true; else if (r==0 || charsin(r+1,LASTINROW)==0) up=false; else if (ter.scrseq.hardscroll) /* hardsplit unlikely if this untrue */ up = (r>LASTINROW-BMARGIN && !(charsin(TMARGIN,r-1)==0 && firstcol(r)>=c)); else up = (r>=TMARGIN && scrollup(0,r,(char *)0)<=scrolldown(r+1,LASTINROW,(char *)0)); /* save the row which will disappear and do the split */ saverow(up ? 0 : LASTINROW); (*(c==MARGIN || c>lastcol(r) ? split0 : ter.split_row))(r,c,MARGIN,up); /* adjust the file rather cautiously */ shuffile(fline+1, 1, 1); if (up) inc_topl(); else *arow = ++r; *acol = MARGIN; /* adjust the marks on screen */ retag(r-1); retag(r); }