Commit | Line | Data |
---|---|---|
aec27b08 KA |
1 | # include "curses.ext" |
2 | ||
3 | /* | |
4 | * This routine performs an insert-char on the line, leaving | |
5 | * (_cury,_curx) unchanged. | |
6 | * | |
bfed68c6 | 7 | * @(#)insch.c 1.2 (Berkeley) %G% |
aec27b08 KA |
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 | } | |
bfed68c6 | 32 | else |
aec27b08 | 33 | return ERR; |
aec27b08 KA |
34 | return OK; |
35 | } |