Commit | Line | Data |
---|---|---|
6e1c93d0 | 1 | /* |
2f14f200 KB |
2 | * Copyright (c) 1981 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
c07973a2 | 5 | * %sccs.include.redist.c% |
6e1c93d0 DF |
6 | */ |
7 | ||
8 | #ifndef lint | |
76852b34 | 9 | static char sccsid[] = "@(#)insch.c 5.13 (Berkeley) %G%"; |
aafbddec | 10 | #endif /* not lint */ |
6e1c93d0 | 11 | |
aafbddec | 12 | #include <curses.h> |
76852b34 | 13 | #include <string.h> |
aec27b08 KA |
14 | |
15 | /* | |
aafbddec | 16 | * winsch -- |
1c04a491 | 17 | * Do an insert-char on the line, leaving (cury, curx) unchanged. |
aec27b08 | 18 | */ |
aafbddec KB |
19 | int |
20 | winsch(win, ch) | |
21 | register WINDOW *win; | |
22 | int ch; | |
23 | { | |
aec27b08 | 24 | |
1c04a491 | 25 | register __LDATA *end, *temp1, *temp2; |
aec27b08 | 26 | |
0c5c5188 EA |
27 | end = &win->lines[win->cury]->line[win->curx]; |
28 | temp1 = &win->lines[win->cury]->line[win->maxx - 1]; | |
aec27b08 | 29 | temp2 = temp1 - 1; |
1589e7d3 | 30 | while (temp1 > end) { |
a307f364 | 31 | (void)memcpy(temp1, temp2, sizeof(__LDATA)); |
1589e7d3 EA |
32 | temp1--, temp2--; |
33 | } | |
1c04a491 EA |
34 | temp1->ch = ch; |
35 | temp1->attr &= ~__STANDOUT; | |
e3923e32 | 36 | __touchline(win, win->cury, win->curx, win->maxx - 1, 0); |
0c5c5188 | 37 | if (win->cury == LINES - 1 && |
1c04a491 EA |
38 | (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' || |
39 | win->lines[LINES -1]->line[COLS - 1].attr != 0)) | |
0c5c5188 | 40 | if (win->flags & __SCROLLOK) { |
aec27b08 KA |
41 | wrefresh(win); |
42 | scroll(win); | |
0c5c5188 | 43 | win->cury--; |
aafbddec | 44 | } else |
79ec5a07 KB |
45 | return (ERR); |
46 | return (OK); | |
aec27b08 | 47 | } |