color.c revision 1.39 1 /* $NetBSD: color.c,v 1.39 2017/01/03 12:39:44 roy Exp $ */
2
3 /*
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julian Coleman.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #include <sys/cdefs.h>
33 #ifndef lint
34 __RCSID("$NetBSD: color.c,v 1.39 2017/01/03 12:39:44 roy Exp $");
35 #endif /* not lint */
36
37 #include "curses.h"
38 #include "curses_private.h"
39
40 /* Have we initialised colours? */
41 int __using_color = 0;
42
43 /* Default colour number */
44 attr_t __default_color = 0;
45
46 /* Default colour pair values - white on black. */
47 struct __pair __default_pair = {COLOR_WHITE, COLOR_BLACK, 0};
48
49 /* Default colour values */
50 /* Flags for colours and pairs */
51 #define __USED 0x01
52
53 static void
54 __change_pair(short);
55
56 static int
57 init_color_value(short, short, short, short);
58
59 /*
60 * has_colors --
61 * Check if terminal has colours.
62 */
63 bool
64 has_colors(void)
65 {
66 if (max_colors > 0 && max_pairs > 0 &&
67 ((set_a_foreground != NULL && set_a_background != NULL) ||
68 initialize_pair != NULL || initialize_color != NULL ||
69 (set_background != NULL && set_foreground != NULL)))
70 return(TRUE);
71 else
72 return(FALSE);
73 }
74
75 /*
76 * can_change_color --
77 * Check if terminal can change colours.
78 */
79 bool
80 can_change_color(void)
81 {
82 if (can_change)
83 return(TRUE);
84 else
85 return(FALSE);
86 }
87
88 /*
89 * start_color --
90 * Initialise colour support.
91 */
92 int
93 start_color(void)
94 {
95 int i;
96 attr_t temp_nc;
97 struct __winlist *wlp;
98 WINDOW *win;
99 int y, x;
100
101 if (has_colors() == FALSE)
102 return(ERR);
103
104 /* Max colours and colour pairs */
105 if (max_colors == -1)
106 COLORS = 0;
107 else {
108 COLORS = max_colors > MAX_COLORS ? MAX_COLORS : max_colors;
109 if (max_pairs == -1) {
110 COLOR_PAIRS = 0;
111 COLORS = 0;
112 } else {
113 COLOR_PAIRS = (max_pairs > MAX_PAIRS - 1 ?
114 MAX_PAIRS - 1 : max_pairs);
115 /* Use the last colour pair for curses default. */
116 __default_color = COLOR_PAIR(MAX_PAIRS - 1);
117 }
118 }
119 if (!COLORS)
120 return (ERR);
121
122 _cursesi_screen->COLORS = COLORS;
123 _cursesi_screen->COLOR_PAIRS = COLOR_PAIRS;
124
125 /* Reset terminal colour and colour pairs. */
126 if (orig_colors != NULL)
127 tputs(orig_colors, 0, __cputchar);
128 if (orig_pair != NULL) {
129 tputs(orig_pair, 0, __cputchar);
130 curscr->wattr &= _cursesi_screen->mask_op;
131 }
132
133 /* Type of colour manipulation - ANSI/TEK/HP/other */
134 if (set_a_foreground != NULL && set_a_background != NULL)
135 _cursesi_screen->color_type = COLOR_ANSI;
136 else if (initialize_pair != NULL)
137 _cursesi_screen->color_type = COLOR_HP;
138 else if (initialize_color != NULL)
139 _cursesi_screen->color_type = COLOR_TEK;
140 else if (set_foreground != NULL && set_background != NULL)
141 _cursesi_screen->color_type = COLOR_OTHER;
142 else
143 return(ERR); /* Unsupported colour method */
144
145 #ifdef DEBUG
146 __CTRACE(__CTRACE_COLOR, "start_color: COLORS = %d, COLOR_PAIRS = %d",
147 COLORS, COLOR_PAIRS);
148 switch (_cursesi_screen->color_type) {
149 case COLOR_ANSI:
150 __CTRACE(__CTRACE_COLOR, " (ANSI style)\n");
151 break;
152 case COLOR_HP:
153 __CTRACE(__CTRACE_COLOR, " (HP style)\n");
154 break;
155 case COLOR_TEK:
156 __CTRACE(__CTRACE_COLOR, " (Tektronics style)\n");
157 break;
158 case COLOR_OTHER:
159 __CTRACE(__CTRACE_COLOR, " (Other style)\n");
160 break;
161 }
162 #endif
163
164 /*
165 * Attributes that cannot be used with color.
166 * Store these in an attr_t for wattrset()/wattron().
167 */
168 _cursesi_screen->nca = __NORMAL;
169 if (no_color_video != -1) {
170 temp_nc = (attr_t) t_no_color_video(_cursesi_screen->term);
171 if (temp_nc & 0x0001)
172 _cursesi_screen->nca |= __STANDOUT;
173 if (temp_nc & 0x0002)
174 _cursesi_screen->nca |= __UNDERSCORE;
175 if (temp_nc & 0x0004)
176 _cursesi_screen->nca |= __REVERSE;
177 if (temp_nc & 0x0008)
178 _cursesi_screen->nca |= __BLINK;
179 if (temp_nc & 0x0010)
180 _cursesi_screen->nca |= __DIM;
181 if (temp_nc & 0x0020)
182 _cursesi_screen->nca |= __BOLD;
183 if (temp_nc & 0x0040)
184 _cursesi_screen->nca |= __BLANK;
185 if (temp_nc & 0x0080)
186 _cursesi_screen->nca |= __PROTECT;
187 if (temp_nc & 0x0100)
188 _cursesi_screen->nca |= __ALTCHARSET;
189 }
190 #ifdef DEBUG
191 __CTRACE(__CTRACE_COLOR, "start_color: _cursesi_screen->nca = %08x\n",
192 _cursesi_screen->nca);
193 #endif
194
195 /* Set up initial 8 colours */
196 #define RGB_ON 680 /* Allow for bright colours */
197 if (COLORS >= COLOR_BLACK)
198 (void) init_color_value(COLOR_BLACK, 0, 0, 0);
199 if (COLORS >= COLOR_RED)
200 (void) init_color_value(COLOR_RED, RGB_ON, 0, 0);
201 if (COLORS >= COLOR_GREEN)
202 (void) init_color_value(COLOR_GREEN, 0, RGB_ON, 0);
203 if (COLORS >= COLOR_YELLOW)
204 (void) init_color_value(COLOR_YELLOW, RGB_ON, RGB_ON, 0);
205 if (COLORS >= COLOR_BLUE)
206 (void) init_color_value(COLOR_BLUE, 0, 0, RGB_ON);
207 if (COLORS >= COLOR_MAGENTA)
208 (void) init_color_value(COLOR_MAGENTA, RGB_ON, 0, RGB_ON);
209 if (COLORS >= COLOR_CYAN)
210 (void) init_color_value(COLOR_CYAN, 0, RGB_ON, RGB_ON);
211 if (COLORS >= COLOR_WHITE)
212 (void) init_color_value(COLOR_WHITE, RGB_ON, RGB_ON, RGB_ON);
213
214 /* Initialise other colours */
215 for (i = 8; i < COLORS; i++) {
216 _cursesi_screen->colours[i].red = 0;
217 _cursesi_screen->colours[i].green = 0;
218 _cursesi_screen->colours[i].blue = 0;
219 _cursesi_screen->colours[i].flags = 0;
220 }
221
222 /* Initialise pair 0 to default colours. */
223 _cursesi_screen->colour_pairs[0].fore = -1;
224 _cursesi_screen->colour_pairs[0].back = -1;
225 _cursesi_screen->colour_pairs[0].flags = 0;
226
227 /* Initialise user colour pairs to default (white on black) */
228 for (i = 0; i < COLOR_PAIRS; i++) {
229 _cursesi_screen->colour_pairs[i].fore = COLOR_WHITE;
230 _cursesi_screen->colour_pairs[i].back = COLOR_BLACK;
231 _cursesi_screen->colour_pairs[i].flags = 0;
232 }
233
234 /* Initialise default colour pair. */
235 _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].fore =
236 __default_pair.fore;
237 _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].back =
238 __default_pair.back;
239 _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].flags =
240 __default_pair.flags;
241
242 __using_color = 1;
243
244 /* Set all positions on all windows to curses default colours. */
245 for (wlp = _cursesi_screen->winlistp; wlp != NULL; wlp = wlp->nextp) {
246 win = wlp->winp;
247 if (wlp->winp != __virtscr && wlp->winp != curscr) {
248 /* Set color attribute on other windows */
249 win->battr |= __default_color;
250 for (y = 0; y < win->maxy; y++) {
251 for (x = 0; x < win->maxx; x++) {
252 win->alines[y]->line[x].attr &= ~__COLOR;
253 win->alines[y]->line[x].attr |= __default_color;
254 }
255 }
256 __touchwin(win);
257 }
258 }
259
260 return(OK);
261 }
262
263 /*
264 * init_pair --
265 * Set pair foreground and background colors.
266 * Our default colour ordering is ANSI - 1 = red, 4 = blue, 3 = yellow,
267 * 6 = cyan. The older style (Sb/Sf) uses 1 = blue, 4 = red, 3 = cyan,
268 * 6 = yellow, so we swap them here and in pair_content().
269 */
270 int
271 init_pair(short pair, short fore, short back)
272 {
273 int changed;
274
275 #ifdef DEBUG
276 __CTRACE(__CTRACE_COLOR, "init_pair: %d, %d, %d\n", pair, fore, back);
277 #endif
278
279 if (pair < 0 || pair >= COLOR_PAIRS)
280 return (ERR);
281
282 if (pair == 0) /* Ignore request for pair 0, it is default. */
283 return OK;
284
285 if (fore >= COLORS)
286 return (ERR);
287 if (back >= COLORS)
288 return (ERR);
289
290 /* Swap red/blue and yellow/cyan */
291 if (_cursesi_screen->color_type == COLOR_OTHER) {
292 switch (fore) {
293 case COLOR_RED:
294 fore = COLOR_BLUE;
295 break;
296 case COLOR_BLUE:
297 fore = COLOR_RED;
298 break;
299 case COLOR_YELLOW:
300 fore = COLOR_CYAN;
301 break;
302 case COLOR_CYAN:
303 fore = COLOR_YELLOW;
304 break;
305 }
306 switch (back) {
307 case COLOR_RED:
308 back = COLOR_BLUE;
309 break;
310 case COLOR_BLUE:
311 back = COLOR_RED;
312 break;
313 case COLOR_YELLOW:
314 back = COLOR_CYAN;
315 break;
316 case COLOR_CYAN:
317 back = COLOR_YELLOW;
318 break;
319 }
320 }
321
322 if ((_cursesi_screen->colour_pairs[pair].flags & __USED) &&
323 (fore != _cursesi_screen->colour_pairs[pair].fore ||
324 back != _cursesi_screen->colour_pairs[pair].back))
325 changed = 1;
326 else
327 changed = 0;
328
329 _cursesi_screen->colour_pairs[pair].flags |= __USED;
330 _cursesi_screen->colour_pairs[pair].fore = fore;
331 _cursesi_screen->colour_pairs[pair].back = back;
332
333 /* XXX: need to initialise HP style (Ip) */
334
335 if (changed)
336 __change_pair(pair);
337 return (OK);
338 }
339
340 /*
341 * pair_content --
342 * Get pair foreground and background colours.
343 */
344 int
345 pair_content(short pair, short *forep, short *backp)
346 {
347 if (pair < 0 || pair > _cursesi_screen->COLOR_PAIRS)
348 return(ERR);
349
350 *forep = _cursesi_screen->colour_pairs[pair].fore;
351 *backp = _cursesi_screen->colour_pairs[pair].back;
352
353 /* Swap red/blue and yellow/cyan */
354 if (_cursesi_screen->color_type == COLOR_OTHER) {
355 switch (*forep) {
356 case COLOR_RED:
357 *forep = COLOR_BLUE;
358 break;
359 case COLOR_BLUE:
360 *forep = COLOR_RED;
361 break;
362 case COLOR_YELLOW:
363 *forep = COLOR_CYAN;
364 break;
365 case COLOR_CYAN:
366 *forep = COLOR_YELLOW;
367 break;
368 }
369 switch (*backp) {
370 case COLOR_RED:
371 *backp = COLOR_BLUE;
372 break;
373 case COLOR_BLUE:
374 *backp = COLOR_RED;
375 break;
376 case COLOR_YELLOW:
377 *backp = COLOR_CYAN;
378 break;
379 case COLOR_CYAN:
380 *backp = COLOR_YELLOW;
381 break;
382 }
383 }
384 return(OK);
385 }
386
387 /*
388 * init_color_Value --
389 * Set colour red, green and blue values.
390 */
391 static int
392 init_color_value(short color, short red, short green, short blue)
393 {
394 if (color < 0 || color >= _cursesi_screen->COLORS)
395 return ERR;
396
397 _cursesi_screen->colours[color].red = red;
398 _cursesi_screen->colours[color].green = green;
399 _cursesi_screen->colours[color].blue = blue;
400 return OK;
401 }
402
403 /*
404 * init_color --
405 * Set colour red, green and blue values.
406 * Change color on screen.
407 */
408 int
409 init_color(short color, short red, short green, short blue)
410 {
411 #ifdef DEBUG
412 __CTRACE(__CTRACE_COLOR, "init_color: %d, %d, %d, %d\n",
413 color, red, green, blue);
414 #endif
415 if (init_color_value(color, red, green, blue) == ERR)
416 return ERR;
417 if (!can_change || t_initialize_color(_cursesi_screen->term) == NULL)
418 return ERR;
419 tputs(tiparm(t_initialize_color(_cursesi_screen->term),
420 color, red, green, blue), 0, __cputchar);
421 return OK;
422 }
423
424 /*
425 * color_content --
426 * Get colour red, green and blue values.
427 */
428 int
429 color_content(short color, short *redp, short *greenp, short *bluep)
430 {
431 if (color < 0 || color >= _cursesi_screen->COLORS)
432 return(ERR);
433
434 *redp = _cursesi_screen->colours[color].red;
435 *greenp = _cursesi_screen->colours[color].green;
436 *bluep = _cursesi_screen->colours[color].blue;
437 return(OK);
438 }
439
440 /*
441 * use_default_colors --
442 * Use terminal default colours instead of curses default colour.
443 */
444 int
445 use_default_colors()
446 {
447 #ifdef DEBUG
448 __CTRACE(__CTRACE_COLOR, "use_default_colors\n");
449 #endif
450
451 return(assume_default_colors(-1, -1));
452 }
453
454 /*
455 * assume_default_colors --
456 * Set the default foreground and background colours.
457 */
458 int
459 assume_default_colors(short fore, short back)
460 {
461 #ifdef DEBUG
462 __CTRACE(__CTRACE_COLOR, "assume_default_colors: %d, %d\n",
463 fore, back);
464 __CTRACE(__CTRACE_COLOR, "assume_default_colors: default_colour = %d, pair_number = %d\n", __default_color, PAIR_NUMBER(__default_color));
465 #endif
466
467 /* Swap red/blue and yellow/cyan */
468 if (_cursesi_screen->color_type == COLOR_OTHER) {
469 switch (fore) {
470 case COLOR_RED:
471 fore = COLOR_BLUE;
472 break;
473 case COLOR_BLUE:
474 fore = COLOR_RED;
475 break;
476 case COLOR_YELLOW:
477 fore = COLOR_CYAN;
478 break;
479 case COLOR_CYAN:
480 fore = COLOR_YELLOW;
481 break;
482 }
483 switch (back) {
484 case COLOR_RED:
485 back = COLOR_BLUE;
486 break;
487 case COLOR_BLUE:
488 back = COLOR_RED;
489 break;
490 case COLOR_YELLOW:
491 back = COLOR_CYAN;
492 break;
493 case COLOR_CYAN:
494 back = COLOR_YELLOW;
495 break;
496 }
497 }
498 __default_pair.fore = fore;
499 __default_pair.back = back;
500 __default_pair.flags = __USED;
501
502 if (COLOR_PAIRS) {
503 _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].fore = fore;
504 _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].back = back;
505 _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].flags = __USED;
506 }
507
508 /*
509 * If we've already called start_color(), make sure all instances
510 * of the curses default colour pair are dirty.
511 */
512 if (__using_color)
513 __change_pair(PAIR_NUMBER(__default_color));
514
515 return(OK);
516 }
517
518 /* no_color_video is a terminfo macro, but we need to retain binary compat */
519 #ifdef __strong_alias
520 #undef no_color_video
521 __strong_alias(no_color_video, no_color_attributes)
522 #endif
523 /*
524 * no_color_attributes --
525 * Return attributes that cannot be combined with color.
526 */
527 attr_t
528 no_color_attributes(void)
529 {
530 return(_cursesi_screen->nca);
531 }
532
533 /*
534 * __set_color --
535 * Set terminal foreground and background colours.
536 */
537 void
538 __set_color( /*ARGSUSED*/ WINDOW *win, attr_t attr)
539 {
540 short pair;
541
542 if ((curscr->wattr & __COLOR) == (attr & __COLOR))
543 return;
544
545 pair = PAIR_NUMBER((u_int32_t)attr);
546 #ifdef DEBUG
547 __CTRACE(__CTRACE_COLOR, "__set_color: %d, %d, %d\n", pair,
548 _cursesi_screen->colour_pairs[pair].fore,
549 _cursesi_screen->colour_pairs[pair].back);
550 #endif
551 switch (_cursesi_screen->color_type) {
552 /* Set ANSI forground and background colours */
553 case COLOR_ANSI:
554 if (_cursesi_screen->colour_pairs[pair].fore < 0 ||
555 _cursesi_screen->colour_pairs[pair].back < 0)
556 __unset_color(curscr);
557 if (_cursesi_screen->colour_pairs[pair].fore >= 0)
558 tputs(tiparm(t_set_a_foreground(_cursesi_screen->term),
559 (int)_cursesi_screen->colour_pairs[pair].fore),
560 0, __cputchar);
561 if (_cursesi_screen->colour_pairs[pair].back >= 0)
562 tputs(tiparm(t_set_a_background(_cursesi_screen->term),
563 (int)_cursesi_screen->colour_pairs[pair].back),
564 0, __cputchar);
565 break;
566 case COLOR_HP:
567 /* XXX: need to support HP style */
568 break;
569 case COLOR_TEK:
570 /* XXX: need to support Tek style */
571 break;
572 case COLOR_OTHER:
573 if (_cursesi_screen->colour_pairs[pair].fore < 0 ||
574 _cursesi_screen->colour_pairs[pair].back < 0)
575 __unset_color(curscr);
576 if (_cursesi_screen->colour_pairs[pair].fore >= 0)
577 tputs(tiparm(t_set_foreground(_cursesi_screen->term),
578 (int)_cursesi_screen->colour_pairs[pair].fore),
579 0, __cputchar);
580 if (_cursesi_screen->colour_pairs[pair].back >= 0)
581 tputs(tiparm(t_set_background(_cursesi_screen->term),
582 (int)_cursesi_screen->colour_pairs[pair].back),
583 0, __cputchar);
584 break;
585 }
586 curscr->wattr &= ~__COLOR;
587 curscr->wattr |= attr & __COLOR;
588 }
589
590 /*
591 * __unset_color --
592 * Clear terminal foreground and background colours.
593 */
594 void
595 __unset_color(WINDOW *win)
596 {
597 #ifdef DEBUG
598 __CTRACE(__CTRACE_COLOR, "__unset_color\n");
599 #endif
600 switch (_cursesi_screen->color_type) {
601 /* Clear ANSI forground and background colours */
602 case COLOR_ANSI:
603 if (orig_pair != NULL) {
604 tputs(orig_pair, 0, __cputchar);
605 win->wattr &= __mask_op;
606 }
607 break;
608 case COLOR_HP:
609 /* XXX: need to support HP style */
610 break;
611 case COLOR_TEK:
612 /* XXX: need to support Tek style */
613 break;
614 case COLOR_OTHER:
615 if (orig_pair != NULL) {
616 tputs(orig_pair, 0, __cputchar);
617 win->wattr &= __mask_op;
618 }
619 break;
620 }
621 }
622
623 /*
624 * __restore_colors --
625 * Redo color definitions after restarting 'curses' mode.
626 */
627 void
628 __restore_colors(void)
629 {
630 if (can_change != 0)
631 switch (_cursesi_screen->color_type) {
632 case COLOR_HP:
633 /* XXX: need to re-initialise HP style (Ip) */
634 break;
635 case COLOR_TEK:
636 /* XXX: need to re-initialise Tek style (Ic) */
637 break;
638 }
639 }
640
641 /*
642 * __change_pair --
643 * Mark dirty all positions using pair.
644 */
645 void
646 __change_pair(short pair)
647 {
648 struct __winlist *wlp;
649 WINDOW *win;
650 int y, x;
651 __LINE *lp;
652 uint32_t cl = COLOR_PAIR(pair);
653
654
655 for (wlp = _cursesi_screen->winlistp; wlp != NULL; wlp = wlp->nextp) {
656 #ifdef DEBUG
657 __CTRACE(__CTRACE_COLOR, "__change_pair: win = %p\n",
658 wlp->winp);
659 #endif
660 win = wlp->winp;
661 if (win == __virtscr)
662 continue;
663 else if (win == curscr) {
664 /* Reset colour attribute on curscr */
665 #ifdef DEBUG
666 __CTRACE(__CTRACE_COLOR,
667 "__change_pair: win == curscr\n");
668 #endif
669 for (y = 0; y < curscr->maxy; y++) {
670 lp = curscr->alines[y];
671 for (x = 0; x < curscr->maxx; x++) {
672 if ((lp->line[x].attr & __COLOR) == cl)
673 lp->line[x].attr &= ~__COLOR;
674 }
675 }
676 } else {
677 /* Mark dirty those positions with colour pair "pair" */
678 for (y = 0; y < win->maxy; y++) {
679 lp = win->alines[y];
680 for (x = 0; x < win->maxx; x++)
681 if ((lp->line[x].attr &
682 __COLOR) == cl) {
683 if (!(lp->flags & __ISDIRTY))
684 lp->flags |= __ISDIRTY;
685 /*
686 * firstchp/lastchp are shared
687 * between parent window and
688 * sub-window.
689 */
690 if (*lp->firstchp > x)
691 *lp->firstchp = x;
692 if (*lp->lastchp < x)
693 *lp->lastchp = x;
694 }
695 #ifdef DEBUG
696 if ((win->alines[y]->flags & __ISDIRTY))
697 __CTRACE(__CTRACE_COLOR,
698 "__change_pair: first = %d, "
699 "last = %d\n",
700 *win->alines[y]->firstchp,
701 *win->alines[y]->lastchp);
702 #endif
703 }
704 }
705 }
706 }
707