added Berkeley specific header
[unix-history] / usr / src / lib / libcurses / insch.c
index ba0ac14..0d8fd3f 100644 (file)
@@ -1,10 +1,19 @@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)insch.c    5.1 (Berkeley) %G%";
+#endif not lint
+
 # include      "curses.ext"
 
 /*
  *     This routine performs an insert-char on the line, leaving
  * (_cury,_curx) unchanged.
  *
 # include      "curses.ext"
 
 /*
  *     This routine performs an insert-char on the line, leaving
  * (_cury,_curx) unchanged.
  *
- * @(#)insch.c 1.1 (Berkeley) %G%
  */
 winsch(win, c)
 reg WINDOW     *win;
  */
 winsch(win, c)
 reg WINDOW     *win;
@@ -19,19 +28,14 @@ char                c; {
        while (temp1 > end)
                *temp1-- = *temp2--;
        *temp1 = c;
        while (temp1 > end)
                *temp1-- = *temp2--;
        *temp1 = c;
-       win->_lastch[win->_cury] = win->_maxx - 1;
-       if (win->_firstch[win->_cury] == _NOCHANGE ||
-           win->_firstch[win->_cury] > win->_curx)
-               win->_firstch[win->_cury] = win->_curx;
+       touchline(win, win->_cury, win->_curx, win->_maxx - 1);
        if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
                if (win->_scroll) {
                        wrefresh(win);
                        scroll(win);
                        win->_cury--;
                }
        if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
                if (win->_scroll) {
                        wrefresh(win);
                        scroll(win);
                        win->_cury--;
                }
-               else {
-                       win->_y[LINES-1][COLS-1] = ' ';
+               else
                        return ERR;
                        return ERR;
-               }
        return OK;
 }
        return OK;
 }