ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/screen.C
(Generate patch)

Comparing rxvt-unicode/src/screen.C (file contents):
Revision 1.2 by pcg, Mon Nov 24 17:31:27 2003 UTC vs.
Revision 1.3 by pcg, Tue Nov 25 11:52:42 2003 UTC

1/*--------------------------------*-C-*--------------------------------------* 1/*--------------------------------*-C-*--------------------------------------*
2 * File: screen.c 2 * File: screen.c
3 *---------------------------------------------------------------------------* 3 *---------------------------------------------------------------------------*
4 * $Id: screen.C,v 1.2 2003/11/24 17:31:27 pcg Exp $ 4 * $Id: screen.C,v 1.3 2003/11/25 11:52:42 pcg Exp $
5 * 5 *
6 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 6 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
164 rend_t setrstyle; 164 rend_t setrstyle;
165 165
166 D_SCREEN((stderr, "rxvt_scr_reset()")); 166 D_SCREEN((stderr, "rxvt_scr_reset()"));
167 167
168 R->TermWin.view_start = 0; 168 R->TermWin.view_start = 0;
169 RESET_CHSTAT(R->h); 169 RESET_CHSTAT(R);
170 R->h->num_scr = 0; 170 R->num_scr = 0;
171 171
172 prev_ncol = R->h->prev_ncol; 172 prev_ncol = R->prev_ncol;
173 prev_nrow = R->h->prev_nrow; 173 prev_nrow = R->prev_nrow;
174 if (R->TermWin.ncol == 0) 174 if (R->TermWin.ncol == 0)
175 R->TermWin.ncol = 80; 175 R->TermWin.ncol = 80;
176 if (R->TermWin.nrow == 0) 176 if (R->TermWin.nrow == 0)
177 R->TermWin.nrow = 24; 177 R->TermWin.nrow = 24;
178 ncol = R->TermWin.ncol; 178 ncol = R->TermWin.ncol;
179 nrow = R->TermWin.nrow; 179 nrow = R->TermWin.nrow;
180 if (ncol == prev_ncol && nrow == prev_nrow) 180 if (ncol == prev_ncol && nrow == prev_nrow)
181 return; 181 return;
182 182
183 R->h->want_refresh = 1; 183 R->want_refresh = 1;
184 184
185 total_rows = nrow + R->TermWin.saveLines; 185 total_rows = nrow + R->TermWin.saveLines;
186 prev_total_rows = prev_nrow + R->TermWin.saveLines; 186 prev_total_rows = prev_nrow + R->TermWin.saveLines;
187 187
188 R->screen.tscroll = 0; 188 R->screen.tscroll = 0;
214 p, DEFAULT_RSTYLE); 214 p, DEFAULT_RSTYLE);
215 R->screen.tlen[q] = R->swap.tlen[p] = 0; 215 R->screen.tlen[q] = R->swap.tlen[p] = 0;
216 rxvt_blank_screen_mem(aR_ R->drawn_text, R->drawn_rend, 216 rxvt_blank_screen_mem(aR_ R->drawn_text, R->drawn_rend,
217 p, DEFAULT_RSTYLE); 217 p, DEFAULT_RSTYLE);
218 } 218 }
219 MEMSET(R->h->charsets, 'B', sizeof(R->h->charsets)); 219 MEMSET(R->charsets, 'B', sizeof(R->charsets));
220 R->TermWin.nscrolled = 0; /* no saved lines */ 220 R->TermWin.nscrolled = 0; /* no saved lines */
221 R->h->rstyle = DEFAULT_RSTYLE; 221 R->rstyle = DEFAULT_RSTYLE;
222 R->screen.flags = Screen_DefaultFlags; 222 R->screen.flags = Screen_DefaultFlags;
223 R->screen.cur.row = R->screen.cur.col = 0; 223 R->screen.cur.row = R->screen.cur.col = 0;
224 R->screen.charset = 0; 224 R->screen.charset = 0;
225 R->h->current_screen = PRIMARY; 225 R->current_screen = PRIMARY;
226 rxvt_scr_cursor(aR_ SAVE); 226 rxvt_scr_cursor(aR_ SAVE);
227#if NSCREENS 227#if NSCREENS
228 R->swap.flags = Screen_DefaultFlags; 228 R->swap.flags = Screen_DefaultFlags;
229 R->swap.cur.row = R->swap.cur.col = 0; 229 R->swap.cur.row = R->swap.cur.col = 0;
230 R->swap.charset = 0; 230 R->swap.charset = 0;
231 R->h->current_screen = SECONDARY; 231 R->current_screen = SECONDARY;
232 rxvt_scr_cursor(aR_ SAVE); 232 rxvt_scr_cursor(aR_ SAVE);
233 R->h->current_screen = PRIMARY; 233 R->current_screen = PRIMARY;
234#endif 234#endif
235 R->selection.text = NULL; 235 R->selection.text = NULL;
236 R->selection.len = 0; 236 R->selection.len = 0;
237 R->selection.op = SELECTION_CLEAR; 237 R->selection.op = SELECTION_CLEAR;
238 R->selection.screen = PRIMARY; 238 R->selection.screen = PRIMARY;
239 R->selection.clicks = 0; 239 R->selection.clicks = 0;
240 CLEAR_ALL_SELECTION(R); 240 CLEAR_ALL_SELECTION(R);
241 R->h->rvideo = 0; 241 R->rvideo = 0;
242 242
243 } else { 243 } else {
244/* 244/*
245 * B1: add or delete rows as appropriate 245 * B1: add or delete rows as appropriate
246 */ 246 */
360 R->tabs = (char *)rxvt_malloc(ncol * sizeof(char)); 360 R->tabs = (char *)rxvt_malloc(ncol * sizeof(char));
361 361
362 for (p = 0; p < ncol; p++) 362 for (p = 0; p < ncol; p++)
363 R->tabs[p] = (p % TABSIZE == 0) ? 1 : 0; 363 R->tabs[p] = (p % TABSIZE == 0) ? 1 : 0;
364 364
365 R->h->prev_nrow = nrow; 365 R->prev_nrow = nrow;
366 R->h->prev_ncol = ncol; 366 R->prev_ncol = ncol;
367 367
368 rxvt_tt_winsize(R->cmd_fd, R->TermWin.ncol, R->TermWin.nrow, R->h->cmd_pid); 368 rxvt_tt_winsize(R->cmd_fd, R->TermWin.ncol, R->TermWin.nrow, R->cmd_pid);
369} 369}
370 370
371/* INTPROTO */ 371/* INTPROTO */
372void 372void
373rxvt_scr_reset_realloc(pR) 373rxvt_scr_reset_realloc(pR)
449rxvt_scr_poweron(pR) 449rxvt_scr_poweron(pR)
450{ 450{
451 D_SCREEN((stderr, "rxvt_scr_poweron()")); 451 D_SCREEN((stderr, "rxvt_scr_poweron()"));
452 452
453 rxvt_scr_release(aR); 453 rxvt_scr_release(aR);
454 R->h->prev_nrow = R->h->prev_ncol = 0; 454 R->prev_nrow = R->prev_ncol = 0;
455 rxvt_scr_reset(aR); 455 rxvt_scr_reset(aR);
456 456
457 rxvt_scr_clear(aR); 457 rxvt_scr_clear(aR);
458 rxvt_scr_refresh(aR_ SLOW_REFRESH); 458 rxvt_scr_refresh(aR_ SLOW_REFRESH);
459#ifdef RXVT_GRAPHICS 459#ifdef RXVT_GRAPHICS
476 screen_t *s; 476 screen_t *s;
477 477
478 D_SCREEN((stderr, "rxvt_scr_cursor(%c)", mode)); 478 D_SCREEN((stderr, "rxvt_scr_cursor(%c)", mode));
479 479
480#if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) 480#if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR)
481 if (R->h->current_screen == SECONDARY) 481 if (R->current_screen == SECONDARY)
482 s = &(R->swap); 482 s = &(R->swap);
483 else 483 else
484#endif 484#endif
485 s = &(R->screen); 485 s = &(R->screen);
486 switch (mode) { 486 switch (mode) {
487 case SAVE: 487 case SAVE:
488 s->s_cur.row = s->cur.row; 488 s->s_cur.row = s->cur.row;
489 s->s_cur.col = s->cur.col; 489 s->s_cur.col = s->cur.col;
490 s->s_rstyle = R->h->rstyle; 490 s->s_rstyle = R->rstyle;
491 s->s_charset = s->charset; 491 s->s_charset = s->charset;
492 s->s_charset_char = R->h->charsets[s->charset]; 492 s->s_charset_char = R->charsets[s->charset];
493 break; 493 break;
494 case RESTORE: 494 case RESTORE:
495 R->h->want_refresh = 1; 495 R->want_refresh = 1;
496 s->cur.row = s->s_cur.row; 496 s->cur.row = s->s_cur.row;
497 s->cur.col = s->s_cur.col; 497 s->cur.col = s->s_cur.col;
498 s->flags &= ~Screen_WrapNext; 498 s->flags &= ~Screen_WrapNext;
499 R->h->rstyle = s->s_rstyle; 499 R->rstyle = s->s_rstyle;
500 s->charset = s->s_charset; 500 s->charset = s->s_charset;
501 R->h->charsets[s->charset] = s->s_charset_char; 501 R->charsets[s->charset] = s->s_charset_char;
502 rxvt_set_font_style(aR); 502 rxvt_set_font_style(aR);
503 break; 503 break;
504 } 504 }
505/* boundary check in case screen size changed between SAVE and RESTORE */ 505/* boundary check in case screen size changed between SAVE and RESTORE */
506 MIN_IT(s->cur.row, R->TermWin.nrow - 1); 506 MIN_IT(s->cur.row, R->TermWin.nrow - 1);
527 int i; 527 int i;
528#if NSCREENS 528#if NSCREENS
529 int offset; 529 int offset;
530#endif 530#endif
531 531
532 R->h->want_refresh = 1; 532 R->want_refresh = 1;
533 533
534 D_SCREEN((stderr, "rxvt_scr_change_screen(%d)", scrn)); 534 D_SCREEN((stderr, "rxvt_scr_change_screen(%d)", scrn));
535 535
536 R->TermWin.view_start = 0; 536 R->TermWin.view_start = 0;
537 RESET_CHSTAT(R->h); 537 RESET_CHSTAT(R);
538 538
539 if (R->h->current_screen == scrn) 539 if (R->current_screen == scrn)
540 return R->h->current_screen; 540 return R->current_screen;
541 541
542 rxvt_selection_check(aR_ 2); /* check for boundary cross */ 542 rxvt_selection_check(aR_ 2); /* check for boundary cross */
543 543
544 SWAP_IT(R->h->current_screen, scrn, int); 544 SWAP_IT(R->current_screen, scrn, int);
545#if NSCREENS 545#if NSCREENS
546 R->h->num_scr = 0; 546 R->num_scr = 0;
547 offset = R->TermWin.saveLines; 547 offset = R->TermWin.saveLines;
548 for (i = R->h->prev_nrow; i--;) { 548 for (i = R->prev_nrow; i--;) {
549 SWAP_IT(R->screen.text[i + offset], R->swap.text[i], text_t *); 549 SWAP_IT(R->screen.text[i + offset], R->swap.text[i], text_t *);
550 SWAP_IT(R->screen.tlen[i + offset], R->swap.tlen[i], int16_t); 550 SWAP_IT(R->screen.tlen[i + offset], R->swap.tlen[i], int16_t);
551 SWAP_IT(R->screen.rend[i + offset], R->swap.rend[i], rend_t *); 551 SWAP_IT(R->screen.rend[i + offset], R->swap.rend[i], rend_t *);
552 } 552 }
553 SWAP_IT(R->screen.cur.row, R->swap.cur.row, int16_t); 553 SWAP_IT(R->screen.cur.row, R->swap.cur.row, int16_t);
554 SWAP_IT(R->screen.cur.col, R->swap.cur.col, int16_t); 554 SWAP_IT(R->screen.cur.col, R->swap.cur.col, int16_t);
555# ifdef DEBUG_STRICT 555# ifdef DEBUG_STRICT
556 assert((R->screen.cur.row >= 0) && (R->screen.cur.row < R->h->prev_nrow)); 556 assert((R->screen.cur.row >= 0) && (R->screen.cur.row < R->prev_nrow));
557 assert((R->screen.cur.col >= 0) && (R->screen.cur.col < R->h->prev_ncol)); 557 assert((R->screen.cur.col >= 0) && (R->screen.cur.col < R->prev_ncol));
558# else /* drive with your eyes closed */ 558# else /* drive with your eyes closed */
559 MAX_IT(R->screen.cur.row, 0); 559 MAX_IT(R->screen.cur.row, 0);
560 MIN_IT(R->screen.cur.row, (int32_t)R->h->prev_nrow - 1); 560 MIN_IT(R->screen.cur.row, (int32_t)R->prev_nrow - 1);
561 MAX_IT(R->screen.cur.col, 0); 561 MAX_IT(R->screen.cur.col, 0);
562 MIN_IT(R->screen.cur.col, (int32_t)R->h->prev_ncol - 1); 562 MIN_IT(R->screen.cur.col, (int32_t)R->prev_ncol - 1);
563# endif 563# endif
564 SWAP_IT(R->screen.charset, R->swap.charset, int16_t); 564 SWAP_IT(R->screen.charset, R->swap.charset, int16_t);
565 SWAP_IT(R->screen.flags, R->swap.flags, int); 565 SWAP_IT(R->screen.flags, R->swap.flags, int);
566 R->screen.flags |= Screen_VisibleCursor; 566 R->screen.flags |= Screen_VisibleCursor;
567 R->swap.flags |= Screen_VisibleCursor; 567 R->swap.flags |= Screen_VisibleCursor;
577# ifdef SCROLL_ON_NO_SECONDARY 577# ifdef SCROLL_ON_NO_SECONDARY
578# ifdef RXVT_GRAPHICS 578# ifdef RXVT_GRAPHICS
579 if (rxvt_Gr_Displayed(aR)) 579 if (rxvt_Gr_Displayed(aR))
580 rxvt_Gr_ClearScreen(aR); 580 rxvt_Gr_ClearScreen(aR);
581# endif 581# endif
582 if (R->h->current_screen == PRIMARY 582 if (R->current_screen == PRIMARY
583# ifdef RXVT_GRAPHICS 583# ifdef RXVT_GRAPHICS
584 && !rxvt_Gr_Displayed(aR) 584 && !rxvt_Gr_Displayed(aR)
585# endif 585# endif
586 ) 586 )
587 rxvt_scroll_text(aR_ 0, (R->h->prev_nrow - 1), R->h->prev_nrow, 0); 587 rxvt_scroll_text(aR_ 0, (R->prev_nrow - 1), R->prev_nrow, 0);
588# endif 588# endif
589#endif 589#endif
590 return scrn; 590 return scrn;
591} 591}
592 592
598void 598void
599rxvt_scr_color(pR_ unsigned int color, int fgbg) 599rxvt_scr_color(pR_ unsigned int color, int fgbg)
600{ 600{
601 color &= RS_fgMask; 601 color &= RS_fgMask;
602 if (fgbg == Color_fg) 602 if (fgbg == Color_fg)
603 R->h->rstyle = SET_FGCOLOR(R->h->rstyle, color); 603 R->rstyle = SET_FGCOLOR(R->rstyle, color);
604 else 604 else
605 R->h->rstyle = SET_BGCOLOR(R->h->rstyle, color); 605 R->rstyle = SET_BGCOLOR(R->rstyle, color);
606} 606}
607 607
608/* ------------------------------------------------------------------------- */ 608/* ------------------------------------------------------------------------- */
609/* 609/*
610 * Change the rendition style for following text 610 * Change the rendition style for following text
612/* EXTPROTO */ 612/* EXTPROTO */
613void 613void
614rxvt_scr_rendition(pR_ int set, int style) 614rxvt_scr_rendition(pR_ int set, int style)
615{ 615{
616 if (set) 616 if (set)
617 R->h->rstyle |= style; 617 R->rstyle |= style;
618 else if (style == ~RS_None) 618 else if (style == ~RS_None)
619 R->h->rstyle = DEFAULT_RSTYLE; 619 R->rstyle = DEFAULT_RSTYLE;
620 else 620 else
621 R->h->rstyle &= ~style; 621 R->rstyle &= ~style;
622} 622}
623 623
624/* ------------------------------------------------------------------------- */ 624/* ------------------------------------------------------------------------- */
625/* 625/*
626 * Scroll text between <row1> and <row2> inclusive, by <count> lines 626 * Scroll text between <row1> and <row2> inclusive, by <count> lines
636 long nscrolled; 636 long nscrolled;
637 637
638 if (count == 0 || (row1 > row2)) 638 if (count == 0 || (row1 > row2))
639 return 0; 639 return 0;
640 640
641 R->h->want_refresh = 1; 641 R->want_refresh = 1;
642 D_SCREEN((stderr, "rxvt_scroll_text(%d,%d,%d,%d): %s", row1, row2, count, spec, (R->h->current_screen == PRIMARY) ? "Primary" : "Secondary")); 642 D_SCREEN((stderr, "rxvt_scroll_text(%d,%d,%d,%d): %s", row1, row2, count, spec, (R->current_screen == PRIMARY) ? "Primary" : "Secondary"));
643 643
644 if ((count > 0) && (row1 == 0) && (R->h->current_screen == PRIMARY)) { 644 if ((count > 0) && (row1 == 0) && (R->current_screen == PRIMARY)) {
645 nscrolled = (long)R->TermWin.nscrolled + (long)count;; 645 nscrolled = (long)R->TermWin.nscrolled + (long)count;;
646 if (nscrolled > (long)R->TermWin.saveLines) 646 if (nscrolled > (long)R->TermWin.saveLines)
647 R->TermWin.nscrolled = R->TermWin.saveLines; 647 R->TermWin.nscrolled = R->TermWin.saveLines;
648 else 648 else
649 R->TermWin.nscrolled = (uint16_t)nscrolled; 649 R->TermWin.nscrolled = (uint16_t)nscrolled;
653 rxvt_scr_page(aR_ UP, count); 653 rxvt_scr_page(aR_ UP, count);
654 } else if (!spec) 654 } else if (!spec)
655 row1 += R->TermWin.saveLines; 655 row1 += R->TermWin.saveLines;
656 row2 += R->TermWin.saveLines; 656 row2 += R->TermWin.saveLines;
657 657
658 if (R->selection.op && R->h->current_screen == R->selection.screen) { 658 if (R->selection.op && R->current_screen == R->selection.screen) {
659 i = R->selection.beg.row + R->TermWin.saveLines; 659 i = R->selection.beg.row + R->TermWin.saveLines;
660 j = R->selection.end.row + R->TermWin.saveLines; 660 j = R->selection.end.row + R->TermWin.saveLines;
661 if ((i < row1 && j > row1) 661 if ((i < row1 && j > row1)
662 || (i < row2 && j > row2) 662 || (i < row2 && j > row2)
663 || (i - count < row1 && i >= row1) 663 || (i - count < row1 && i >= row1)
673 R->selection.mark.row -= count; 673 R->selection.mark.row -= count;
674 } 674 }
675 } 675 }
676 rxvt_selection_check(aR_ 0); /* _after_ R->TermWin.nscrolled update */ 676 rxvt_selection_check(aR_ 0); /* _after_ R->TermWin.nscrolled update */
677 677
678 R->h->num_scr += count; 678 R->num_scr += count;
679 j = count; 679 j = count;
680 if (count < 0) 680 if (count < 0)
681 count = -count; 681 count = -count;
682 i = row2 - row1 + 1; 682 i = row2 - row1 + 1;
683 MIN_IT(count, i); 683 MIN_IT(count, i);
720 R->screen.tlen[j] = 0; 720 R->screen.tlen[j] = 0;
721 R->screen.text[j] = R->buf_text[i]; 721 R->screen.text[j] = R->buf_text[i];
722 R->screen.rend[j] = R->buf_rend[i]; 722 R->screen.rend[j] = R->buf_rend[i];
723 if (!spec) /* line length may not equal TermWin.ncol */ 723 if (!spec) /* line length may not equal TermWin.ncol */
724 rxvt_blank_screen_mem(aR_ R->screen.text, R->screen.rend, 724 rxvt_blank_screen_mem(aR_ R->screen.text, R->screen.rend,
725 (unsigned int)j, R->h->rstyle); 725 (unsigned int)j, R->rstyle);
726 } 726 }
727 727
728#ifdef RXVT_GRAPHICS 728#ifdef RXVT_GRAPHICS
729 if (rxvt_Gr_Displayed(aR)) 729 if (rxvt_Gr_Displayed(aR))
730 rxvt_Gr_scroll(aR_ count); 730 rxvt_Gr_scroll(aR_ count);
743 unsigned char checksel, clearsel; 743 unsigned char checksel, clearsel;
744 uint32_t c; 744 uint32_t c;
745 int i, row, last_col; 745 int i, row, last_col;
746 text_t *stp; 746 text_t *stp;
747 rend_t *srp; 747 rend_t *srp;
748 struct rxvt_hidden *h = R->h;
749 748
750 if (len <= 0) /* sanity */ 749 if (len <= 0) /* sanity */
751 return; 750 return;
752 751
753 h->want_refresh = 1; 752 R->want_refresh = 1;
754 last_col = R->TermWin.ncol; 753 last_col = R->TermWin.ncol;
755 754
756 D_SCREEN((stderr, "rxvt_scr_add_lines(%d,%d)", nlines, len)); 755 D_SCREEN((stderr, "rxvt_scr_add_lines(%d,%d)", nlines, len));
757 ZERO_SCROLLBACK(R); 756 ZERO_SCROLLBACK(R);
758 if (nlines > 0) { 757 if (nlines > 0) {
776 MAX_IT(R->screen.cur.row, -(int32_t)R->TermWin.nscrolled); 775 MAX_IT(R->screen.cur.row, -(int32_t)R->TermWin.nscrolled);
777#endif 776#endif
778 row = R->screen.cur.row + R->TermWin.saveLines; 777 row = R->screen.cur.row + R->TermWin.saveLines;
779 778
780 checksel = (R->selection.op 779 checksel = (R->selection.op
781 && h->current_screen == R->selection.screen) ? 1 : 0; 780 && R->current_screen == R->selection.screen) ? 1 : 0;
782 clearsel = 0; 781 clearsel = 0;
783 782
784 stp = R->screen.text[row]; 783 stp = R->screen.text[row];
785 srp = R->screen.rend[row]; 784 srp = R->screen.rend[row];
786 785
798 rxvt_scroll_text(aR_ R->screen.tscroll, R->screen.bscroll, 1, 0); 797 rxvt_scroll_text(aR_ R->screen.tscroll, R->screen.bscroll, 1, 0);
799 else if (R->screen.cur.row < (R->TermWin.nrow - 1)) 798 else if (R->screen.cur.row < (R->TermWin.nrow - 1))
800 row = (++R->screen.cur.row) + R->TermWin.saveLines; 799 row = (++R->screen.cur.row) + R->TermWin.saveLines;
801 stp = R->screen.text[row]; /* _must_ refresh */ 800 stp = R->screen.text[row]; /* _must_ refresh */
802 srp = R->screen.rend[row]; /* _must_ refresh */ 801 srp = R->screen.rend[row]; /* _must_ refresh */
803 RESET_CHSTAT(h); 802 RESET_CHSTAT(R);
804 continue; 803 continue;
805 case '\r': 804 case '\r':
806 if (R->screen.tlen[row] != -1) /* XXX: think about this */ 805 if (R->screen.tlen[row] != -1) /* XXX: think about this */
807 MAX_IT(R->screen.tlen[row], R->screen.cur.col); 806 MAX_IT(R->screen.tlen[row], R->screen.cur.col);
808 R->screen.flags &= ~Screen_WrapNext; 807 R->screen.flags &= ~Screen_WrapNext;
809 R->screen.cur.col = 0; 808 R->screen.cur.col = 0;
810 RESET_CHSTAT(h); 809 RESET_CHSTAT(R);
811 continue; 810 continue;
812 default: 811 default:
813 if (c == 127) 812 if (c == 127)
814 continue; /* yummmm..... */ 813 continue; /* yummmm..... */
815 break; 814 break;
833 R->screen.flags &= ~Screen_WrapNext; 832 R->screen.flags &= ~Screen_WrapNext;
834 } 833 }
835 if (R->screen.flags & Screen_Insert) 834 if (R->screen.flags & Screen_Insert)
836 rxvt_scr_insdel_chars(aR_ 1, INSERT); 835 rxvt_scr_insdel_chars(aR_ 1, INSERT);
837 836
838 if (R->h->charsets[R->screen.charset] == '0') // DEC SPECIAL 837 if (R->charsets[R->screen.charset] == '0') // DEC SPECIAL
839 switch (c) 838 switch (c)
840 { 839 {
841 case '+': c = 0x2192; break; case ',': c = 0x2190; break; case '-': c = 0x2191; break; 840 case '+': c = 0x2192; break; case ',': c = 0x2190; break; case '-': c = 0x2191; break;
842 case '.': c = 0x2193; break; case '0': c = 0x25ae; break; case '`': c = 0x25c6; break; 841 case '.': c = 0x2193; break; case '0': c = 0x25ae; break; case '`': c = 0x25c6; break;
843 case 'a': c = 0x2592; break; case 'f': c = 0x00b0; break; case 'g': c = 0x00b1; break; 842 case 'a': c = 0x2592; break; case 'f': c = 0x00b0; break; case 'g': c = 0x00b1; break;
849 case 'w': c = 0x252c; break; case 'x': c = 0x2502; break; case 'y': c = 0x2264; break; 848 case 'w': c = 0x252c; break; case 'x': c = 0x2502; break; case 'y': c = 0x2264; break;
850 case 'z': c = 0x2265; break; case '{': c = 0x03c0; break; case '|': c = 0x2260; break; 849 case 'z': c = 0x2265; break; case '{': c = 0x03c0; break; case '|': c = 0x2260; break;
851 case '}': c = 0x00a3; break; case '~': c = 0x00b7; break; 850 case '}': c = 0x00a3; break; case '~': c = 0x00b7; break;
852 } 851 }
853 852
854 rend_t rend = SET_FONT (h->rstyle, R->TermWin.fontset->find_font (c)); 853 rend_t rend = SET_FONT (R->rstyle, R->TermWin.fontset->find_font (c));
855 854
856 stp[R->screen.cur.col] = c; 855 stp[R->screen.cur.col] = c;
857 srp[R->screen.cur.col] = rend; 856 srp[R->screen.cur.col] = rend;
858 857
859 if (c > 255) 858 if (c > 255)
908 */ 907 */
909/* EXTPROTO */ 908/* EXTPROTO */
910void 909void
911rxvt_scr_backspace(pR) 910rxvt_scr_backspace(pR)
912{ 911{
913 RESET_CHSTAT(R->h); 912 RESET_CHSTAT(R);
914 R->h->want_refresh = 1; 913 R->want_refresh = 1;
915 if (R->screen.cur.col == 0) { 914 if (R->screen.cur.col == 0) {
916 if (R->screen.cur.row > 0) { 915 if (R->screen.cur.row > 0) {
917#ifdef TERMCAP_HAS_BW 916#ifdef TERMCAP_HAS_BW
918 R->screen.cur.col = R->TermWin.ncol - 1; 917 R->screen.cur.col = R->TermWin.ncol - 1;
919 R->screen.cur.row--; 918 R->screen.cur.row--;
936rxvt_scr_tab(pR_ int count) 935rxvt_scr_tab(pR_ int count)
937{ 936{
938 int i, x; 937 int i, x;
939 938
940 D_SCREEN((stderr, "rxvt_scr_tab(%d)", count)); 939 D_SCREEN((stderr, "rxvt_scr_tab(%d)", count));
941 R->h->want_refresh = 1; 940 R->want_refresh = 1;
942 RESET_CHSTAT(R->h); 941 RESET_CHSTAT(R);
943 i = x = R->screen.cur.col; 942 i = x = R->screen.cur.col;
944 if (count == 0) 943 if (count == 0)
945 return; 944 return;
946 else if (count > 0) { 945 else if (count > 0) {
947 for (; ++i < R->TermWin.ncol; ) 946 for (; ++i < R->TermWin.ncol; )
1022 */ 1021 */
1023/* EXTPROTO */ 1022/* EXTPROTO */
1024void 1023void
1025rxvt_scr_gotorc(pR_ int row, int col, int relative) 1024rxvt_scr_gotorc(pR_ int row, int col, int relative)
1026{ 1025{
1027 R->h->want_refresh = 1; 1026 R->want_refresh = 1;
1028 ZERO_SCROLLBACK(R); 1027 ZERO_SCROLLBACK(R);
1029 RESET_CHSTAT(R->h); 1028 RESET_CHSTAT(R);
1030#ifdef RXVT_GRAPHICS 1029#ifdef RXVT_GRAPHICS
1031 if (rxvt_Gr_Displayed(aR)) 1030 if (rxvt_Gr_Displayed(aR))
1032 rxvt_Gr_scroll(aR_ 0); 1031 rxvt_Gr_scroll(aR_ 0);
1033#endif 1032#endif
1034 1033
1073void 1072void
1074rxvt_scr_index(pR_ enum page_dirn direction) 1073rxvt_scr_index(pR_ enum page_dirn direction)
1075{ 1074{
1076 int dirn; 1075 int dirn;
1077 1076
1078 R->h->want_refresh = 1; 1077 R->want_refresh = 1;
1079 dirn = ((direction == UP) ? 1 : -1); 1078 dirn = ((direction == UP) ? 1 : -1);
1080 D_SCREEN((stderr, "rxvt_scr_index(%d)", dirn)); 1079 D_SCREEN((stderr, "rxvt_scr_index(%d)", dirn));
1081 1080
1082 ZERO_SCROLLBACK(R); 1081 ZERO_SCROLLBACK(R);
1083 RESET_CHSTAT(R->h); 1082 RESET_CHSTAT(R);
1084 1083
1085#ifdef RXVT_GRAPHICS 1084#ifdef RXVT_GRAPHICS
1086 if (rxvt_Gr_Displayed(aR)) 1085 if (rxvt_Gr_Displayed(aR))
1087 rxvt_Gr_scroll(aR_ 0); 1086 rxvt_Gr_scroll(aR_ 0);
1088#endif 1087#endif
1109void 1108void
1110rxvt_scr_erase_line(pR_ int mode) 1109rxvt_scr_erase_line(pR_ int mode)
1111{ 1110{
1112 unsigned int row, col, num; 1111 unsigned int row, col, num;
1113 1112
1114 R->h->want_refresh = 1; 1113 R->want_refresh = 1;
1115 D_SCREEN((stderr, "rxvt_scr_erase_line(%d) at screen row: %d", mode, R->screen.cur.row)); 1114 D_SCREEN((stderr, "rxvt_scr_erase_line(%d) at screen row: %d", mode, R->screen.cur.row));
1116 ZERO_SCROLLBACK(R); 1115 ZERO_SCROLLBACK(R);
1117 RESET_CHSTAT(R->h); 1116 RESET_CHSTAT(R);
1118 1117
1119#ifdef RXVT_GRAPHICS 1118#ifdef RXVT_GRAPHICS
1120 if (rxvt_Gr_Displayed(aR)) 1119 if (rxvt_Gr_Displayed(aR))
1121 rxvt_Gr_scroll(aR_ 0); 1120 rxvt_Gr_scroll(aR_ 0);
1122#endif 1121#endif
1154 return; 1153 return;
1155 } 1154 }
1156 if (R->screen.text[row]) 1155 if (R->screen.text[row])
1157 rxvt_blank_line(aR_ 1156 rxvt_blank_line(aR_
1158 &(R->screen.text[row][col]), 1157 &(R->screen.text[row][col]),
1159 &(R->screen.rend[row][col]), num, R->h->rstyle); 1158 &(R->screen.rend[row][col]), num, R->rstyle);
1160 else 1159 else
1161 rxvt_blank_screen_mem(aR_ R->screen.text, R->screen.rend, row, 1160 rxvt_blank_screen_mem(aR_ R->screen.text, R->screen.rend, row,
1162 R->h->rstyle); 1161 R->rstyle);
1163} 1162}
1164 1163
1165/* ------------------------------------------------------------------------- */ 1164/* ------------------------------------------------------------------------- */
1166/* 1165/*
1167 * Erase part of whole of the screen 1166 * Erase part of whole of the screen
1176 int num; 1175 int num;
1177 int32_t row, row_offset; 1176 int32_t row, row_offset;
1178 rend_t ren; 1177 rend_t ren;
1179 XGCValues gcvalue; 1178 XGCValues gcvalue;
1180 1179
1181 R->h->want_refresh = 1; 1180 R->want_refresh = 1;
1182 D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, R->screen.cur.row)); 1181 D_SCREEN((stderr, "rxvt_scr_erase_screen(%d) at screen row: %d", mode, R->screen.cur.row));
1183 ZERO_SCROLLBACK(R); 1182 ZERO_SCROLLBACK(R);
1184 RESET_CHSTAT(R->h); 1183 RESET_CHSTAT(R);
1185 row_offset = (int32_t)R->TermWin.saveLines; 1184 row_offset = (int32_t)R->TermWin.saveLines;
1186 1185
1187 switch (mode) { 1186 switch (mode) {
1188 case 0: /* erase to end of screen */ 1187 case 0: /* erase to end of screen */
1189 rxvt_selection_check(aR_ 1); 1188 rxvt_selection_check(aR_ 1);
1206 num = R->TermWin.nrow; 1205 num = R->TermWin.nrow;
1207 break; 1206 break;
1208 default: 1207 default:
1209 return; 1208 return;
1210 } 1209 }
1211 R->h->refresh_type |= REFRESH_BOUNDS; 1210 R->refresh_type |= REFRESH_BOUNDS;
1212 if (R->selection.op && R->h->current_screen == R->selection.screen 1211 if (R->selection.op && R->current_screen == R->selection.screen
1213 && ((R->selection.beg.row >= row && R->selection.beg.row <= row + num) 1212 && ((R->selection.beg.row >= row && R->selection.beg.row <= row + num)
1214 || (R->selection.end.row >= row 1213 || (R->selection.end.row >= row
1215 && R->selection.end.row <= row + num))) 1214 && R->selection.end.row <= row + num)))
1216 CLEAR_SELECTION(R); 1215 CLEAR_SELECTION(R);
1217 if (row >= R->TermWin.nrow) /* Out Of Bounds */ 1216 if (row >= R->TermWin.nrow) /* Out Of Bounds */
1218 return; 1217 return;
1219 MIN_IT(num, (R->TermWin.nrow - row)); 1218 MIN_IT(num, (R->TermWin.nrow - row));
1220 if (R->h->rstyle & (RS_RVid | RS_Uline)) 1219 if (R->rstyle & (RS_RVid | RS_Uline))
1221 ren = (rend_t) ~RS_None; 1220 ren = (rend_t) ~RS_None;
1222 else if (GET_BASEBG(R->h->rstyle) == Color_bg) { 1221 else if (GET_BASEBG(R->rstyle) == Color_bg) {
1223 ren = DEFAULT_RSTYLE; 1222 ren = DEFAULT_RSTYLE;
1224 CLEAR_ROWS(row, num); 1223 CLEAR_ROWS(row, num);
1225 } else { 1224 } else {
1226 ren = (R->h->rstyle & (RS_fgMask | RS_bgMask)); 1225 ren = (R->rstyle & (RS_fgMask | RS_bgMask));
1227 gcvalue.foreground = R->PixColors[GET_BGCOLOR(R->h->rstyle)]; 1226 gcvalue.foreground = R->PixColors[GET_BGCOLOR(R->rstyle)];
1228 XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcvalue); 1227 XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcvalue);
1229 ERASE_ROWS(row, num); 1228 ERASE_ROWS(row, num);
1230 gcvalue.foreground = R->PixColors[Color_fg]; 1229 gcvalue.foreground = R->PixColors[Color_fg];
1231 XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcvalue); 1230 XChangeGC(R->Xdisplay, R->TermWin.gc, GCForeground, &gcvalue);
1232 } 1231 }
1233 for (; num--; row++) { 1232 for (; num--; row++) {
1234 rxvt_blank_screen_mem(aR_ R->screen.text, R->screen.rend, 1233 rxvt_blank_screen_mem(aR_ R->screen.text, R->screen.rend,
1235 (unsigned int)(row + row_offset), R->h->rstyle); 1234 (unsigned int)(row + row_offset), R->rstyle);
1236 R->screen.tlen[row + row_offset] = 0; 1235 R->screen.tlen[row + row_offset] = 0;
1237 rxvt_blank_line(aR_ 1236 rxvt_blank_line(aR_
1238 R->drawn_text[row], R->drawn_rend[row], 1237 R->drawn_text[row], R->drawn_rend[row],
1239 (unsigned int)R->TermWin.ncol, ren); 1238 (unsigned int)R->TermWin.ncol, ren);
1240 } 1239 }
1250rxvt_scr_E(pR) 1249rxvt_scr_E(pR)
1251{ 1250{
1252 int i, j, k; 1251 int i, j, k;
1253 rend_t *r1, fs; 1252 rend_t *r1, fs;
1254 1253
1255 R->h->want_refresh = 1; 1254 R->want_refresh = 1;
1256 R->h->num_scr_allow = 0; 1255 R->num_scr_allow = 0;
1257 ZERO_SCROLLBACK(R); 1256 ZERO_SCROLLBACK(R);
1258 RESET_CHSTAT(R->h); 1257 RESET_CHSTAT(R);
1259 rxvt_selection_check(aR_ 3); 1258 rxvt_selection_check(aR_ 3);
1260 1259
1261 fs = SET_FONT (R->h->rstyle, R->TermWin.fontset->find_font ('E')); 1260 fs = SET_FONT (R->rstyle, R->TermWin.fontset->find_font ('E'));
1262 for (k = R->TermWin.saveLines, i = R->TermWin.nrow; i--; k++) { 1261 for (k = R->TermWin.saveLines, i = R->TermWin.nrow; i--; k++) {
1263 R->screen.tlen[k] = R->TermWin.ncol; /* make the `E's selectable */ 1262 R->screen.tlen[k] = R->TermWin.ncol; /* make the `E's selectable */
1264 fill_text (R->screen.text[k], 'E', R->TermWin.ncol); 1263 fill_text (R->screen.text[k], 'E', R->TermWin.ncol);
1265 for (r1 = R->screen.rend[k], j = R->TermWin.ncol; j--; ) 1264 for (r1 = R->screen.rend[k], j = R->TermWin.ncol; j--; )
1266 *r1++ = fs; 1265 *r1++ = fs;
1276rxvt_scr_insdel_lines(pR_ int count, int insdel) 1275rxvt_scr_insdel_lines(pR_ int count, int insdel)
1277{ 1276{
1278 int end; 1277 int end;
1279 1278
1280 ZERO_SCROLLBACK(R); 1279 ZERO_SCROLLBACK(R);
1281 RESET_CHSTAT(R->h); 1280 RESET_CHSTAT(R);
1282 1281
1283#ifdef RXVT_GRAPHICS 1282#ifdef RXVT_GRAPHICS
1284 if (rxvt_Gr_Displayed(aR)) 1283 if (rxvt_Gr_Displayed(aR))
1285 rxvt_Gr_scroll(aR_ 0); 1284 rxvt_Gr_scroll(aR_ 0);
1286#endif 1285#endif
1315 rend_t tr; 1314 rend_t tr;
1316 text_t *stp; 1315 text_t *stp;
1317 rend_t *srp; 1316 rend_t *srp;
1318 int16_t *slp; 1317 int16_t *slp;
1319 1318
1320 R->h->want_refresh = 1; 1319 R->want_refresh = 1;
1321 ZERO_SCROLLBACK(R); 1320 ZERO_SCROLLBACK(R);
1322#if 0 1321#if 0
1323 RESET_CHSTAT(R->h); 1322 RESET_CHSTAT(R);
1324#endif 1323#endif
1325 1324
1326#ifdef RXVT_GRAPHICS 1325#ifdef RXVT_GRAPHICS
1327 if (rxvt_Gr_Displayed(aR)) 1326 if (rxvt_Gr_Displayed(aR))
1328 rxvt_Gr_scroll(aR_ 0); 1327 rxvt_Gr_scroll(aR_ 0);
1349 } 1348 }
1350 if (*slp != -1) { 1349 if (*slp != -1) {
1351 *slp += count; 1350 *slp += count;
1352 MIN_IT(*slp, R->TermWin.ncol); 1351 MIN_IT(*slp, R->TermWin.ncol);
1353 } 1352 }
1354 if (R->selection.op && R->h->current_screen == R->selection.screen 1353 if (R->selection.op && R->current_screen == R->selection.screen
1355 && ROWCOL_IN_ROW_AT_OR_AFTER(R->selection.beg, R->screen.cur)) { 1354 && ROWCOL_IN_ROW_AT_OR_AFTER(R->selection.beg, R->screen.cur)) {
1356 if (R->selection.end.row != R->screen.cur.row 1355 if (R->selection.end.row != R->screen.cur.row
1357 || (R->selection.end.col + count >= R->TermWin.ncol)) 1356 || (R->selection.end.col + count >= R->TermWin.ncol))
1358 CLEAR_SELECTION(R); 1357 CLEAR_SELECTION(R);
1359 else { /* shift selection */ 1358 else { /* shift selection */
1361 R->selection.mark.col += count; /* XXX: yes? */ 1360 R->selection.mark.col += count; /* XXX: yes? */
1362 R->selection.end.col += count; 1361 R->selection.end.col += count;
1363 } 1362 }
1364 } 1363 }
1365 rxvt_blank_line(aR_ &(stp[R->screen.cur.col]), &(srp[R->screen.cur.col]), 1364 rxvt_blank_line(aR_ &(stp[R->screen.cur.col]), &(srp[R->screen.cur.col]),
1366 (unsigned int)count, R->h->rstyle); 1365 (unsigned int)count, R->rstyle);
1367 break; 1366 break;
1368 case ERASE: 1367 case ERASE:
1369 R->screen.cur.col += count; /* don't worry if > R->TermWin.ncol */ 1368 R->screen.cur.col += count; /* don't worry if > R->TermWin.ncol */
1370 rxvt_selection_check(aR_ 1); 1369 rxvt_selection_check(aR_ 1);
1371 R->screen.cur.col -= count; 1370 R->screen.cur.col -= count;
1372 rxvt_blank_line(aR_ &(stp[R->screen.cur.col]), &(srp[R->screen.cur.col]), 1371 rxvt_blank_line(aR_ &(stp[R->screen.cur.col]), &(srp[R->screen.cur.col]),
1373 (unsigned int)count, R->h->rstyle); 1372 (unsigned int)count, R->rstyle);
1374 break; 1373 break;
1375 case DELETE: 1374 case DELETE:
1376 tr = srp[R->TermWin.ncol - 1] 1375 tr = srp[R->TermWin.ncol - 1]
1377 & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1376 & (RS_fgMask | RS_bgMask | RS_baseattrMask);
1378 for (col = R->screen.cur.col; (col + count) < R->TermWin.ncol; col++) { 1377 for (col = R->screen.cur.col; (col + count) < R->TermWin.ncol; col++) {
1385 (unsigned int)count, tr); 1384 (unsigned int)count, tr);
1386 if (*slp == -1) /* break line continuation */ 1385 if (*slp == -1) /* break line continuation */
1387 *slp = R->TermWin.ncol; 1386 *slp = R->TermWin.ncol;
1388 *slp -= count; 1387 *slp -= count;
1389 MAX_IT(*slp, 0); 1388 MAX_IT(*slp, 0);
1390 if (R->selection.op && R->h->current_screen == R->selection.screen 1389 if (R->selection.op && R->current_screen == R->selection.screen
1391 && ROWCOL_IN_ROW_AT_OR_AFTER(R->selection.beg, R->screen.cur)) { 1390 && ROWCOL_IN_ROW_AT_OR_AFTER(R->selection.beg, R->screen.cur)) {
1392 if (R->selection.end.row != R->screen.cur.row 1391 if (R->selection.end.row != R->screen.cur.row
1393 || (R->screen.cur.col >= R->selection.beg.col - count) 1392 || (R->screen.cur.col >= R->selection.beg.col - count)
1394 || R->selection.end.col >= R->TermWin.ncol) 1393 || R->selection.end.col >= R->TermWin.ncol)
1395 CLEAR_SELECTION(R); 1394 CLEAR_SELECTION(R);
1430 */ 1429 */
1431/* EXTPROTO */ 1430/* EXTPROTO */
1432void 1431void
1433rxvt_scr_cursor_visible(pR_ int mode) 1432rxvt_scr_cursor_visible(pR_ int mode)
1434{ 1433{
1435 R->h->want_refresh = 1; 1434 R->want_refresh = 1;
1436 if (mode) 1435 if (mode)
1437 R->screen.flags |= Screen_VisibleCursor; 1436 R->screen.flags |= Screen_VisibleCursor;
1438 else 1437 else
1439 R->screen.flags &= ~Screen_VisibleCursor; 1438 R->screen.flags &= ~Screen_VisibleCursor;
1440} 1439}
1519void 1518void
1520rxvt_scr_rvideo_mode(pR_ int mode) 1519rxvt_scr_rvideo_mode(pR_ int mode)
1521{ 1520{
1522 XGCValues gcvalue; 1521 XGCValues gcvalue;
1523 1522
1524 if (R->h->rvideo != mode) { 1523 if (R->rvideo != mode) {
1525 R->h->rvideo = mode; 1524 R->rvideo = mode;
1526 SWAP_IT(R->PixColors[Color_fg], R->PixColors[Color_bg], rxvt_color); 1525 SWAP_IT(R->PixColors[Color_fg], R->PixColors[Color_bg], rxvt_color);
1527#if defined(XPM_BACKGROUND) 1526#if defined(XPM_BACKGROUND)
1528 if (R->h->bgPixmap.pixmap == None) 1527 if (R->bgPixmap.pixmap == None)
1529#endif 1528#endif
1530#if defined(TRANSPARENT) 1529#if defined(TRANSPARENT)
1531 if (!(R->Options & Opt_transparent) || R->h->am_transparent == 0) 1530 if (!(R->Options & Opt_transparent) || R->am_transparent == 0)
1532#endif 1531#endif
1533 XSetWindowBackground(R->Xdisplay, R->TermWin.vt, 1532 XSetWindowBackground(R->Xdisplay, R->TermWin.vt,
1534 R->PixColors[Color_bg]); 1533 R->PixColors[Color_bg]);
1535 1534
1536 gcvalue.foreground = R->PixColors[Color_fg]; 1535 gcvalue.foreground = R->PixColors[Color_fg];
1564 */ 1563 */
1565/* INTPROTO */ 1564/* INTPROTO */
1566void 1565void
1567rxvt_set_font_style(pR) 1566rxvt_set_font_style(pR)
1568{ 1567{
1569 switch (R->h->charsets[R->screen.charset]) { 1568 switch (R->charsets[R->screen.charset]) {
1570 case '0': /* DEC Special Character & Line Drawing Set */ 1569 case '0': /* DEC Special Character & Line Drawing Set */
1571 break; 1570 break;
1572 case 'A': /* United Kingdom (UK) */ 1571 case 'A': /* United Kingdom (UK) */
1573 break; 1572 break;
1574 case 'B': /* United States (USASCII) */ 1573 case 'B': /* United States (USASCII) */
1611 */ 1610 */
1612/* EXTPROTO */ 1611/* EXTPROTO */
1613void 1612void
1614rxvt_scr_charset_set(pR_ int set, unsigned int ch) 1613rxvt_scr_charset_set(pR_ int set, unsigned int ch)
1615{ 1614{
1616 R->h->charsets[set] = (unsigned char)ch; 1615 R->charsets[set] = (unsigned char)ch;
1617 rxvt_set_font_style(aR); 1616 rxvt_set_font_style(aR);
1618} 1617}
1619 1618
1620 1619
1621/* ------------------------------------------------------------------------- * 1620/* ------------------------------------------------------------------------- *
1625#ifdef RXVT_GRAPHICS 1624#ifdef RXVT_GRAPHICS
1626/* EXTPROTO */ 1625/* EXTPROTO */
1627int 1626int
1628rxvt_scr_get_fgcolor(pR) 1627rxvt_scr_get_fgcolor(pR)
1629{ 1628{
1630 return GET_FGCOLOR(R->h->rstyle); 1629 return GET_FGCOLOR(R->rstyle);
1631} 1630}
1632 1631
1633/* ------------------------------------------------------------------------- */ 1632/* ------------------------------------------------------------------------- */
1634/* EXTPROTO */ 1633/* EXTPROTO */
1635int 1634int
1636rxvt_scr_get_bgcolor(pR) 1635rxvt_scr_get_bgcolor(pR)
1637{ 1636{
1638 return GET_BGCOLOR(R->h->rstyle); 1637 return GET_BGCOLOR(R->rstyle);
1639} 1638}
1640#endif 1639#endif
1641 1640
1642/* ------------------------------------------------------------------------- * 1641/* ------------------------------------------------------------------------- *
1643 * MAJOR SCREEN MANIPULATION * 1642 * MAJOR SCREEN MANIPULATION *
1757/* INTPROTO */ 1756/* INTPROTO */
1758int 1757int
1759rxvt_scr_changeview(pR_ uint16_t oldviewstart) 1758rxvt_scr_changeview(pR_ uint16_t oldviewstart)
1760{ 1759{
1761 if (R->TermWin.view_start != oldviewstart) { 1760 if (R->TermWin.view_start != oldviewstart) {
1762 R->h->want_refresh = 1; 1761 R->want_refresh = 1;
1763#ifdef RXVT_GRAPHICS 1762#ifdef RXVT_GRAPHICS
1764 if (rxvt_Gr_Displayed(aR)) 1763 if (rxvt_Gr_Displayed(aR))
1765 rxvt_Gr_scroll(aR_ 0); 1764 rxvt_Gr_scroll(aR_ 0);
1766#endif 1765#endif
1767 R->h->num_scr -= (R->TermWin.view_start - oldviewstart); 1766 R->num_scr -= (R->TermWin.view_start - oldviewstart);
1768 } 1767 }
1769 return (int)(R->TermWin.view_start - oldviewstart); 1768 return (int)(R->TermWin.view_start - oldviewstart);
1770} 1769}
1771 1770
1772/* ------------------------------------------------------------------------- */ 1771/* ------------------------------------------------------------------------- */
1780 if (R->Options & Opt_mapAlert) 1779 if (R->Options & Opt_mapAlert)
1781# endif 1780# endif
1782 XMapWindow(R->Xdisplay, R->TermWin.parent[0]); 1781 XMapWindow(R->Xdisplay, R->TermWin.parent[0]);
1783# endif 1782# endif
1784 if (R->Options & Opt_visualBell) { 1783 if (R->Options & Opt_visualBell) {
1785 rxvt_scr_rvideo_mode(aR_ !R->h->rvideo); /* refresh also done */ 1784 rxvt_scr_rvideo_mode(aR_ !R->rvideo); /* refresh also done */
1786 rxvt_scr_rvideo_mode(aR_ !R->h->rvideo); /* refresh also done */ 1785 rxvt_scr_rvideo_mode(aR_ !R->rvideo); /* refresh also done */
1787 } else 1786 } else
1788 XBell(R->Xdisplay, 0); 1787 XBell(R->Xdisplay, 0);
1789#endif 1788#endif
1790} 1789}
1791 1790
1870 rend_t cc1; /* store colours at cursor position(s) */ 1869 rend_t cc1; /* store colours at cursor position(s) */
1871 rend_t cc2; /* store colours at cursor position(s) */ 1870 rend_t cc2; /* store colours at cursor position(s) */
1872#endif 1871#endif
1873 rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */ 1872 rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */
1874 text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */ 1873 text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */
1875 char *buffer; /* local copy of R->h->buffer */ 1874 char *buffer; /* local copy of R->buffer */
1876 struct rxvt_hidden *h = R->h;
1877 1875
1878 if (refresh_type == NO_REFRESH || !R->TermWin.mapped) 1876 if (refresh_type == NO_REFRESH || !R->TermWin.mapped)
1879 return; 1877 return;
1880 1878
1881/* 1879/*
1884 clearfirst = clearlast = must_clear = wbyte = 0; 1882 clearfirst = clearlast = must_clear = wbyte = 0;
1885#ifndef NO_BOLDFONT 1883#ifndef NO_BOLDFONT
1886 bfont = 0; 1884 bfont = 0;
1887#endif 1885#endif
1888 1886
1889 if (h->currmaxcol < R->TermWin.ncol) { 1887 if (R->currmaxcol < R->TermWin.ncol) {
1890 h->currmaxcol = R->TermWin.ncol; 1888 R->currmaxcol = R->TermWin.ncol;
1891 h->buffer = (char *)rxvt_realloc (h->buffer, 1889 R->buffer = (char *)rxvt_realloc (R->buffer,
1892 sizeof(char) * (h->currmaxcol + 1) * MB_CUR_MAX); 1890 sizeof(char) * (R->currmaxcol + 1) * MB_CUR_MAX);
1893 } 1891 }
1894 buffer = h->buffer; 1892 buffer = R->buffer;
1895 h->refresh_count = 0; 1893 R->refresh_count = 0;
1896 1894
1897 row_offset = R->TermWin.saveLines - R->TermWin.view_start; 1895 row_offset = R->TermWin.saveLines - R->TermWin.view_start;
1898 1896
1899 if ((refresh_type & REFRESH_BOUNDS)) { 1897 if ((refresh_type & REFRESH_BOUNDS)) {
1900 clearfirst = clearlast = 1; 1898 clearfirst = clearlast = 1;
1901 h->refresh_type &= ~REFRESH_BOUNDS; 1899 R->refresh_type &= ~REFRESH_BOUNDS;
1902 } 1900 }
1903#if defined(XPM_BACKGROUND) 1901#if defined(XPM_BACKGROUND)
1904 must_clear |= (h->bgPixmap.pixmap != None); 1902 must_clear |= (R->bgPixmap.pixmap != None);
1905#endif 1903#endif
1906#if defined(TRANSPARENT) 1904#if defined(TRANSPARENT)
1907 must_clear |= ((R->Options & Opt_transparent) && h->am_transparent); 1905 must_clear |= ((R->Options & Opt_transparent) && R->am_transparent);
1908#endif 1906#endif
1909 ocrow = h->oldcursor.row; /* is there an old outline cursor on screen? */ 1907 ocrow = R->oldcursor.row; /* is there an old outline cursor on screen? */
1910 1908
1911/* 1909/*
1912 * B: reverse any characters which are selected 1910 * B: reverse any characters which are selected
1913 */ 1911 */
1914 rxvt_scr_reverse_selection(aR); 1912 rxvt_scr_reverse_selection(aR);
1922 ccol2; /* Cursor colour2 */ 1920 ccol2; /* Cursor colour2 */
1923 1921
1924 showcursor = (R->screen.flags & Screen_VisibleCursor); 1922 showcursor = (R->screen.flags & Screen_VisibleCursor);
1925 cursorwidth = 0; 1923 cursorwidth = 0;
1926#ifdef CURSOR_BLINK 1924#ifdef CURSOR_BLINK
1927 if (R->h->hidden_cursor) 1925 if (R->hidden_cursor)
1928 showcursor = 0; 1926 showcursor = 0;
1929#endif 1927#endif
1930 1928
1931 cursorwidth = 0; 1929 cursorwidth = 0;
1932 1930
1940 if (showcursor && R->TermWin.focus) 1938 if (showcursor && R->TermWin.focus)
1941 { 1939 {
1942 *srp ^= RS_RVid; 1940 *srp ^= RS_RVid;
1943#ifndef NO_CURSORCOLOR 1941#ifndef NO_CURSORCOLOR
1944 cc1 = *srp & (RS_fgMask | RS_bgMask); 1942 cc1 = *srp & (RS_fgMask | RS_bgMask);
1945 if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_cursor)) 1943 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor))
1946 ccol1 = Color_cursor; 1944 ccol1 = Color_cursor;
1947 else 1945 else
1948#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 1946#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
1949 ccol1 = GET_FGCOLOR(h->rstyle); 1947 ccol1 = GET_FGCOLOR(R->rstyle);
1950#else 1948#else
1951 ccol1 = Color_fg; 1949 ccol1 = Color_fg;
1952#endif 1950#endif
1953 if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_cursor2)) 1951 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor2))
1954 ccol2 = Color_cursor2; 1952 ccol2 = Color_cursor2;
1955 else 1953 else
1956#ifdef CURSOR_COLOR_IS_RENDITION_COLOR 1954#ifdef CURSOR_COLOR_IS_RENDITION_COLOR
1957 ccol2 = GET_BGCOLOR(h->rstyle); 1955 ccol2 = GET_BGCOLOR(R->rstyle);
1958#else 1956#else
1959 ccol2 = Color_bg; 1957 ccol2 = Color_bg;
1960#endif 1958#endif
1961 *srp = SET_FGCOLOR(*srp, ccol1); 1959 *srp = SET_FGCOLOR(*srp, ccol1);
1962 *srp = SET_BGCOLOR(*srp, ccol2); 1960 *srp = SET_BGCOLOR(*srp, ccol2);
1969 1967
1970 /* make sure no outline cursor is left around */ 1968 /* make sure no outline cursor is left around */
1971 setoldcursor = 0; 1969 setoldcursor = 0;
1972 if (ocrow != -1) { 1970 if (ocrow != -1) {
1973 if (R->screen.cur.row + R->TermWin.view_start != ocrow 1971 if (R->screen.cur.row + R->TermWin.view_start != ocrow
1974 || R->screen.cur.col != h->oldcursor.col) { 1972 || R->screen.cur.col != R->oldcursor.col) {
1975 if (ocrow < R->TermWin.nrow 1973 if (ocrow < R->TermWin.nrow
1976 && h->oldcursor.col < R->TermWin.ncol) { 1974 && R->oldcursor.col < R->TermWin.ncol) {
1977 R->drawn_rend[ocrow][h->oldcursor.col] ^= (RS_RVid | RS_Uline); 1975 R->drawn_rend[ocrow][R->oldcursor.col] ^= (RS_RVid | RS_Uline);
1978 } 1976 }
1979 if (R->TermWin.focus || !showcursor) 1977 if (R->TermWin.focus || !showcursor)
1980 h->oldcursor.row = -1; 1978 R->oldcursor.row = -1;
1981 else 1979 else
1982 setoldcursor = 1; 1980 setoldcursor = 1;
1983 } 1981 }
1984 } else if (!R->TermWin.focus) 1982 } else if (!R->TermWin.focus)
1985 setoldcursor = 1; 1983 setoldcursor = 1;
1986 if (setoldcursor) { 1984 if (setoldcursor) {
1987 if (R->screen.cur.row + R->TermWin.view_start >= R->TermWin.nrow) 1985 if (R->screen.cur.row + R->TermWin.view_start >= R->TermWin.nrow)
1988 h->oldcursor.row = -1; 1986 R->oldcursor.row = -1;
1989 else { 1987 else {
1990 h->oldcursor.row = R->screen.cur.row + R->TermWin.view_start; 1988 R->oldcursor.row = R->screen.cur.row + R->TermWin.view_start;
1991 h->oldcursor.col = R->screen.cur.col; 1989 R->oldcursor.col = R->screen.cur.col;
1992 } 1990 }
1993 } 1991 }
1994 } 1992 }
1995 1993
1996#ifndef NO_SLOW_LINK_SUPPORT 1994#ifndef NO_SLOW_LINK_SUPPORT
1997/* 1995/*
1998 * D: CopyArea pass - very useful for slower links 1996 * D: CopyArea pass - very useful for slower links
1999 * This has been deliberately kept simple. 1997 * This has been deliberately kept simple.
2000 */ 1998 */
2001 i = h->num_scr; 1999 i = R->num_scr;
2002 if (refresh_type == FAST_REFRESH && h->num_scr_allow && i 2000 if (refresh_type == FAST_REFRESH && R->num_scr_allow && i
2003 && abs(i) < R->TermWin.nrow && !must_clear) { 2001 && abs(i) < R->TermWin.nrow && !must_clear) {
2004 int16_t nits; 2002 int16_t nits;
2005 int j; 2003 int j;
2006 rend_t *drp2; 2004 rend_t *drp2;
2007 text_t *dtp2; 2005 text_t *dtp2;
2136 2134
2137 rvid = (rend & RS_RVid) ? 1 : 0; 2135 rvid = (rend & RS_RVid) ? 1 : 0;
2138#ifdef OPTION_HC 2136#ifdef OPTION_HC
2139 if (!rvid && (rend & RS_Blink)) 2137 if (!rvid && (rend & RS_Blink))
2140 { 2138 {
2141 if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_HC)) 2139 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_HC))
2142 back = Color_HC; 2140 back = Color_HC;
2143 else 2141 else
2144 rvid = !rvid; /* fall back */ 2142 rvid = !rvid; /* fall back */
2145 } 2143 }
2146#endif 2144#endif
2147 if (rvid) 2145 if (rvid)
2148 { 2146 {
2149 SWAP_IT(fore, back, int); 2147 SWAP_IT(fore, back, int);
2150 2148
2151#ifndef NO_BOLD_UNDERLINE_REVERSE 2149#ifndef NO_BOLD_UNDERLINE_REVERSE
2152 if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_RV) 2150 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_RV)
2153# ifndef NO_CURSORCOLOR 2151# ifndef NO_CURSORCOLOR
2154 && !ISSET_PIXCOLOR(h, Color_cursor) 2152 && !ISSET_PIXCOLOR(R, Color_cursor)
2155# endif 2153# endif
2156 ) 2154 )
2157 back = Color_RV; 2155 back = Color_RV;
2158#endif 2156#endif
2159 } 2157 }
2160#ifndef NO_BOLD_UNDERLINE_REVERSE 2158#ifndef NO_BOLD_UNDERLINE_REVERSE
2161 else if (rend & RS_Bold) 2159 else if (rend & RS_Bold)
2162 { 2160 {
2163 if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_BD)) 2161 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_BD))
2164 { 2162 {
2165 fore = Color_BD; 2163 fore = Color_BD;
2166# ifndef VERYBOLD 2164# ifndef VERYBOLD
2167 rend &= ~RS_Bold; /* we've taken care of it */ 2165 rend &= ~RS_Bold; /* we've taken care of it */
2168# endif 2166# endif
2169 } 2167 }
2170 } 2168 }
2171 else if (rend & RS_Uline) 2169 else if (rend & RS_Uline)
2172 { 2170 {
2173 if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_UL)) 2171 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_UL))
2174 { 2172 {
2175 fore = Color_UL; 2173 fore = Color_UL;
2176 rend &= ~RS_Uline; /* we've taken care of it */ 2174 rend &= ~RS_Uline; /* we've taken care of it */
2177 } 2175 }
2178 } 2176 }
2216 [R->screen.cur.col]); 2214 [R->screen.cur.col]);
2217 *srp ^= RS_RVid; 2215 *srp ^= RS_RVid;
2218#ifndef NO_CURSORCOLOR 2216#ifndef NO_CURSORCOLOR
2219 *srp = (*srp & ~(RS_fgMask | RS_bgMask)) | cc1; 2217 *srp = (*srp & ~(RS_fgMask | RS_bgMask)) | cc1;
2220#endif 2218#endif
2221 } else if (h->oldcursor.row >= 0) { 2219 } else if (R->oldcursor.row >= 0) {
2222#ifndef NO_CURSORCOLOR 2220#ifndef NO_CURSORCOLOR
2223 unsigned long gcmask; /* Graphics Context mask */ 2221 unsigned long gcmask; /* Graphics Context mask */
2224 2222
2225 if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_cursor)) { 2223 if (XDEPTH > 2 && ISSET_PIXCOLOR(R, Color_cursor)) {
2226 XSetForeground (R->Xdisplay, R->TermWin.gc, R->PixColors[Color_cursor]); 2224 XSetForeground (R->Xdisplay, R->TermWin.gc, R->PixColors[Color_cursor]);
2227 } 2225 }
2228#endif 2226#endif
2229 XDrawRectangle(R->Xdisplay, drawBuffer, R->TermWin.gc, 2227 XDrawRectangle(R->Xdisplay, drawBuffer, R->TermWin.gc,
2230 Col2Pixel(h->oldcursor.col), 2228 Col2Pixel(R->oldcursor.col),
2231 Row2Pixel(h->oldcursor.row), 2229 Row2Pixel(R->oldcursor.row),
2232 (unsigned int)(Width2Pixel(cursorwidth) - 1), 2230 (unsigned int)(Width2Pixel(cursorwidth) - 1),
2233 (unsigned int)(Height2Pixel(1) - R->TermWin.lineSpace - 1)); 2231 (unsigned int)(Height2Pixel(1) - R->TermWin.lineSpace - 1));
2234 } 2232 }
2235 } 2233 }
2236/* 2234/*
2259 (unsigned int)R->TermWin.int_bwidth, 2257 (unsigned int)R->TermWin.int_bwidth,
2260 (unsigned int)TermWin_TotalHeight(), False); 2258 (unsigned int)TermWin_TotalHeight(), False);
2261 if (refresh_type & SMOOTH_REFRESH) 2259 if (refresh_type & SMOOTH_REFRESH)
2262 XSync(R->Xdisplay, False); 2260 XSync(R->Xdisplay, False);
2263 2261
2264 h->num_scr = 0; 2262 R->num_scr = 0;
2265 h->num_scr_allow = 1; 2263 R->num_scr_allow = 1;
2266 h->want_refresh = 0; /* screen is current */ 2264 R->want_refresh = 0; /* screen is current */
2267} 2265}
2268/* ------------------------------------------------------------------------- */ 2266/* ------------------------------------------------------------------------- */
2269 2267
2270/* EXTPROTO */ 2268/* EXTPROTO */
2271void 2269void
2272rxvt_scr_clear(pR) 2270rxvt_scr_clear(pR)
2273{ 2271{
2274 if (!R->TermWin.mapped) 2272 if (!R->TermWin.mapped)
2275 return; 2273 return;
2276 R->h->num_scr_allow = 0; 2274 R->num_scr_allow = 0;
2277 R->h->want_refresh = 1; 2275 R->want_refresh = 1;
2278#ifdef TRANSPARENT 2276#ifdef TRANSPARENT
2279 if ((R->Options & Opt_transparent) && (R->h->am_pixmap_trans == 0)) { 2277 if ((R->Options & Opt_transparent) && (R->am_pixmap_trans == 0)) {
2280 int i; 2278 int i;
2281 2279
2282 if (!(R->Options & Opt_transparent_all)) 2280 if (!(R->Options & Opt_transparent_all))
2283 i = 0; 2281 i = 0;
2284 else 2282 else
2297rxvt_scr_reverse_selection(pR) 2295rxvt_scr_reverse_selection(pR)
2298{ 2296{
2299 int i, col, row, end_row; 2297 int i, col, row, end_row;
2300 rend_t *srp; 2298 rend_t *srp;
2301 2299
2302 if (R->selection.op && R->h->current_screen == R->selection.screen) { 2300 if (R->selection.op && R->current_screen == R->selection.screen) {
2303 end_row = R->TermWin.saveLines - R->TermWin.view_start; 2301 end_row = R->TermWin.saveLines - R->TermWin.view_start;
2304 i = R->selection.beg.row + R->TermWin.saveLines; 2302 i = R->selection.beg.row + R->TermWin.saveLines;
2305 row = R->selection.end.row + R->TermWin.saveLines; 2303 row = R->selection.end.row + R->TermWin.saveLines;
2306 if (i >= end_row) 2304 if (i >= end_row)
2307 col = R->selection.beg.col; 2305 col = R->selection.beg.col;
2380 || (R->selection.mark.row < -(int32_t)R->TermWin.nscrolled) 2378 || (R->selection.mark.row < -(int32_t)R->TermWin.nscrolled)
2381 || (R->selection.mark.row >= R->TermWin.nrow) 2379 || (R->selection.mark.row >= R->TermWin.nrow)
2382 || (R->selection.end.row < -(int32_t)R->TermWin.nscrolled) 2380 || (R->selection.end.row < -(int32_t)R->TermWin.nscrolled)
2383 || (R->selection.end.row >= R->TermWin.nrow) 2381 || (R->selection.end.row >= R->TermWin.nrow)
2384 || (check_more == 1 2382 || (check_more == 1
2385 && R->h->current_screen == R->selection.screen 2383 && R->current_screen == R->selection.screen
2386 && !ROWCOL_IS_BEFORE(R->screen.cur, R->selection.beg) 2384 && !ROWCOL_IS_BEFORE(R->screen.cur, R->selection.beg)
2387 && ROWCOL_IS_BEFORE(R->screen.cur, R->selection.end)) 2385 && ROWCOL_IS_BEFORE(R->screen.cur, R->selection.end))
2388 || (check_more == 2 2386 || (check_more == 2
2389 && ROWCOL_IS_BEFORE(R->selection.beg, pos) 2387 && ROWCOL_IS_BEFORE(R->selection.beg, pos)
2390 && ROWCOL_IS_AFTER(R->selection.end, pos)) 2388 && ROWCOL_IS_AFTER(R->selection.end, pos))
2434#ifdef MULTICHAR_SET 2432#ifdef MULTICHAR_SET
2435 int dummy_count; 2433 int dummy_count;
2436 char **cl; 2434 char **cl;
2437#endif 2435#endif
2438 2436
2439 D_SELECT((stderr, "rxvt_selection_paste(%08lx, %lu, %d), wait=%2x", win, (unsigned long)prop, (int)delete_prop, R->h->selection_wait)); 2437 D_SELECT((stderr, "rxvt_selection_paste(%08lx, %lu, %d), wait=%2x", win, (unsigned long)prop, (int)delete_prop, R->selection_wait));
2440 2438
2441 if (prop == None) { /* check for failed XConvertSelection */ 2439 if (prop == None) { /* check for failed XConvertSelection */
2442#ifdef MULTICHAR_SET 2440#ifdef MULTICHAR_SET
2443 if ((R->h->selection_type & Sel_CompoundText)) { 2441 if ((R->selection_type & Sel_CompoundText)) {
2444 int selnum = R->h->selection_type & Sel_whereMask; 2442 int selnum = R->selection_type & Sel_whereMask;
2445 2443
2446 R->h->selection_type = 0; 2444 R->selection_type = 0;
2447 if (selnum != Sel_direct) 2445 if (selnum != Sel_direct)
2448 rxvt_selection_request_other(aR_ XA_STRING, selnum); 2446 rxvt_selection_request_other(aR_ XA_STRING, selnum);
2449 } 2447 }
2450#endif 2448#endif
2451 return 0; 2449 return 0;
2465 D_SELECT((stderr, "rxvt_selection_paste: property shooting blanks!")); 2463 D_SELECT((stderr, "rxvt_selection_paste: property shooting blanks!"));
2466 continue; 2464 continue;
2467 } 2465 }
2468 if (ct.nitems == 0) { 2466 if (ct.nitems == 0) {
2469 D_SELECT((stderr, "rxvt_selection_paste: property empty - also INCR end")); 2467 D_SELECT((stderr, "rxvt_selection_paste: property empty - also INCR end"));
2470 if (R->h->selection_wait == Sel_normal && nread == 0) { 2468 if (R->selection_wait == Sel_normal && nread == 0) {
2471 /* 2469 /*
2472 * pass through again trying CUT_BUFFER0 if we've come from 2470 * pass through again trying CUT_BUFFER0 if we've come from
2473 * XConvertSelection() but nothing was presented 2471 * XConvertSelection() but nothing was presented
2474 */ 2472 */
2475 D_SELECT((stderr, "rxvt_selection_request: pasting CUT_BUFFER0")); 2473 D_SELECT((stderr, "rxvt_selection_request: pasting CUT_BUFFER0"));
2491 break; 2489 break;
2492 XFree(ct.value); 2490 XFree(ct.value);
2493 } 2491 }
2494 if (ct.value) 2492 if (ct.value)
2495 XFree(ct.value); 2493 XFree(ct.value);
2496 if (R->h->selection_wait == Sel_normal) 2494 if (R->selection_wait == Sel_normal)
2497 R->h->selection_wait = Sel_none; 2495 R->selection_wait = Sel_none;
2498 D_SELECT((stderr, "rxvt_selection_paste: bytes written: %ld", nread)); 2496 D_SELECT((stderr, "rxvt_selection_paste: bytes written: %ld", nread));
2499 return (int)nread; 2497 return (int)nread;
2500} 2498}
2501 2499
2502/* 2500/*
2509 int reget_time = 0; 2507 int reget_time = 0;
2510 2508
2511 if (prop == None) 2509 if (prop == None)
2512 return; 2510 return;
2513 D_SELECT((stderr, "rxvt_selection_property(%08lx, %lu)", win, (unsigned long)prop)); 2511 D_SELECT((stderr, "rxvt_selection_property(%08lx, %lu)", win, (unsigned long)prop));
2514 if (R->h->selection_wait == Sel_normal) { 2512 if (R->selection_wait == Sel_normal) {
2515 int a, afmt; 2513 int a, afmt;
2516 Atom atype; 2514 Atom atype;
2517 unsigned long bytes_after, nitems; 2515 unsigned long bytes_after, nitems;
2518 unsigned char *s = NULL; 2516 unsigned char *s = NULL;
2519 2517
2520 a = XGetWindowProperty(R->Xdisplay, win, prop, 0L, 1L, False, 2518 a = XGetWindowProperty(R->Xdisplay, win, prop, 0L, 1L, False,
2521 R->h->xa[XA_INCR], &atype, &afmt, &nitems, 2519 R->xa[XA_INCR], &atype, &afmt, &nitems,
2522 &bytes_after, &s); 2520 &bytes_after, &s);
2523 if (s) 2521 if (s)
2524 XFree(s); 2522 XFree(s);
2525 if (a != Success) 2523 if (a != Success)
2526 return; 2524 return;
2527#ifndef __CYGWIN32__ 2525#ifndef __CYGWIN32__
2528 if (atype == R->h->xa[XA_INCR]) { /* start an INCR transfer */ 2526 if (atype == R->xa[XA_INCR]) { /* start an INCR transfer */
2529 D_SELECT((stderr, "rxvt_selection_property: INCR: starting transfer")); 2527 D_SELECT((stderr, "rxvt_selection_property: INCR: starting transfer"));
2530 XDeleteProperty(R->Xdisplay, win, prop); 2528 XDeleteProperty(R->Xdisplay, win, prop);
2531 XFlush(R->Xdisplay); 2529 XFlush(R->Xdisplay);
2532 reget_time = 1; 2530 reget_time = 1;
2533 R->h->selection_wait = Sel_incr; 2531 R->selection_wait = Sel_incr;
2534 } 2532 }
2535#endif 2533#endif
2536 } else if (R->h->selection_wait == Sel_incr) { 2534 } else if (R->selection_wait == Sel_incr) {
2537 reget_time = 1; 2535 reget_time = 1;
2538 if (rxvt_selection_paste(aR_ win, prop, True) == -1) { 2536 if (rxvt_selection_paste(aR_ win, prop, True) == -1) {
2539 D_SELECT((stderr, "rxvt_selection_property: INCR: clean end")); 2537 D_SELECT((stderr, "rxvt_selection_property: INCR: clean end"));
2540 R->h->selection_wait = Sel_none; 2538 R->selection_wait = Sel_none;
2541 R->h->timeout[TIMEOUT_INCR].tv_sec = 0; /* turn off timer */ 2539 R->timeout[TIMEOUT_INCR].tv_sec = 0; /* turn off timer */
2542 } 2540 }
2543 } 2541 }
2544 if (reget_time) { /* received more data so reget time */ 2542 if (reget_time) { /* received more data so reget time */
2545 (void)gettimeofday(&(R->h->timeout[TIMEOUT_INCR]), NULL); 2543 (void)gettimeofday(&(R->timeout[TIMEOUT_INCR]), NULL);
2546 R->h->timeout[TIMEOUT_INCR].tv_sec += 10; /* ten seconds wait */ 2544 R->timeout[TIMEOUT_INCR].tv_sec += 10; /* ten seconds wait */
2547 } 2545 }
2548} 2546}
2549/* ------------------------------------------------------------------------- */ 2547/* ------------------------------------------------------------------------- */
2550/* 2548/*
2551 * Request the current selection: 2549 * Request the current selection:
2569 rxvt_PasteIt(aR_ R->selection.text, R->selection.len); 2567 rxvt_PasteIt(aR_ R->selection.text, R->selection.len);
2570 return; 2568 return;
2571 } else { 2569 } else {
2572 int i; 2570 int i;
2573 2571
2574 R->h->selection_request_time = tm; 2572 R->selection_request_time = tm;
2575 R->h->selection_wait = Sel_normal; 2573 R->selection_wait = Sel_normal;
2576 for (i = Sel_Primary; i <= Sel_Clipboard; i++) { 2574 for (i = Sel_Primary; i <= Sel_Clipboard; i++) {
2577#ifdef MULTICHAR_SET 2575#ifdef MULTICHAR_SET
2578 R->h->selection_type = Sel_CompoundText; 2576 R->selection_type = Sel_CompoundText;
2579#else 2577#else
2580 R->h->selection_type = 0; 2578 R->selection_type = 0;
2581#endif 2579#endif
2582 if (rxvt_selection_request_other(aR_ 2580 if (rxvt_selection_request_other(aR_
2583#ifdef MULTICHAR_SET 2581#ifdef MULTICHAR_SET
2584 R->h->xa[XA_COMPOUND_TEXT], 2582 R->xa[XA_COMPOUND_TEXT],
2585#else 2583#else
2586 XA_STRING, 2584 XA_STRING,
2587#endif 2585#endif
2588 i)) 2586 i))
2589 return; 2587 return;
2590 } 2588 }
2591 } 2589 }
2592 R->h->selection_wait = Sel_none; /* don't loop in rxvt_selection_paste() */ 2590 R->selection_wait = Sel_none; /* don't loop in rxvt_selection_paste() */
2593 D_SELECT((stderr, "rxvt_selection_request: pasting CUT_BUFFER0")); 2591 D_SELECT((stderr, "rxvt_selection_request: pasting CUT_BUFFER0"));
2594 rxvt_selection_paste(aR_ Xroot, XA_CUT_BUFFER0, False); 2592 rxvt_selection_paste(aR_ Xroot, XA_CUT_BUFFER0, False);
2595} 2593}
2596 2594
2597/* INTPROTO */ 2595/* INTPROTO */
2601 Atom sel; 2599 Atom sel;
2602#ifdef DEBUG_SELECT 2600#ifdef DEBUG_SELECT
2603 char *debug_xa_names[] = { "PRIMARY", "SECONDARY", "CLIPBOARD" }; 2601 char *debug_xa_names[] = { "PRIMARY", "SECONDARY", "CLIPBOARD" };
2604#endif 2602#endif
2605 2603
2606 R->h->selection_type |= selnum; 2604 R->selection_type |= selnum;
2607 if (selnum == Sel_Primary) 2605 if (selnum == Sel_Primary)
2608 sel = XA_PRIMARY; 2606 sel = XA_PRIMARY;
2609 else if (selnum == Sel_Secondary) 2607 else if (selnum == Sel_Secondary)
2610 sel = XA_SECONDARY; 2608 sel = XA_SECONDARY;
2611 else 2609 else
2612 sel = R->h->xa[XA_CLIPBOARD]; 2610 sel = R->xa[XA_CLIPBOARD];
2613 if (XGetSelectionOwner(R->Xdisplay, sel) != None) { 2611 if (XGetSelectionOwner(R->Xdisplay, sel) != None) {
2614 D_SELECT((stderr, "rxvt_selection_request_other: pasting %s", debug_xa_names[selnum])); 2612 D_SELECT((stderr, "rxvt_selection_request_other: pasting %s", debug_xa_names[selnum]));
2615 XConvertSelection(R->Xdisplay, sel, target, R->h->xa[XA_VT_SELECTION], 2613 XConvertSelection(R->Xdisplay, sel, target, R->xa[XA_VT_SELECTION],
2616 R->TermWin.vt, R->h->selection_request_time); 2614 R->TermWin.vt, R->selection_request_time);
2617 return 1; 2615 return 1;
2618 } 2616 }
2619 return 0; 2617 return 0;
2620} 2618}
2621 2619
2628void 2626void
2629rxvt_selection_clear(pR) 2627rxvt_selection_clear(pR)
2630{ 2628{
2631 D_SELECT((stderr, "rxvt_selection_clear()")); 2629 D_SELECT((stderr, "rxvt_selection_clear()"));
2632 2630
2633 R->h->want_refresh = 1; 2631 R->want_refresh = 1;
2634 if (R->selection.text) 2632 if (R->selection.text)
2635 free(R->selection.text); 2633 free(R->selection.text);
2636 R->selection.text = NULL; 2634 R->selection.text = NULL;
2637 R->selection.len = 0; 2635 R->selection.len = 0;
2638 CLEAR_SELECTION(R); 2636 CLEAR_SELECTION(R);
2741 XSetSelectionOwner(R->Xdisplay, XA_PRIMARY, R->TermWin.vt, tm); 2739 XSetSelectionOwner(R->Xdisplay, XA_PRIMARY, R->TermWin.vt, tm);
2742 if (XGetSelectionOwner(R->Xdisplay, XA_PRIMARY) != R->TermWin.vt) 2740 if (XGetSelectionOwner(R->Xdisplay, XA_PRIMARY) != R->TermWin.vt)
2743 rxvt_print_error("can't get primary selection"); 2741 rxvt_print_error("can't get primary selection");
2744 XChangeProperty(R->Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, 2742 XChangeProperty(R->Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8,
2745 PropModeReplace, R->selection.text, (int)R->selection.len); 2743 PropModeReplace, R->selection.text, (int)R->selection.len);
2746 R->h->selection_time = tm; 2744 R->selection_time = tm;
2747 D_SELECT((stderr, "rxvt_selection_make(): R->selection.len=%d", R->selection.len)); 2745 D_SELECT((stderr, "rxvt_selection_make(): R->selection.len=%d", R->selection.len));
2748} 2746}
2749 2747
2750/* ------------------------------------------------------------------------- */ 2748/* ------------------------------------------------------------------------- */
2751/* 2749/*
2777 */ 2775 */
2778/* INTPROTO */ 2776/* INTPROTO */
2779void 2777void
2780rxvt_selection_start_colrow(pR_ int col, int row) 2778rxvt_selection_start_colrow(pR_ int col, int row)
2781{ 2779{
2782 R->h->want_refresh = 1; 2780 R->want_refresh = 1;
2783 R->selection.mark.col = col; 2781 R->selection.mark.col = col;
2784 R->selection.mark.row = row - R->TermWin.view_start; 2782 R->selection.mark.row = row - R->TermWin.view_start;
2785 MAX_IT(R->selection.mark.row, -(int32_t)R->TermWin.nscrolled); 2783 MAX_IT(R->selection.mark.row, -(int32_t)R->TermWin.nscrolled);
2786 MIN_IT(R->selection.mark.row, (int32_t)R->TermWin.nrow - 1); 2784 MIN_IT(R->selection.mark.row, (int32_t)R->TermWin.nrow - 1);
2787 MAX_IT(R->selection.mark.col, 0); 2785 MAX_IT(R->selection.mark.col, 0);
2790 if (R->selection.op) { /* clear the old selection */ 2788 if (R->selection.op) { /* clear the old selection */
2791 R->selection.beg.row = R->selection.end.row = R->selection.mark.row; 2789 R->selection.beg.row = R->selection.end.row = R->selection.mark.row;
2792 R->selection.beg.col = R->selection.end.col = R->selection.mark.col; 2790 R->selection.beg.col = R->selection.end.col = R->selection.mark.col;
2793 } 2791 }
2794 R->selection.op = SELECTION_INIT; 2792 R->selection.op = SELECTION_INIT;
2795 R->selection.screen = R->h->current_screen; 2793 R->selection.screen = R->current_screen;
2796} 2794}
2797 2795
2798/* ------------------------------------------------------------------------- */ 2796/* ------------------------------------------------------------------------- */
2799/* 2797/*
2800 * Word select: select text for 2 clicks 2798 * Word select: select text for 2 clicks
2801 * We now only find out the boundary in one direction 2799 * We now only find out the boundary in one direction
2802 */ 2800 */
2803 2801
2804/* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */ 2802/* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */
2805#define DELIMIT_TEXT(x) \ 2803#define DELIMIT_TEXT(x) \
2806 (((x) == ' ' || (x) == '\t') ? 2 : (STRCHR(R->h->rs[Rs_cutchars], (x)) != NULL)) 2804 (((x) == ' ' || (x) == '\t') ? 2 : (STRCHR(R->rs[Rs_cutchars], (x)) != NULL))
2807#ifdef MULTICHAR_SET 2805#ifdef MULTICHAR_SET
2808# define DELIMIT_REND(x) (((x) & RS_multiMask) ? 1 : 0) 2806# define DELIMIT_REND(x) (((x) & RS_multiMask) ? 1 : 0)
2809#else 2807#else
2810# define DELIMIT_REND(x) 1 2808# define DELIMIT_REND(x) 1
2811#endif 2809#endif
2917 && (row == R->selection.mark.row + R->TermWin.view_start))) { 2915 && (row == R->selection.mark.row + R->TermWin.view_start))) {
2918 /* select nothing */ 2916 /* select nothing */
2919 R->selection.beg.row = R->selection.end.row = 0; 2917 R->selection.beg.row = R->selection.end.row = 0;
2920 R->selection.beg.col = R->selection.end.col = 0; 2918 R->selection.beg.col = R->selection.end.col = 0;
2921 R->selection.clicks = 4; 2919 R->selection.clicks = 4;
2922 R->h->want_refresh = 1; 2920 R->want_refresh = 1;
2923 D_SELECT((stderr, "rxvt_selection_extend() R->selection.clicks = 4")); 2921 D_SELECT((stderr, "rxvt_selection_extend() R->selection.clicks = 4"));
2924 return; 2922 return;
2925 } 2923 }
2926 } 2924 }
2927#endif 2925#endif
2948 } closeto = RIGHT; 2946 } closeto = RIGHT;
2949 2947
2950 D_SELECT((stderr, "rxvt_selection_extend_colrow(c:%d, r:%d, %d, %d) clicks:%d, op:%d", col, row, button3, buttonpress, R->selection.clicks, R->selection.op)); 2948 D_SELECT((stderr, "rxvt_selection_extend_colrow(c:%d, r:%d, %d, %d) clicks:%d, op:%d", col, row, button3, buttonpress, R->selection.clicks, R->selection.op));
2951 D_SELECT((stderr, "rxvt_selection_extend_colrow() ENT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)", R->selection.beg.row, R->selection.beg.col, R->selection.mark.row, R->selection.mark.col, R->selection.end.row, R->selection.end.col)); 2949 D_SELECT((stderr, "rxvt_selection_extend_colrow() ENT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)", R->selection.beg.row, R->selection.beg.col, R->selection.mark.row, R->selection.mark.col, R->selection.end.row, R->selection.end.col));
2952 2950
2953 R->h->want_refresh = 1; 2951 R->want_refresh = 1;
2954 switch (R->selection.op) { 2952 switch (R->selection.op) {
2955 case SELECTION_INIT: 2953 case SELECTION_INIT:
2956 CLEAR_SELECTION(R); 2954 CLEAR_SELECTION(R);
2957 R->selection.op = SELECTION_BEGIN; 2955 R->selection.op = SELECTION_BEGIN;
2958 /* FALLTHROUGH */ 2956 /* FALLTHROUGH */
2993 * Note: button3 drag is always available, c.f. v2.20 2991 * Note: button3 drag is always available, c.f. v2.20
2994 * Selection always terminates (left or right as appropriate) at the mark. 2992 * Selection always terminates (left or right as appropriate) at the mark.
2995 */ 2993 */
2996 if (R->selection_style == OLD_SELECT) { 2994 if (R->selection_style == OLD_SELECT) {
2997 if (R->selection.clicks == 1 || button3) { 2995 if (R->selection.clicks == 1 || button3) {
2998 if (R->h->hate_those_clicks) { 2996 if (R->hate_those_clicks) {
2999 R->h->hate_those_clicks = 0; 2997 R->hate_those_clicks = 0;
3000 if (R->selection.clicks == 1) { 2998 if (R->selection.clicks == 1) {
3001 R->selection.beg.row = R->selection.mark.row; 2999 R->selection.beg.row = R->selection.mark.row;
3002 R->selection.beg.col = R->selection.mark.col; 3000 R->selection.beg.col = R->selection.mark.col;
3003 } else { 3001 } else {
3004 R->selection.mark.row = R->selection.beg.row; 3002 R->selection.mark.row = R->selection.beg.row;
3019 } else if (R->selection.clicks == 2) { 3017 } else if (R->selection.clicks == 2) {
3020 rxvt_selection_delimit_word(aR_ UP, &(R->selection.mark), 3018 rxvt_selection_delimit_word(aR_ UP, &(R->selection.mark),
3021 &(R->selection.beg)); 3019 &(R->selection.beg));
3022 rxvt_selection_delimit_word(aR_ DN, &(R->selection.mark), 3020 rxvt_selection_delimit_word(aR_ DN, &(R->selection.mark),
3023 &(R->selection.end)); 3021 &(R->selection.end));
3024 R->h->hate_those_clicks = 1; 3022 R->hate_those_clicks = 1;
3025 } else if (R->selection.clicks == 3) { 3023 } else if (R->selection.clicks == 3) {
3026 R->selection.beg.row = R->selection.end.row = R->selection.mark.row; 3024 R->selection.beg.row = R->selection.end.row = R->selection.mark.row;
3027 R->selection.beg.col = 0; 3025 R->selection.beg.col = 0;
3028 R->selection.end.col = ncol; 3026 R->selection.end.col = ncol;
3029 R->h->hate_those_clicks = 1; 3027 R->hate_those_clicks = 1;
3030 } 3028 }
3031 D_SELECT((stderr, "rxvt_selection_extend_colrow() EXIT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)", R->selection.beg.row, R->selection.beg.col, R->selection.mark.row, R->selection.mark.col, R->selection.end.row, R->selection.end.col)); 3029 D_SELECT((stderr, "rxvt_selection_extend_colrow() EXIT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)", R->selection.beg.row, R->selection.beg.col, R->selection.mark.row, R->selection.mark.col, R->selection.end.row, R->selection.end.col));
3032 return; 3030 return;
3033 } 3031 }
3034#endif /* ! NO_OLD_SELECTION */ 3032#endif /* ! NO_OLD_SELECTION */
3235 ev.requestor = rq->requestor; 3233 ev.requestor = rq->requestor;
3236 ev.selection = rq->selection; 3234 ev.selection = rq->selection;
3237 ev.target = rq->target; 3235 ev.target = rq->target;
3238 ev.time = rq->time; 3236 ev.time = rq->time;
3239 3237
3240 if (rq->target == R->h->xa[XA_TARGETS]) { 3238 if (rq->target == R->xa[XA_TARGETS]) {
3241 target_list[0] = (Atom32) R->h->xa[XA_TARGETS]; 3239 target_list[0] = (Atom32) R->xa[XA_TARGETS];
3242 target_list[1] = (Atom32) XA_STRING; 3240 target_list[1] = (Atom32) XA_STRING;
3243 target_list[2] = (Atom32) R->h->xa[XA_TEXT]; 3241 target_list[2] = (Atom32) R->xa[XA_TEXT];
3244#ifdef USE_XIM 3242#ifdef USE_XIM
3245 target_list[3] = (Atom32) R->h->xa[XA_COMPOUND_TEXT]; 3243 target_list[3] = (Atom32) R->xa[XA_COMPOUND_TEXT];
3246#endif 3244#endif
3247 XChangeProperty(R->Xdisplay, rq->requestor, rq->property, XA_ATOM, 3245 XChangeProperty(R->Xdisplay, rq->requestor, rq->property, XA_ATOM,
3248 (8 * sizeof(target_list[0])), PropModeReplace, 3246 (8 * sizeof(target_list[0])), PropModeReplace,
3249 (unsigned char *)target_list, 3247 (unsigned char *)target_list,
3250 (sizeof(target_list) / sizeof(target_list[0]))); 3248 (sizeof(target_list) / sizeof(target_list[0])));
3251 ev.property = rq->property; 3249 ev.property = rq->property;
3252 } else if (rq->target == R->h->xa[XA_MULTIPLE]) { 3250 } else if (rq->target == R->xa[XA_MULTIPLE]) {
3253 /* TODO: Handle MULTIPLE */ 3251 /* TODO: Handle MULTIPLE */
3254 } else if (rq->target == R->h->xa[XA_TIMESTAMP] && R->selection.text) { 3252 } else if (rq->target == R->xa[XA_TIMESTAMP] && R->selection.text) {
3255 XChangeProperty(R->Xdisplay, rq->requestor, rq->property, XA_INTEGER, 3253 XChangeProperty(R->Xdisplay, rq->requestor, rq->property, XA_INTEGER,
3256 (8 * sizeof(Time)), PropModeReplace, 3254 (8 * sizeof(Time)), PropModeReplace,
3257 (unsigned char *)&R->h->selection_time, 1); 3255 (unsigned char *)&R->selection_time, 1);
3258 ev.property = rq->property; 3256 ev.property = rq->property;
3259 } else if (rq->target == XA_STRING 3257 } else if (rq->target == XA_STRING
3260 || rq->target == R->h->xa[XA_COMPOUND_TEXT] 3258 || rq->target == R->xa[XA_COMPOUND_TEXT]
3261 || rq->target == R->h->xa[XA_TEXT]) { 3259 || rq->target == R->xa[XA_TEXT]) {
3262#ifdef USE_XIM 3260#ifdef USE_XIM
3263 short freect = 0; 3261 short freect = 0;
3264#endif 3262#endif
3265 int selectlen; 3263 int selectlen;
3266 3264
3267#ifdef USE_XIM 3265#ifdef USE_XIM
3268 if (rq->target != XA_STRING) { 3266 if (rq->target != XA_STRING) {
3269 target = R->h->xa[XA_COMPOUND_TEXT]; 3267 target = R->xa[XA_COMPOUND_TEXT];
3270 style = (rq->target == R->h->xa[XA_COMPOUND_TEXT]) 3268 style = (rq->target == R->xa[XA_COMPOUND_TEXT])
3271 ? XCompoundTextStyle : XStdICCTextStyle; 3269 ? XCompoundTextStyle : XStdICCTextStyle;
3272 } else 3270 } else
3273#endif 3271#endif
3274 { 3272 {
3275 target = XA_STRING; 3273 target = XA_STRING;
3350 "fg", "bg", 3348 "fg", "bg",
3351 "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" 3349 "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"
3352 }; 3350 };
3353 3351
3354 fprintf(stderr, "Color ( "); 3352 fprintf(stderr, "Color ( ");
3355 if (R->h->rstyle & RS_RVid) 3353 if (R->rstyle & RS_RVid)
3356 fprintf(stderr, "rvid "); 3354 fprintf(stderr, "rvid ");
3357 if (R->h->rstyle & RS_Bold) 3355 if (R->rstyle & RS_Bold)
3358 fprintf(stderr, "bold "); 3356 fprintf(stderr, "bold ");
3359 if (R->h->rstyle & RS_Blink) 3357 if (R->rstyle & RS_Blink)
3360 fprintf(stderr, "blink "); 3358 fprintf(stderr, "blink ");
3361 if (R->h->rstyle & RS_Uline) 3359 if (R->rstyle & RS_Uline)
3362 fprintf(stderr, "uline "); 3360 fprintf(stderr, "uline ");
3363 fprintf(stderr, "): "); 3361 fprintf(stderr, "): ");
3364 3362
3365 color = GET_FGCOLOR(R->h->rstyle); 3363 color = GET_FGCOLOR(R->rstyle);
3366#ifndef NO_BRIGHTCOLOR 3364#ifndef NO_BRIGHTCOLOR
3367 if (color >= minBrightCOLOR && color <= maxBrightCOLOR) { 3365 if (color >= minBrightCOLOR && color <= maxBrightCOLOR) {
3368 color -= (minBrightCOLOR - minCOLOR); 3366 color -= (minBrightCOLOR - minCOLOR);
3369 fprintf(stderr, "bright "); 3367 fprintf(stderr, "bright ");
3370 } 3368 }
3371#endif 3369#endif
3372 fprintf(stderr, "%s on ", name[color]); 3370 fprintf(stderr, "%s on ", name[color]);
3373 3371
3374 color = GET_BGCOLOR(R->h->rstyle); 3372 color = GET_BGCOLOR(R->rstyle);
3375#ifndef NO_BRIGHTCOLOR 3373#ifndef NO_BRIGHTCOLOR
3376 if (color >= minBrightCOLOR && color <= maxBrightCOLOR) { 3374 if (color >= minBrightCOLOR && color <= maxBrightCOLOR) {
3377 color -= (minBrightCOLOR - minCOLOR); 3375 color -= (minBrightCOLOR - minCOLOR);
3378 fprintf(stderr, "bright "); 3376 fprintf(stderr, "bright ");
3379 } 3377 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines