Annotation of researchv10no/ncurses/screen/_blanks.c, revision 1.1.1.1

1.1       root        1: /*     @(#) _blanks.c: 1.1 10/15/83    (1.21   2/11/83)        */
                      2: 
                      3: #include "curses.ext"
                      4: 
                      5: extern int     _outch();
                      6: extern int     _sethl();
                      7: extern int     _setmode();
                      8: extern char    *tparm();
                      9: extern int     tputs();
                     10: 
                     11: /*
                     12:  * Output n blanks, or the equivalent.  This is done to erase text, and
                     13:  * also to insert blanks.  The semantics of this call do not define where
                     14:  * it leaves the cursor - it might be where it was before, or it might
                     15:  * be at the end of the blanks.  We will, of course, leave SP->phys_x
                     16:  * properly updated.
                     17:  */
                     18: _blanks (n)
                     19: {
                     20: #ifdef DEBUG
                     21:        if(outf) fprintf(outf, "_blanks(%d).\n", n);
                     22: #endif
                     23:        if (n == 0)
                     24:                return;
                     25:        _setmode ();
                     26:        _sethl ();
                     27:        if (SP->virt_irm==1 && parm_ich) {
                     28:                if (n == 1)
                     29:                        tputs(insert_character, 1, _outch);
                     30:                else
                     31:                        tputs(tparm(parm_ich, n), n, _outch);
                     32:                return;
                     33:        }
                     34:        if (erase_chars && SP->phys_irm != 1 && n > 5) {
                     35:                tputs(tparm(erase_chars, n), n, _outch);
                     36:                return;
                     37:        }
                     38:        if (repeat_char && SP->phys_irm != 1 && n > 5) {
                     39:                tputs(tparm(repeat_char, ' ', n), n, _outch);
                     40:                SP->phys_x += n;
                     41:                return;
                     42:        }
                     43:        while (--n >= 0) {
                     44:                if (SP->phys_irm == 1 && insert_character)
                     45:                        tputs (insert_character, columns - SP->phys_x, _outch);
                     46:                if (++SP->phys_x >= columns && auto_right_margin) {
                     47:                        if (SP->phys_y >= lines-1) {
                     48:                                /*
                     49:                                 * We attempted to put something in the last
                     50:                                 * position of the last line.  Since this will
                     51:                                 * cause a scroll (we only get here if the
                     52:                                 * terminal has auto_right_margin) we refuse
                     53:                                 * to put it out.
                     54:                                 */
                     55:                                SP->phys_x--;
                     56:                                return;
                     57:                        }
                     58:                        SP->phys_x = 0;
                     59:                        SP->phys_y++;
                     60:                }
                     61:                _outch (' ');
                     62:                if (SP->phys_irm == 1 && insert_padding)
                     63:                        tputs (insert_padding, 1, _outch);
                     64:        }
                     65: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.