#include "ded.h" #include "char.h" #include "ter.h" #include "tmpfile.h" /* for addline() */ /************************************************************************ * * * copyright Richard Bornat 1981 * * * ************************************************************************/ setupscreen() { clearscreen(); refreshscreen(); } refreshscreen() { extern getfline(); reshow_screen(topl, getfline, false); } retag(srow) register int srow; { char linebuf[ENOUGH]; if (srow==EDITROW) redisplay(srow, 0, overtype? ']'|0200 : '>'); else { getline(topl+srow, linebuf); redraw(srow, 0, linebuf); } } clearscreen() { (*ter.clr_screen)(); } copyrow(srow,scol,buf) int srow, scol; register char *buf; { register char *map = rowmap[srow]+scol; register int count; count = lastcol(srow)-scol+1; while (count-- > 0) *buf++ = *map++; *buf = 0; } int esaveright=1; /* only used here and in dlog.c */ /* two functions to help when rolling about the screen */ saveedit() { copyrow(EDITROW,0,erow); esaveright = editright; } showedit() { redraw(EDITROW,0,erow); editright = esaveright; } /* looks at the screen row srow and the file line fline. * If they are different, it rewrites the line. */ saverow(srow) register int srow; { char sstr[ENOUGH]; copyrow(srow,MARGIN,sstr); /* essential to convert it into a string */ saveline(topl+srow, sstr); } saveline(sline, sstr) register int sline; register char *sstr; { char fstr[ENOUGH]; getfline(sline, fstr); if (!streq(sstr, &fstr[MARGIN])) { addline(sline, sstr); tmp_changed = true; } } savescreen() { register int i; for (i=0; i<=LASTINROW; i++) saverow(i); saveedit(); } /************************************************************************ * * * altering the screen map * * * ************************************************************************/ catrow(srow, scol, linebuf) int srow; register int scol; register char *linebuf; { register char *rp = rowmap[srow]+scol; while (scolncols) editerror("too far (%d) to shuffle col (%d) [shufrow]", incr, col); else if (incr<0) /* shuffle left */ { rps = rplim+col; rpd = rps+incr; rplim += RIGHTCOL; while (rps<=rplim) *rpd++ = *rps++; while (rpd<=rplim) *rpd++ = c_SPACE; } else /* shuffle right */ { rpd = rplim+RIGHTCOL; rps = rpd-incr; rplim += col; while (rps>=rplim) *rpd-- = *rps--; while (rpd>=rplim) *rpd-- = c_SPACE; } } /* move lines around in the screen map */ shufmap(row1, row2, incr) int row1, row2; { register int i; register char *spare; if (incr<0) /* move up the screen */ { spare = rowmap[row1]; for (i=row1; irow1; i--) rowmap[i] = rowmap[i-1]; rowmap[row1] = spare; } for (i=0; i<=RIGHTCOL; i++) *spare++ = c_SPACE; }