* This routine adds the character to the current position
* @(#)addch.c 1.5 (Berkeley) %G%
fprintf(outf
, "ADDCH('%c') at (%d, %d)\n", c
, y
, x
);
if (y
>= win
->_maxy
|| x
>= win
->_maxx
|| y
< 0 || x
< 0)
for (newx
= x
+ (8 - (x
& 07)); x
< newx
; x
++)
if (waddch(win
, ' ') == ERR
)
fprintf(outf
, "ADDCH: 1: y = %d, x = %d, firstch = %d, lastch = %d\n", y
, x
, win
->_firstch
[y
], win
->_lastch
[y
]);
if (win
->_flags
& _STANDOUT
)
set_ch(win
, y
, x
, c
, NULL
);
for (wp
= win
->_nextp
; wp
!= win
; wp
= wp
->_nextp
)
set_ch(wp
, y
, x
, c
, win
);
fprintf(outf
, "ADDCH: 2: y = %d, x = %d, firstch = %d, lastch = %d\n", y
, x
, win
->_firstch
[y
], win
->_lastch
[y
]);
* Set the first and last change flags for this window.
set_ch(win
, y
, x
, ch
, orig
)
y
-= win
->_begy
- orig
->_begy
;
x
-= win
->_begx
- orig
->_begx
;
if (y
< 0 || y
>= win
->_maxy
|| x
< 0 || x
>= win
->_maxx
)
if (win
->_y
[y
][x
] != ch
) {
if (win
->_firstch
[y
] == _NOCHANGE
)
win
->_firstch
[y
] = win
->_lastch
[y
] = x
;
else if (x
< win
->_firstch
[y
])
else if (x
> win
->_lastch
[y
])