home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume2 / window / part4 / refresh.c.pat < prev    next >
Encoding:
Text File  |  1986-11-30  |  4.8 KB  |  209 lines

  1. *** libcurses42/refresh.c    Thu Nov 17 11:03:06 1983
  2. --- libcurses/refresh.c    Tue Jul 30 23:16:01 1985
  3. ***************
  4. *** 5,6
  5.    * 5/12/83 (Berkeley) @(#)refresh.c    1.8
  6.    */
  7.  
  8. --- 5,14 -----
  9.    * 5/12/83 (Berkeley) @(#)refresh.c    1.8
  10. +  *
  11. +  * 2/28/84 Correction at UCSF:
  12. +  * Take the terminal out of standout mode, before clear to end of line
  13. +  * if it isn't safe to move in standout mode (termcap entry ms)
  14. +  *
  15. +  * 3/14/85 Corrections at RTI
  16. +  *  Fix problems reported on Usenet.  Also, delete apparently
  17. +  *  useless (and harmful) code if _leave has been set.
  18.    */
  19. ***************
  20. *** 86,87
  21.           curscr->_curx = lx;
  22.           ly -= win->_begy;
  23.  
  24. --- 94,97 -----
  25.           curscr->_curx = lx;
  26. + #ifdef    wantamess
  27. +         /* rti-sel!trt: this code is completely bogus, yes? */
  28.           ly -= win->_begy;
  29. ***************
  30. *** 94,95
  31.               win->_cury = win->_curx = 0;
  32.       }
  33.  
  34. --- 104,106 -----
  35.               win->_cury = win->_curx = 0;
  36. + #endif
  37.       }
  38. ***************
  39. *** 118,119
  40.       reg int        nlsp, clsp;    /* last space in lines        */
  41.   
  42.  
  43. --- 129,131 -----
  44.       reg int        nlsp, clsp;    /* last space in lines        */
  45. +     static int glitchXN;
  46.   
  47. ***************
  48. *** 128,129
  49.       if (CE && !curwin) {
  50.           for (ce = &win->_y[wy][win->_maxx - 1]; *ce == ' '; ce--)
  51.  
  52. --- 140,142 -----
  53.       if (CE && !curwin) {
  54. + #ifdef slowway
  55.           for (ce = &win->_y[wy][win->_maxx - 1]; *ce == ' '; ce--)
  56. ***************
  57. *** 132,133
  58.           nlsp = ce - win->_y[wy];
  59.       }
  60.  
  61. --- 145,149 -----
  62.           nlsp = ce - win->_y[wy];
  63. + #else
  64. +         nlsp = -1;
  65. + #endif
  66.       }
  67. ***************
  68. *** 139,140
  69.           if (*nsp != *csp) {
  70.               domvcur(ly, lx, y, wx + win->_begx);
  71.  
  72. --- 155,168 -----
  73.           if (*nsp != *csp) {
  74. + #ifndef wantamess
  75. +             /* this is no guarantee, but seems to work */
  76. +             if (glitchXN && wx && wx+win->_begx==COLS-1) {
  77. +                 domvcur(ly, lx, y, wx+win->_begx-1);
  78. +                 ly = y;
  79. +                 lx = wx+win->_begx-1;
  80. +                 glitchXN = 0;
  81. +                 continue;
  82. +             }
  83. +             glitchXN = 0;
  84. + #endif
  85. + #ifdef slowway
  86.               domvcur(ly, lx, y, wx + win->_begx);
  87. ***************
  88. *** 145,147
  89.               lx = wx + win->_begx;
  90. !             while (*nsp != *csp && wx <= lch) {
  91.                   if (ce != NULL && wx >= nlsp && *nsp == ' ') {
  92.  
  93. --- 173,212 -----
  94.               lx = wx + win->_begx;
  95. ! #else
  96. !             /* speed hacks to avoid domvcur in simple cases */
  97. !             clsp = wx + win->_begx; /* dirty use of clsp */
  98. !             if (ly == y) {
  99. !                 if (lx == clsp)
  100. !                 goto at_target;
  101. !                 if (lx+1 == clsp && !curwin) {
  102. !                 /* enter/exit standout mode as appropriate */
  103. !                 if (SO && (csp[-1]&_STANDOUT) != (curscr->_flags&_STANDOUT)) {
  104. !                     if (csp[-1] & _STANDOUT) {
  105. !                         _puts(SO);
  106. !                         curscr->_flags |= _STANDOUT;
  107. !                     }
  108. !                     else {
  109. !                         _puts(SE);
  110. !                         curscr->_flags &= ~_STANDOUT;
  111. !                     }
  112. !                 }
  113. !                 putchar(csp[-1]&0177);
  114. !                 lx++;
  115. !                 goto at_target;
  116. !                 }
  117. !                 if (clsp == 0 && !(curscr->_flags&_STANDOUT)
  118. !                  && !NC && (!CR || CR[1] == '\0')) {
  119. !                 if (CR)
  120. !                     putchar(*CR);
  121. !                 else
  122. !                     putchar('\r');
  123. !                 lx = 0;
  124. !                 goto at_target;
  125. !                 }
  126. !             }
  127. !             domvcur(ly, lx, y, clsp);
  128. !             ly = y;
  129. !             lx = clsp;
  130. !         at_target:;
  131. ! #endif
  132. !             while (wx <= lch && *nsp != *csp) {
  133.                   if (ce != NULL && wx >= nlsp && *nsp == ' ') {
  134. ***************
  135. *** 147,148
  136.                   if (ce != NULL && wx >= nlsp && *nsp == ' ') {
  137.                       /*
  138.  
  139. --- 212,222 -----
  140.                   if (ce != NULL && wx >= nlsp && *nsp == ' ') {
  141. + #ifndef slowway
  142. +                     if (nlsp < 0) {
  143. +                     for (nlsp = win->_maxx-1;
  144. +                         nlsp > 0 && win->_y[wy][nlsp]==' ';
  145. +                         nlsp--)
  146. +                         ;
  147. +                     continue; /* gotta recheck nlsp */
  148. +                     }
  149. + #endif
  150.                       /*
  151. ***************
  152. *** 163,164
  153.   # endif
  154.                           _puts(CE);
  155.  
  156. --- 237,245 -----
  157.   # endif
  158. +                         /* if we shouldn't move in standout mode, CE may cause
  159. +                            problems too
  160. +                         */
  161. +                         if (curscr->_flags & _STANDOUT && !MS) {
  162. +                             _puts(SE);
  163. +                             curscr->_flags &= ~_STANDOUT;
  164. +                         }
  165.                           _puts(CE);
  166. ***************
  167. *** 226,228
  168.           else if (wx < lch)
  169. !             while (*nsp == *csp) {
  170.                   nsp++;
  171.  
  172. --- 307,309 -----
  173.           else if (wx < lch)
  174. !             while (wx <= lch && *nsp == *csp) {
  175.                   nsp++;
  176. ***************
  177. *** 239,240
  178.   ret:
  179.       return OK;
  180.  
  181. --- 320,346 -----
  182.   ret:
  183. + #ifndef    wantamess
  184. +     /* rti-sel!trt: update cursor location on auto-wrap */
  185. +     if (lx >= COLS) {
  186. +         if (XN) {    /* make this case like the usual one */
  187. +             if (curscr->_flags & _STANDOUT && !MS) {
  188. +                 _puts(SE);
  189. +                 curscr->_flags &= ~_STANDOUT;
  190. +             }
  191. +             putchar('\r');
  192. +             putchar('\n');
  193. +             glitchXN++;    /* next char must not be in col 80 */
  194. +         }
  195. +         lx = 0;
  196. +         if (ly < LINES-1)
  197. +             ly++;
  198. +         else {
  199. +             /* at this point the current screen scrolled up.
  200. +              * scroll() is strange, so we simulate it by hand.
  201. +              * Curses should probably not put anything in lower
  202. +              * right corner of screen, and thus avoid this mess */
  203. +             wmove(curscr, 0, 0); wdeleteln(curscr);
  204. +             wmove(curscr, ly, lx);
  205. +         }
  206. +     }
  207. + #endif
  208.       return OK;
  209.