home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 100-199 / ff197.lzh / Stevie / updateRs.c < prev    next >
C/C++ Source or Header  |  1989-03-28  |  2KB  |  71 lines

  1. /*
  2.  * STEVIE - Simply Try this Editor for VI Enthusiasts
  3.  *
  4.  * Code Contributions By : Tim Thompson           twitch!tjt
  5.  *                         Tony Andrews           onecom!wldrdg!tony 
  6.  *                         G. R. (Fred) Walter    watmath!watcgl!grwalter 
  7.  */
  8.  
  9. #include "stevie.h"
  10.  
  11. /*
  12.  * updateRealscreen 
  13.  *
  14.  * Transfer the contents of Nextscreen to the screen, using Realscreen to avoid
  15.  * unnecessary output. 
  16.  */
  17. void
  18. updateRealscreen()
  19. {
  20.     register char  *np = Nextscreen;
  21.     register char  *rp = Realscreen;
  22.     register char  *endscreen;
  23.     register int    row = 0, col = 0;
  24.     int             gorow = -1, gocol = -1;
  25.  
  26.     if (RedrawingDisabled)
  27.     return;
  28.  
  29.     if (!MustRedrawScreen && !MustRedrawLine)
  30.     return;
  31.  
  32.     if (MustRedrawLine) {
  33.     msg("internal error: updateRealscreen called when MustRedrawLine set");
  34.     sleep(5);
  35.     }
  36.     endscreen = &np[(Rows - 1) * Columns];
  37.  
  38.     outstr(T_CI);        /* disable cursor */
  39.  
  40.     for (; np < endscreen; np++, rp++) {
  41.     /* If desired screen (contents of Nextscreen) does not */
  42.     /* match what's really there, put it there. */
  43.     if (*np != *rp) {
  44.         /* if we are positioned at the right place, */
  45.         /* we don't have to use windgoto(). */
  46.         if (gocol != col || gorow != row) {
  47.         /*
  48.          * If we're just off by one, don't send an entire esc. seq.
  49.          * (this happens a lot!) 
  50.          */
  51.         if (gorow == row && gocol + 1 == col) {
  52.             outchar(*(np - 1));
  53.             gocol++;
  54.         } else
  55.             windgoto(gorow = row, gocol = col);
  56.         }
  57.         outchar(*rp = *np);
  58.         gocol++;
  59.     }
  60.     if (++col >= Columns) {
  61.         col = 0;
  62.         row++;
  63.     }
  64.     }
  65.  
  66.     outstr(T_CV);        /* enable cursor again */
  67.  
  68.     MustRedrawLine = FALSE;
  69.     MustRedrawScreen = FALSE;
  70. }
  71.