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.306 by root, Sun Jun 15 10:15:39 2008 UTC vs.
Revision 1.316 by root, Tue Nov 4 15:02:35 2008 UTC

83 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) 83 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col)
84#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ 84#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \
85 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) 85 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col)
86 86
87/* 87/*
88 * CLEAR_ROWS : clear <num> rows starting from row <row>
89 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> 88 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y>
90 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour
91 */ 89 */
92#define CLEAR_ROWS(row, num) \
93 if (mapped) \
94 XClearArea (dpy, vt, 0, \
95 Row2Pixel (row), (unsigned int)width, \
96 (unsigned int)Height2Pixel (num), False)
97
98#define CLEAR_CHARS(x, y, num) \ 90#define CLEAR_CHARS(x, y, num) \
99 if (mapped) \ 91 if (mapped) \
100 XClearArea (dpy, vt, x, y, \ 92 XClearArea (dpy, vt, x, y, \
101 (unsigned int)Width2Pixel (num), \ 93 (unsigned int)Width2Pixel (num), \
102 (unsigned int)Height2Pixel (1), False) 94 (unsigned int)Height2Pixel (1), False)
103 95
104#define ERASE_ROWS(row, num) \
105 XFillRectangle (dpy, vt, gc, \
106 0, Row2Pixel (row), \
107 (unsigned int)width, \
108 (unsigned int)Height2Pixel (num))
109
110/* ------------------------------------------------------------------------- * 96/* ------------------------------------------------------------------------- *
111 * SCREEN `COMMON' ROUTINES * 97 * SCREEN `COMMON' ROUTINES *
112 * ------------------------------------------------------------------------- */ 98 * ------------------------------------------------------------------------- */
113 99
114/* Fill part/all of a line with blanks. */ 100/* Fill part/all of a line with blanks. */
144{ 130{
145 scr_blank_line (l, 0, ncol, efs); 131 scr_blank_line (l, 0, ncol, efs);
146 132
147 l.l = 0; 133 l.l = 0;
148 l.f = 0; 134 l.f = 0;
135}
136
137// nuke a single wide character at the given column
138void
139rxvt_term::scr_kill_char (line_t &l, int col) const NOTHROW
140{
141 // find begin
142 while (col > 0 && l.t[col] == NOCHAR)
143 col--;
144
145 rend_t rend = l.r[col] & ~RS_baseattrMask;
146 rend = SET_FONT (rend, FONTSET (rend)->find_font (' '));
147
148 // found start, nuke
149 do {
150 l.t[col] = ' ';
151 l.r[col] = rend;
152 col++;
153 } while (col < ncol && l.t[col] == NOCHAR);
149} 154}
150 155
151/* ------------------------------------------------------------------------- * 156/* ------------------------------------------------------------------------- *
152 * SCREEN INITIALISATION * 157 * SCREEN INITIALISATION *
153 * ------------------------------------------------------------------------- */ 158 * ------------------------------------------------------------------------- */
785 790
786 while (str < strend) 791 while (str < strend)
787 { 792 {
788 c = (unicode_t)*str++; // convert to rxvt-unicodes representation 793 c = (unicode_t)*str++; // convert to rxvt-unicodes representation
789 794
790 if (c < 0x20) 795 if (expect_false (c < 0x20))
791 if (c == C0_LF) 796 if (c == C0_LF)
792 { 797 {
793 max_it (line->l, screen.cur.col); 798 max_it (line->l, screen.cur.col);
794 799
795 screen.flags &= ~Screen_WrapNext; 800 screen.flags &= ~Screen_WrapNext;
814 { 819 {
815 scr_tab (1, true); 820 scr_tab (1, true);
816 continue; 821 continue;
817 } 822 }
818 823
824 if (expect_false (
819 if (checksel /* see if we're writing within selection */ 825 checksel /* see if we're writing within selection */
820 && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) 826 && !ROWCOL_IS_BEFORE (screen.cur, selection.beg)
821 && ROWCOL_IS_BEFORE (screen.cur, selection.end)) 827 && ROWCOL_IS_BEFORE (screen.cur, selection.end)
828 ))
822 { 829 {
823 checksel = 0; 830 checksel = 0;
824 /* 831 /*
825 * If we wrote anywhere in the selected area, kill the selection 832 * If we wrote anywhere in the selected area, kill the selection
826 * XXX: should we kill the mark too? Possibly, but maybe that 833 * XXX: should we kill the mark too? Possibly, but maybe that
827 * should be a similar check. 834 * should be a similar check.
828 */ 835 */
829 CLEAR_SELECTION (); 836 CLEAR_SELECTION ();
830 } 837 }
831 838
832 if (screen.flags & Screen_WrapNext) 839 if (expect_false (screen.flags & Screen_WrapNext))
833 { 840 {
834 scr_do_wrap (); 841 scr_do_wrap ();
835 842
836 line->l = ncol; 843 line->l = ncol;
837 line->is_longer (1); 844 line->is_longer (1);
839 row = screen.cur.row; 846 row = screen.cur.row;
840 line = &ROW(row); /* _must_ refresh */ 847 line = &ROW(row); /* _must_ refresh */
841 } 848 }
842 849
843 // some utf-8 decoders "decode" surrogate characters: let's fix this. 850 // some utf-8 decoders "decode" surrogate characters: let's fix this.
844 if (IN_RANGE_INC (c, 0xd800, 0xdfff)) 851 if (expect_false (IN_RANGE_INC (c, 0xd800, 0xdfff)))
845 c = 0xfffd; 852 c = 0xfffd;
846 853
847 // rely on wcwidth to tell us the character width, do wcwidth before 854 // rely on wcwidth to tell us the character width, do wcwidth before
848 // further replacements, as wcwidth might return -1 for the line 855 // further replacements, as wcwidth might return -1 for the line
849 // drawing characters below as they might be invalid in the current 856 // drawing characters below as they might be invalid in the current
850 // locale. 857 // locale.
851 int width = WCWIDTH (c); 858 int width = WCWIDTH (c);
852 859
853 if (charsets [screen.charset] == '0') // DEC SPECIAL 860 if (expect_false (charsets [screen.charset] == '0')) // DEC SPECIAL
854 { 861 {
855 // vt100 special graphics and line drawing 862 // vt100 special graphics and line drawing
856 // 5f-7e standard vt100 863 // 5f-7e standard vt100
857 // 40-5e rxvt extension for extra curses acs chars 864 // 40-5e rxvt extension for extra curses acs chars
858 static uint16_t vt100_0[62] = { // 41 .. 7e 865 static uint16_t vt100_0[62] = { // 41 .. 7e
871 c = vt100_0[c - 0x41]; 878 c = vt100_0[c - 0x41];
872 width = 1; // vt100 line drawing characters are always single-width 879 width = 1; // vt100 line drawing characters are always single-width
873 } 880 }
874 } 881 }
875 882
876 if (screen.flags & Screen_Insert) 883 if (expect_false (screen.flags & Screen_Insert))
877 scr_insdel_chars (width, INSERT); 884 scr_insdel_chars (width, INSERT);
878 885
879 if (width != 0) 886 if (width != 0)
880 { 887 {
881#if !UNICODE_3 888#if !UNICODE_3
887 c = 0xfffd; 894 c = 0xfffd;
888# endif 895# endif
889#endif 896#endif
890 897
891 // nuke the character at this position, if required 898 // nuke the character at this position, if required
899 if (expect_false (
892 if (line->t[screen.cur.col] == NOCHAR 900 line->t[screen.cur.col] == NOCHAR
893 || (screen.cur.col < ncol - 1 901 || (screen.cur.col < ncol - 1
894 && line->t[screen.cur.col + 1] == NOCHAR)) 902 && line->t[screen.cur.col + 1] == NOCHAR)
895 { 903 ))
896 int col = screen.cur.col; 904 scr_kill_char (*line, screen.cur.col);
897
898 // find begin
899 while (col > 0 && line->t[col] == NOCHAR)
900 col--;
901
902 rend_t rend = SET_FONT (line->r[col], FONTSET (line->r[col])->find_font (' '));
903
904 // found begin, nuke
905 do {
906 line->t[col] = ' ';
907 line->r[col] = rend;
908 col++;
909 } while (col < ncol && line->t[col] == NOCHAR);
910 }
911 905
912 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); 906 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
913 907
914 // if the character doesn't fit into the remaining columns... 908 // if the character doesn't fit into the remaining columns...
915 if (screen.cur.col > ncol - width && ncol >= width) 909 if (expect_false (screen.cur.col > ncol - width && ncol >= width))
916 { 910 {
917 // ...output spaces 911 // ...output spaces
918 c = ' '; 912 c = ' ';
919 // and try the same character next loop iteration 913 // and try the same character next loop iteration
920 --str; 914 --str;
925 do 919 do
926 { 920 {
927 line->t[screen.cur.col] = c; 921 line->t[screen.cur.col] = c;
928 line->r[screen.cur.col] = rend; 922 line->r[screen.cur.col] = rend;
929 923
930 if (screen.cur.col < ncol - 1) 924 if (expect_true (screen.cur.col < ncol - 1))
931 screen.cur.col++; 925 screen.cur.col++;
932 else 926 else
933 { 927 {
934 line->l = ncol; 928 line->l = ncol;
935 if (screen.flags & Screen_Autowrap) 929 if (screen.flags & Screen_Autowrap)
937 break; 931 break;
938 } 932 }
939 933
940 c = NOCHAR; 934 c = NOCHAR;
941 } 935 }
942 while (--width > 0); 936 while (expect_false (--width > 0));
943 937
944 // pad with spaces when overwriting wide character with smaller one 938 // pad with spaces when overwriting wide character with smaller one
945 if (!width) 939 if (expect_false (!width))
946 { 940 {
947 line->touch (); 941 line->touch ();
948 942
949 for (int c = screen.cur.col; c < ncol && line->t[c] == NOCHAR; c++) 943 for (int c = screen.cur.col; c < ncol && line->t[c] == NOCHAR; c++)
950 { 944 {
951 line->t[c] = ' '; 945 line->t[c] = ' ';
952 line->r[c] = rend; 946 line->r[c] = rend;
953 } 947 }
954 } 948 }
955 } 949 }
950#if ENABLE_COMBINING
956 else // width == 0 951 else // width == 0
957 { 952 {
958#if ENABLE_COMBINING 953 if (c != 0xfeff) // ignore BOM
959 // handle combining characters
960 // we just tag the accent on the previous on-screen character.
961 // this is arguably not correct, but also arguably not wrong.
962 // we don't handle double-width characters nicely yet.
963 line_t *linep;
964 text_t *tp;
965 rend_t *rp;
966
967 if (screen.cur.col > 0)
968 { 954 {
955 // handle combining characters
956 // we just tag the accent on the previous on-screen character.
957 // this is arguably not correct, but also arguably not wrong.
958 // we don't handle double-width characters nicely yet.
959 line_t *linep;
960 text_t *tp;
961 rend_t *rp;
962
963 if (screen.cur.col > 0)
964 {
969 linep = line; 965 linep = line;
970 tp = line->t + screen.cur.col - 1; 966 tp = line->t + screen.cur.col - 1;
971 rp = line->r + screen.cur.col - 1; 967 rp = line->r + screen.cur.col - 1;
968 }
969 else if (screen.cur.row > 0
970 && ROW(screen.cur.row - 1).is_longer ())
971 {
972 linep = &ROW(screen.cur.row - 1);
973 tp = line->t + ncol - 1;
974 rp = line->r + ncol - 1;
975 }
976 else
977 continue;
978
979 linep->touch ();
980
981 while (*tp == NOCHAR && tp > linep->t)
982 tp--, rp--;
983
984 // first try to find a precomposed character
985 unicode_t n = rxvt_compose (*tp, c);
986 if (n == NOCHAR)
987 n = rxvt_composite.compose (*tp, c);
988
989 *tp = n;
990 *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp));
972 } 991 }
973 else if (screen.cur.row > 0
974 && ROW(screen.cur.row - 1).is_longer ())
975 {
976 linep = &ROW(screen.cur.row - 1);
977 tp = line->t + ncol - 1;
978 rp = line->r + ncol - 1;
979 } 992 }
980 else
981 continue;
982
983 linep->touch ();
984
985 while (*tp == NOCHAR && tp > linep->t)
986 tp--, rp--;
987
988 // first try to find a precomposed character
989 unicode_t n = rxvt_compose (*tp, c);
990 if (n == NOCHAR)
991 n = rxvt_composite.compose (*tp, c);
992
993 *tp = n;
994 *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp));
995#endif 993#endif
996 }
997 } 994 }
998 995
999 max_it (line->l, screen.cur.col); 996 max_it (line->l, screen.cur.col);
1000 997
1001#ifdef DEBUG_STRICT 998#ifdef DEBUG_STRICT
1336 if (row >= nrow) /* Out Of Bounds */ 1333 if (row >= nrow) /* Out Of Bounds */
1337 return; 1334 return;
1338 1335
1339 min_it (num, nrow - row); 1336 min_it (num, nrow - row);
1340 1337
1338 /*TODO: the xlceararea/xfillrectangle below don't take scroll offste into account, ask mikachu for details */
1341 if (rstyle & (RS_RVid | RS_Uline)) 1339 if (rstyle & (RS_RVid | RS_Uline))
1342 ren = (rend_t) ~RS_None; 1340 ren = (rend_t) ~RS_None;
1343 else if (GET_BASEBG (rstyle) == Color_bg) 1341 else if (GET_BASEBG (rstyle) == Color_bg)
1344 { 1342 {
1345 ren = DEFAULT_RSTYLE; 1343 ren = DEFAULT_RSTYLE;
1346 CLEAR_ROWS (row, num); 1344
1345 if (mapped)
1346 XClearArea (dpy, vt, 0,
1347 Row2Pixel (row), (unsigned int)width,
1348 (unsigned int)Height2Pixel (num), False);
1347 } 1349 }
1348 else 1350 else
1349 { 1351 {
1350 ren = rstyle & (RS_fgMask | RS_bgMask); 1352 ren = rstyle & (RS_fgMask | RS_bgMask);
1353
1351 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; 1354 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1352 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1355 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1353 ERASE_ROWS (row, num); 1356 XFillRectangle (dpy, vt, gc,
1357 0, Row2Pixel (row),
1358 (unsigned int)width,
1359 (unsigned int)Height2Pixel (num));
1354 gcvalue.foreground = pix_colors[Color_fg]; 1360 gcvalue.foreground = pix_colors[Color_fg];
1355 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1361 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1356 } 1362 }
1357 1363
1358 for (; num--; row++) 1364 for (; num--; row++)
1440 * Insert/Delete <count> characters from the current position 1446 * Insert/Delete <count> characters from the current position
1441 */ 1447 */
1442void 1448void
1443rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW 1449rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW
1444{ 1450{
1445 int col, row;
1446 rend_t tr;
1447
1448 want_refresh = 1; 1451 want_refresh = 1;
1449 ZERO_SCROLLBACK (); 1452 ZERO_SCROLLBACK ();
1450 1453
1451 if (count <= 0) 1454 if (count <= 0)
1452 return; 1455 return;
1454 scr_do_wrap (); 1457 scr_do_wrap ();
1455 1458
1456 selection_check (1); 1459 selection_check (1);
1457 min_it (count, ncol - screen.cur.col); 1460 min_it (count, ncol - screen.cur.col);
1458 1461
1459 row = screen.cur.row; 1462 int row = screen.cur.row;
1460 1463
1461 line_t *line = &ROW(row); 1464 line_t *line = &ROW(row);
1462 1465
1463 line->touch (); 1466 line->touch ();
1464 line->is_longer (0); 1467 line->is_longer (0);
1465 1468
1469 // nuke wide spanning the start
1470 if (line->t[screen.cur.col] == NOCHAR)
1471 scr_kill_char (*line, screen.cur.col);
1472
1466 switch (insdel) 1473 switch (insdel)
1467 { 1474 {
1468 case INSERT: 1475 case INSERT:
1469 for (col = ncol - 1; (col - count) >= screen.cur.col; col--) 1476 line->l = min (line->l + count, ncol);
1477
1478 if (line->t[screen.cur.col] == NOCHAR)
1479 scr_kill_char (*line, screen.cur.col);
1480
1481 for (int col = ncol - 1; (col - count) >= screen.cur.col; col--)
1470 { 1482 {
1471 line->t[col] = line->t[col - count]; 1483 line->t[col] = line->t[col - count];
1472 line->r[col] = line->r[col - count]; 1484 line->r[col] = line->r[col - count];
1473 } 1485 }
1474
1475 line->l = min (line->l + count, ncol);
1476 1486
1477 if (selection.op && current_screen == selection.screen 1487 if (selection.op && current_screen == selection.screen
1478 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1488 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1479 { 1489 {
1480 if (selection.end.row != screen.cur.row 1490 if (selection.end.row != screen.cur.row
1495 case ERASE: 1505 case ERASE:
1496 screen.cur.col += count; /* don't worry if > ncol */ 1506 screen.cur.col += count; /* don't worry if > ncol */
1497 selection_check (1); 1507 selection_check (1);
1498 screen.cur.col -= count; 1508 screen.cur.col -= count;
1499 1509
1500 line->l = max (line->l - count, 0); 1510 // nuke wide char after the end
1511 if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR)
1512 scr_kill_char (*line, screen.cur.col + count);
1513
1501 scr_blank_line (*line, screen.cur.col, count, rstyle); 1514 scr_blank_line (*line, screen.cur.col, count, rstyle);
1502 break; 1515 break;
1503 1516
1504 case DELETE: 1517 case DELETE:
1505 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1518 line->l = max (line->l - count, 0);
1506 1519
1520 // nuke wide char spanning the end
1521 if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR)
1522 scr_kill_char (*line, screen.cur.col + count);
1523
1507 for (col = screen.cur.col; (col + count) < ncol; col++) 1524 for (int col = screen.cur.col; (col + count) < ncol; col++)
1508 { 1525 {
1509 line->t[col] = line->t[col + count]; 1526 line->t[col] = line->t[col + count];
1510 line->r[col] = line->r[col + count]; 1527 line->r[col] = line->r[col + count];
1511 } 1528 }
1512 1529
1513 line->l = max (line->l - count, 0);
1514 scr_blank_line (*line, ncol - count, count, tr); 1530 scr_blank_line (*line, ncol - count, count,
1531 line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask));
1515 1532
1516 if (selection.op && current_screen == selection.screen 1533 if (selection.op && current_screen == selection.screen
1517 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1534 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1518 { 1535 {
1519 if (selection.end.row != screen.cur.row 1536 if (selection.end.row != screen.cur.row
1897 XMapWindow (dpy, parent[0]); 1914 XMapWindow (dpy, parent[0]);
1898# endif 1915# endif
1899 1916
1900# if ENABLE_FRILLS 1917# if ENABLE_FRILLS
1901 if (option (Opt_urgentOnBell)) 1918 if (option (Opt_urgentOnBell))
1902 { 1919 set_urgency (1);
1903 if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1904 {
1905 h->flags |= XUrgencyHint;
1906 XSetWMHints (dpy, parent[0], h);
1907 }
1908 }
1909# endif 1920# endif
1910 1921
1911 if (option (Opt_visualBell)) 1922 if (option (Opt_visualBell))
1912 { 1923 {
1913 rvideo_bell = true; 1924 rvideo_bell = true;
1926void 1937void
1927rxvt_term::scr_printscreen (int fullhist) NOTHROW 1938rxvt_term::scr_printscreen (int fullhist) NOTHROW
1928{ 1939{
1929#ifdef PRINTPIPE 1940#ifdef PRINTPIPE
1930 int nrows, row_start; 1941 int nrows, row_start;
1931 FILE *fd; 1942 FILE *fd = popen_printer ();
1932 1943
1933 if ((fd = popen_printer ()) == NULL) 1944 if (!fd)
1934 return; 1945 return;
1935 1946
1936 if (fullhist) 1947 if (fullhist)
1937 { 1948 {
1938 nrows = nrow - top_row; 1949 nrows = nrow - top_row;
2208 continue; 2219 continue;
2209 2220
2210 // redraw one or more characters 2221 // redraw one or more characters
2211 2222
2212 // seek to the beginning of wide characters 2223 // seek to the beginning of wide characters
2213 while (stp[col] == NOCHAR && col > 0) 2224 while (expect_false (stp[col] == NOCHAR && col > 0))
2214 --col; 2225 --col;
2215 2226
2216 rend_t rend = srp[col]; /* screen rendition (target rendtion) */ 2227 rend_t rend = srp[col]; /* screen rendition (target rendtion) */
2217 text_t *text = stp + col; 2228 text_t *text = stp + col;
2218 int count = 1; 2229 int count = 1;
2255 2266
2256 col--; /* went one too far. move back */ 2267 col--; /* went one too far. move back */
2257 count -= i; /* dump any matching trailing chars */ 2268 count -= i; /* dump any matching trailing chars */
2258 2269
2259 // sometimes we optimize away the trailing NOCHAR's, add them back 2270 // sometimes we optimize away the trailing NOCHAR's, add them back
2260 while (i && text[count] == NOCHAR) 2271 while (expect_false (i && text[count] == NOCHAR))
2261 count++, i--; 2272 count++, i--;
2262 2273
2263 /* 2274 /*
2264 * Determine the attributes for the string 2275 * Determine the attributes for the string
2265 */ 2276 */
2266 int fore = fgcolor_of (rend); // desired foreground 2277 int fore = fgcolor_of (rend); // desired foreground
2267 int back = bgcolor_of (rend); // desired background 2278 int back = bgcolor_of (rend); // desired background
2268 2279
2269 // only do special processing if any attributes are set, which is unlikely 2280 // only do special processing if any attributes are set, which is unlikely
2270 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) 2281 if (expect_false (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)))
2271 { 2282 {
2272 bool invert = rend & RS_RVid; 2283 bool invert = rend & RS_RVid;
2273 2284
2274#ifndef NO_BOLD_UNDERLINE_REVERSE 2285#ifndef NO_BOLD_UNDERLINE_REVERSE
2275 if (rend & RS_Bold && fore == Color_fg) 2286 if (rend & RS_Bold && fore == Color_fg)
2358 /* 2369 /*
2359 * Actually do the drawing of the string here 2370 * Actually do the drawing of the string here
2360 */ 2371 */
2361 rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)]; 2372 rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)];
2362 2373
2363 if (have_bg && back == Color_bg) 2374 if (expect_true (have_bg && back == Color_bg))
2364 { 2375 {
2365 // this is very ugly, maybe push it into ->draw? 2376 // this is very ugly, maybe push it into ->draw?
2366 2377
2367 for (i = 0; i < count; i++) /* don't draw empty strings */ 2378 for (i = 0; i < count; i++) /* don't draw empty strings */
2368 if (text[i] != ' ') 2379 if (text[i] != ' ')
2375 did_clear: ; 2386 did_clear: ;
2376 } 2387 }
2377 else 2388 else
2378 font->draw (*drawable, xpixel, ypixel, text, count, fore, back); 2389 font->draw (*drawable, xpixel, ypixel, text, count, fore, back);
2379 2390
2380 if (rend & RS_Uline && font->descent > 1 && fore != back) 2391 if (expect_false (rend & RS_Uline && font->descent > 1 && fore != back))
2381 { 2392 {
2382#if ENABLE_FRILLS 2393#if ENABLE_FRILLS
2383 if (ISSET_PIXCOLOR (Color_underline)) 2394 if (ISSET_PIXCOLOR (Color_underline))
2384 XSetForeground (dpy, gc, pix_colors[Color_underline]); 2395 XSetForeground (dpy, gc, pix_colors[Color_underline]);
2385 else 2396 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines