Commit | Line | Data |
---|---|---|
6e1c93d0 DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6 | ||
7 | #ifndef lint | |
8 | static char sccsid[] = "@(#)insch.c 5.1 (Berkeley) %G%"; | |
9 | #endif not lint | |
10 | ||
aec27b08 KA |
11 | # include "curses.ext" |
12 | ||
13 | /* | |
14 | * This routine performs an insert-char on the line, leaving | |
15 | * (_cury,_curx) unchanged. | |
16 | * | |
aec27b08 KA |
17 | */ |
18 | winsch(win, c) | |
19 | reg WINDOW *win; | |
20 | char c; { | |
21 | ||
22 | reg char *temp1, *temp2; | |
23 | reg char *end; | |
24 | ||
25 | end = &win->_y[win->_cury][win->_curx]; | |
26 | temp1 = &win->_y[win->_cury][win->_maxx - 1]; | |
27 | temp2 = temp1 - 1; | |
28 | while (temp1 > end) | |
29 | *temp1-- = *temp2--; | |
30 | *temp1 = c; | |
62fc2477 | 31 | touchline(win, win->_cury, win->_curx, win->_maxx - 1); |
aec27b08 KA |
32 | if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ') |
33 | if (win->_scroll) { | |
34 | wrefresh(win); | |
35 | scroll(win); | |
36 | win->_cury--; | |
37 | } | |
bfed68c6 | 38 | else |
aec27b08 | 39 | return ERR; |
aec27b08 KA |
40 | return OK; |
41 | } |