| 1 | # include "curses.ext" |
| 2 | |
| 3 | /* |
| 4 | * This routine performs an insert-char on the line, leaving |
| 5 | * (_cury,_curx) unchanged. |
| 6 | * |
| 7 | * @(#)insch.c 1.2 (Berkeley) %G% |
| 8 | */ |
| 9 | winsch(win, c) |
| 10 | reg WINDOW *win; |
| 11 | char c; { |
| 12 | |
| 13 | reg char *temp1, *temp2; |
| 14 | reg char *end; |
| 15 | |
| 16 | end = &win->_y[win->_cury][win->_curx]; |
| 17 | temp1 = &win->_y[win->_cury][win->_maxx - 1]; |
| 18 | temp2 = temp1 - 1; |
| 19 | while (temp1 > end) |
| 20 | *temp1-- = *temp2--; |
| 21 | *temp1 = c; |
| 22 | win->_lastch[win->_cury] = win->_maxx - 1; |
| 23 | if (win->_firstch[win->_cury] == _NOCHANGE || |
| 24 | win->_firstch[win->_cury] > win->_curx) |
| 25 | win->_firstch[win->_cury] = win->_curx; |
| 26 | if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ') |
| 27 | if (win->_scroll) { |
| 28 | wrefresh(win); |
| 29 | scroll(win); |
| 30 | win->_cury--; |
| 31 | } |
| 32 | else |
| 33 | return ERR; |
| 34 | return OK; |
| 35 | } |