4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / lib / libcurses / insch.c
index 7b64617..743756a 100644 (file)
@@ -6,14 +6,15 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)insch.c    5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)insch.c    5.13 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <curses.h>
 #endif /* not lint */
 
 #include <curses.h>
+#include <string.h>
 
 /*
  * winsch --
 
 /*
  * winsch --
- *     Do an insert-char on the line, leaving (_cury,_curx) unchanged.
+ *     Do an insert-char on the line, leaving (cury, curx) unchanged.
  */
 int
 winsch(win, ch)
  */
 int
 winsch(win, ch)
@@ -21,23 +22,21 @@ winsch(win, ch)
        int ch;
 {
 
        int ch;
 {
 
-       register char *end, *temp1, *temp2;
+       register __LDATA *end, *temp1, *temp2;
 
        end = &win->lines[win->cury]->line[win->curx];
        temp1 = &win->lines[win->cury]->line[win->maxx - 1];
        temp2 = temp1 - 1;
        while (temp1 > end) {
 
        end = &win->lines[win->cury]->line[win->curx];
        temp1 = &win->lines[win->cury]->line[win->maxx - 1];
        temp2 = temp1 - 1;
        while (temp1 > end) {
-               *temp1 = *temp2;
-               /* standout array */
-               *(temp1 + win->maxx) = *(temp2 + win->maxx);
+               (void)memcpy(temp1, temp2, sizeof(__LDATA));
                temp1--, temp2--;
        }
                temp1--, temp2--;
        }
-       *temp1 = ch;
-       *(temp1 + win->maxx) &= ~__STANDOUT;
-       touchline(win, win->cury, win->curx, win->maxx - 1);
+       temp1->ch = ch;
+       temp1->attr &= ~__STANDOUT;
+       __touchline(win, win->cury, win->curx, win->maxx - 1, 0);
        if (win->cury == LINES - 1 && 
        if (win->cury == LINES - 1 && 
-           (win->lines[LINES - 1]->line[COLS - 1] != ' ' ||
-           win->lines[LINES -1]->standout[COLS - 1] & __STANDOUT))
+           (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' ||
+           win->lines[LINES -1]->line[COLS - 1].attr != 0))
                if (win->flags & __SCROLLOK) {
                        wrefresh(win);
                        scroll(win);
                if (win->flags & __SCROLLOK) {
                        wrefresh(win);
                        scroll(win);