122669Sdist /* 234677Sbostic * Copyright (c) 1981 Regents of the University of California. 334677Sbostic * All rights reserved. 434677Sbostic * 542653Sbostic * %sccs.include.redist.c% 622669Sdist */ 722669Sdist 822669Sdist #ifndef lint 9*57472Sbostic static char sccsid[] = "@(#)insch.c 5.11 (Berkeley) 01/11/93"; 1055964Sbostic #endif /* not lint */ 1122669Sdist 1255964Sbostic #include <curses.h> 133532Sarnold 143532Sarnold /* 1555964Sbostic * winsch -- 1656647Selan * Do an insert-char on the line, leaving (cury, curx) unchanged. 173532Sarnold */ 1855964Sbostic int 1955964Sbostic winsch(win, ch) 2055964Sbostic register WINDOW *win; 2155964Sbostic int ch; 2255964Sbostic { 233532Sarnold 2456647Selan register __LDATA *end, *temp1, *temp2; 253532Sarnold 2656238Selan end = &win->lines[win->cury]->line[win->curx]; 2756238Selan temp1 = &win->lines[win->cury]->line[win->maxx - 1]; 283532Sarnold temp2 = temp1 - 1; 2956596Selan while (temp1 > end) { 3056647Selan bcopy(temp2, temp1, sizeof(__LDATA)); 3156596Selan temp1--, temp2--; 3256596Selan } 3356647Selan temp1->ch = ch; 3456647Selan temp1->attr &= ~__STANDOUT; 3556650Selan __touchline(win, win->cury, win->curx, win->maxx - 1, 0); 3656238Selan if (win->cury == LINES - 1 && 3756647Selan (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' || 3856647Selan win->lines[LINES -1]->line[COLS - 1].attr != 0)) 3956238Selan if (win->flags & __SCROLLOK) { 403532Sarnold wrefresh(win); 413532Sarnold scroll(win); 4256238Selan win->cury--; 4355964Sbostic } else 44*57472Sbostic return (ERR); 45*57472Sbostic return (OK); 463532Sarnold } 47