1: #ifndef lint
   2: static char sccsid[] = "@(#)wwinschar.c	3.14 4/24/85";
   3: #endif
   4: 
   5: /*
   6:  * Copyright (c) 1983 Regents of the University of California,
   7:  * All rights reserved.  Redistribution permitted subject to
   8:  * the terms of the Berkeley Software License Agreement.
   9:  */
  10: 
  11: #include "ww.h"
  12: #include "tt.h"
  13: 
  14: wwinschar(w, row, col, c)
  15: register struct ww *w;
  16: short c;
  17: {
  18:     register i;
  19:     int nvis;
  20: 
  21:     /*
  22: 	 * First, shift the line.
  23: 	 */
  24:     {
  25:         register union ww_char *p, *q;
  26: 
  27:         p = &w->ww_buf[row][w->ww_b.r];
  28:         q = p - 1;
  29:         for (i = w->ww_b.r - col; --i > 0;)
  30:             *--p = *--q;
  31:         q->c_w = c;
  32:     }
  33: 
  34:     /*
  35: 	 * If can't see it, just return.
  36: 	 */
  37:     if (row < w->ww_i.t || row >= w->ww_i.b
  38:         || w->ww_i.r <= 0 || w->ww_i.r <= col)
  39:         return;
  40: 
  41:     if (col < w->ww_i.l)
  42:         col = w->ww_i.l;
  43: 
  44:     /*
  45: 	 * Now find out how much is actually changed, and fix wwns.
  46: 	 */
  47:     {
  48:         register union ww_char *buf;
  49:         register char *win;
  50:         register union ww_char *ns;
  51:         register char *smap;
  52:         char touched;
  53: 
  54:         nvis = 0;
  55:         smap = &wwsmap[row][col];
  56:         for (i = col; i < w->ww_i.r && *smap++ != w->ww_index; i++)
  57:             ;
  58:         if (i >= w->ww_i.r)
  59:             return;
  60:         col = i;
  61:         buf = w->ww_buf[row];
  62:         win = w->ww_win[row];
  63:         ns = wwns[row];
  64:         smap = &wwsmap[row][i];
  65:         touched = wwtouched[row];
  66:         for (; i < w->ww_i.r; i++) {
  67:             if (*smap++ != w->ww_index)
  68:                 continue;
  69:             touched |= WWU_TOUCHED;
  70:             if (win[i])
  71:                 ns[i].c_w =
  72:                     buf[i].c_w ^ win[i] << WWC_MSHIFT;
  73:             else {
  74:                 nvis++;
  75:                 ns[i] = buf[i];
  76:             }
  77:         }
  78:         wwtouched[row] = touched;
  79:     }
  80: 
  81:     /*
  82: 	 * Can/Should we use delete character?
  83: 	 */
  84:     if (tt.tt_hasinsert && nvis > (wwncol - col) / 2) {
  85:         register union ww_char *p, *q;
  86: 
  87:         tt.tt_ninsert = 1;
  88:         tt.tt_nmodes = c >> WWC_MSHIFT & tt.tt_availmodes;
  89:         (*tt.tt_move)(row, col);
  90:         (*tt.tt_putc)(c & WWC_CMASK);
  91:         tt.tt_ninsert = 0;
  92: 
  93:         p = &wwos[row][wwncol];
  94:         q = p - 1;
  95:         for (i = wwncol - col; --i > 0;)
  96:             *--p = *--q;
  97:         q->c_w = c;
  98:     }
  99: }

Defined functions

wwinschar defined in line 14; used 1 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1896
Valid CSS Valid XHTML 1.0 Strict