… | |
… | |
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 | |
|
|
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 | |
95 | |
110 | /* ------------------------------------------------------------------------- * |
96 | /* ------------------------------------------------------------------------- * |
111 | * SCREEN `COMMON' ROUTINES * |
97 | * SCREEN `COMMON' ROUTINES * |
112 | * ------------------------------------------------------------------------- */ |
98 | * ------------------------------------------------------------------------- */ |
113 | |
99 | |
… | |
… | |
785 | |
771 | |
786 | while (str < strend) |
772 | while (str < strend) |
787 | { |
773 | { |
788 | c = (unicode_t)*str++; // convert to rxvt-unicodes representation |
774 | c = (unicode_t)*str++; // convert to rxvt-unicodes representation |
789 | |
775 | |
790 | if (c < 0x20) |
776 | if (expect_false (c < 0x20)) |
791 | if (c == C0_LF) |
777 | if (c == C0_LF) |
792 | { |
778 | { |
793 | max_it (line->l, screen.cur.col); |
779 | max_it (line->l, screen.cur.col); |
794 | |
780 | |
795 | screen.flags &= ~Screen_WrapNext; |
781 | screen.flags &= ~Screen_WrapNext; |
… | |
… | |
814 | { |
800 | { |
815 | scr_tab (1, true); |
801 | scr_tab (1, true); |
816 | continue; |
802 | continue; |
817 | } |
803 | } |
818 | |
804 | |
|
|
805 | if (expect_false ( |
819 | if (checksel /* see if we're writing within selection */ |
806 | checksel /* see if we're writing within selection */ |
820 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
807 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
821 | && ROWCOL_IS_BEFORE (screen.cur, selection.end)) |
808 | && ROWCOL_IS_BEFORE (screen.cur, selection.end) |
|
|
809 | )) |
822 | { |
810 | { |
823 | checksel = 0; |
811 | checksel = 0; |
824 | /* |
812 | /* |
825 | * If we wrote anywhere in the selected area, kill the selection |
813 | * If we wrote anywhere in the selected area, kill the selection |
826 | * XXX: should we kill the mark too? Possibly, but maybe that |
814 | * XXX: should we kill the mark too? Possibly, but maybe that |
827 | * should be a similar check. |
815 | * should be a similar check. |
828 | */ |
816 | */ |
829 | CLEAR_SELECTION (); |
817 | CLEAR_SELECTION (); |
830 | } |
818 | } |
831 | |
819 | |
832 | if (screen.flags & Screen_WrapNext) |
820 | if (expect_false (screen.flags & Screen_WrapNext)) |
833 | { |
821 | { |
834 | scr_do_wrap (); |
822 | scr_do_wrap (); |
835 | |
823 | |
836 | line->l = ncol; |
824 | line->l = ncol; |
837 | line->is_longer (1); |
825 | line->is_longer (1); |
… | |
… | |
839 | row = screen.cur.row; |
827 | row = screen.cur.row; |
840 | line = &ROW(row); /* _must_ refresh */ |
828 | line = &ROW(row); /* _must_ refresh */ |
841 | } |
829 | } |
842 | |
830 | |
843 | // some utf-8 decoders "decode" surrogate characters: let's fix this. |
831 | // some utf-8 decoders "decode" surrogate characters: let's fix this. |
844 | if (IN_RANGE_INC (c, 0xd800, 0xdfff)) |
832 | if (expect_false (IN_RANGE_INC (c, 0xd800, 0xdfff))) |
845 | c = 0xfffd; |
833 | c = 0xfffd; |
846 | |
834 | |
847 | // rely on wcwidth to tell us the character width, do wcwidth before |
835 | // rely on wcwidth to tell us the character width, do wcwidth before |
848 | // further replacements, as wcwidth might return -1 for the line |
836 | // further replacements, as wcwidth might return -1 for the line |
849 | // drawing characters below as they might be invalid in the current |
837 | // drawing characters below as they might be invalid in the current |
850 | // locale. |
838 | // locale. |
851 | int width = WCWIDTH (c); |
839 | int width = WCWIDTH (c); |
852 | |
840 | |
853 | if (charsets [screen.charset] == '0') // DEC SPECIAL |
841 | if (expect_false (charsets [screen.charset] == '0')) // DEC SPECIAL |
854 | { |
842 | { |
855 | // vt100 special graphics and line drawing |
843 | // vt100 special graphics and line drawing |
856 | // 5f-7e standard vt100 |
844 | // 5f-7e standard vt100 |
857 | // 40-5e rxvt extension for extra curses acs chars |
845 | // 40-5e rxvt extension for extra curses acs chars |
858 | static uint16_t vt100_0[62] = { // 41 .. 7e |
846 | static uint16_t vt100_0[62] = { // 41 .. 7e |
… | |
… | |
871 | c = vt100_0[c - 0x41]; |
859 | c = vt100_0[c - 0x41]; |
872 | width = 1; // vt100 line drawing characters are always single-width |
860 | width = 1; // vt100 line drawing characters are always single-width |
873 | } |
861 | } |
874 | } |
862 | } |
875 | |
863 | |
876 | if (screen.flags & Screen_Insert) |
864 | if (expect_false (screen.flags & Screen_Insert)) |
877 | scr_insdel_chars (width, INSERT); |
865 | scr_insdel_chars (width, INSERT); |
878 | |
866 | |
879 | if (width != 0) |
867 | if (width != 0) |
880 | { |
868 | { |
881 | #if !UNICODE_3 |
869 | #if !UNICODE_3 |
… | |
… | |
887 | c = 0xfffd; |
875 | c = 0xfffd; |
888 | # endif |
876 | # endif |
889 | #endif |
877 | #endif |
890 | |
878 | |
891 | // nuke the character at this position, if required |
879 | // nuke the character at this position, if required |
|
|
880 | if (expect_false ( |
892 | if (line->t[screen.cur.col] == NOCHAR |
881 | line->t[screen.cur.col] == NOCHAR |
893 | || (screen.cur.col < ncol - 1 |
882 | || (screen.cur.col < ncol - 1 |
894 | && line->t[screen.cur.col + 1] == NOCHAR)) |
883 | && line->t[screen.cur.col + 1] == NOCHAR) |
|
|
884 | )) |
895 | { |
885 | { |
896 | int col = screen.cur.col; |
886 | int col = screen.cur.col; |
897 | |
887 | |
898 | // find begin |
888 | // find begin |
899 | while (col > 0 && line->t[col] == NOCHAR) |
889 | while (col > 0 && line->t[col] == NOCHAR) |
… | |
… | |
910 | } |
900 | } |
911 | |
901 | |
912 | rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); |
902 | rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); |
913 | |
903 | |
914 | // if the character doesn't fit into the remaining columns... |
904 | // if the character doesn't fit into the remaining columns... |
915 | if (screen.cur.col > ncol - width && ncol >= width) |
905 | if (expect_false (screen.cur.col > ncol - width && ncol >= width)) |
916 | { |
906 | { |
917 | // ...output spaces |
907 | // ...output spaces |
918 | c = ' '; |
908 | c = ' '; |
919 | // and try the same character next loop iteration |
909 | // and try the same character next loop iteration |
920 | --str; |
910 | --str; |
… | |
… | |
925 | do |
915 | do |
926 | { |
916 | { |
927 | line->t[screen.cur.col] = c; |
917 | line->t[screen.cur.col] = c; |
928 | line->r[screen.cur.col] = rend; |
918 | line->r[screen.cur.col] = rend; |
929 | |
919 | |
930 | if (screen.cur.col < ncol - 1) |
920 | if (expect_true (screen.cur.col < ncol - 1)) |
931 | screen.cur.col++; |
921 | screen.cur.col++; |
932 | else |
922 | else |
933 | { |
923 | { |
934 | line->l = ncol; |
924 | line->l = ncol; |
935 | if (screen.flags & Screen_Autowrap) |
925 | if (screen.flags & Screen_Autowrap) |
… | |
… | |
937 | break; |
927 | break; |
938 | } |
928 | } |
939 | |
929 | |
940 | c = NOCHAR; |
930 | c = NOCHAR; |
941 | } |
931 | } |
942 | while (--width > 0); |
932 | while (expect_false (--width > 0)); |
943 | |
933 | |
944 | // pad with spaces when overwriting wide character with smaller one |
934 | // pad with spaces when overwriting wide character with smaller one |
945 | if (!width) |
935 | if (expect_false (!width)) |
946 | { |
936 | { |
947 | line->touch (); |
937 | line->touch (); |
948 | |
938 | |
949 | for (int c = screen.cur.col; c < ncol && line->t[c] == NOCHAR; c++) |
939 | for (int c = screen.cur.col; c < ncol && line->t[c] == NOCHAR; c++) |
950 | { |
940 | { |
951 | line->t[c] = ' '; |
941 | line->t[c] = ' '; |
952 | line->r[c] = rend; |
942 | line->r[c] = rend; |
953 | } |
943 | } |
954 | } |
944 | } |
955 | } |
945 | } |
|
|
946 | #if ENABLE_COMBINING |
956 | else // width == 0 |
947 | else // width == 0 |
957 | { |
948 | { |
958 | #if ENABLE_COMBINING |
949 | 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 | { |
950 | { |
|
|
951 | // handle combining characters |
|
|
952 | // we just tag the accent on the previous on-screen character. |
|
|
953 | // this is arguably not correct, but also arguably not wrong. |
|
|
954 | // we don't handle double-width characters nicely yet. |
|
|
955 | line_t *linep; |
|
|
956 | text_t *tp; |
|
|
957 | rend_t *rp; |
|
|
958 | |
|
|
959 | if (screen.cur.col > 0) |
|
|
960 | { |
969 | linep = line; |
961 | linep = line; |
970 | tp = line->t + screen.cur.col - 1; |
962 | tp = line->t + screen.cur.col - 1; |
971 | rp = line->r + screen.cur.col - 1; |
963 | rp = line->r + screen.cur.col - 1; |
|
|
964 | } |
|
|
965 | else if (screen.cur.row > 0 |
|
|
966 | && ROW(screen.cur.row - 1).is_longer ()) |
|
|
967 | { |
|
|
968 | linep = &ROW(screen.cur.row - 1); |
|
|
969 | tp = line->t + ncol - 1; |
|
|
970 | rp = line->r + ncol - 1; |
|
|
971 | } |
|
|
972 | else |
|
|
973 | continue; |
|
|
974 | |
|
|
975 | linep->touch (); |
|
|
976 | |
|
|
977 | while (*tp == NOCHAR && tp > linep->t) |
|
|
978 | tp--, rp--; |
|
|
979 | |
|
|
980 | // first try to find a precomposed character |
|
|
981 | unicode_t n = rxvt_compose (*tp, c); |
|
|
982 | if (n == NOCHAR) |
|
|
983 | n = rxvt_composite.compose (*tp, c); |
|
|
984 | |
|
|
985 | *tp = n; |
|
|
986 | *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp)); |
972 | } |
987 | } |
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 | } |
988 | } |
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 |
989 | #endif |
996 | } |
|
|
997 | } |
990 | } |
998 | |
991 | |
999 | max_it (line->l, screen.cur.col); |
992 | max_it (line->l, screen.cur.col); |
1000 | |
993 | |
1001 | #ifdef DEBUG_STRICT |
994 | #ifdef DEBUG_STRICT |
… | |
… | |
1225 | /* |
1218 | /* |
1226 | * Erase part or whole of a line |
1219 | * Erase part or whole of a line |
1227 | * XTERM_SEQ: Clear line to right: ESC [ 0 K |
1220 | * XTERM_SEQ: Clear line to right: ESC [ 0 K |
1228 | * XTERM_SEQ: Clear line to left : ESC [ 1 K |
1221 | * XTERM_SEQ: Clear line to left : ESC [ 1 K |
1229 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1222 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
|
|
1223 | * extension: clear to right unless wrapped: ESC [ 3 K |
1230 | */ |
1224 | */ |
1231 | void |
1225 | void |
1232 | rxvt_term::scr_erase_line (int mode) NOTHROW |
1226 | rxvt_term::scr_erase_line (int mode) NOTHROW |
1233 | { |
1227 | { |
1234 | unsigned int col, num; |
1228 | unsigned int col, num; |
… | |
… | |
1243 | line.touch (); |
1237 | line.touch (); |
1244 | line.is_longer (0); |
1238 | line.is_longer (0); |
1245 | |
1239 | |
1246 | switch (mode) |
1240 | switch (mode) |
1247 | { |
1241 | { |
|
|
1242 | case 3: |
|
|
1243 | if (screen.flags & Screen_WrapNext) |
|
|
1244 | return; |
|
|
1245 | |
|
|
1246 | /* fall through */ |
|
|
1247 | |
1248 | case 0: /* erase to end of line */ |
1248 | case 0: /* erase to end of line */ |
1249 | col = screen.cur.col; |
1249 | col = screen.cur.col; |
1250 | num = ncol - col; |
1250 | num = ncol - col; |
1251 | min_it (line.l, col); |
1251 | min_it (line.l, col); |
|
|
1252 | |
1252 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1253 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1253 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1254 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1254 | CLEAR_SELECTION (); |
1255 | CLEAR_SELECTION (); |
1255 | break; |
1256 | break; |
|
|
1257 | |
1256 | case 1: /* erase to beginning of line */ |
1258 | case 1: /* erase to beginning of line */ |
1257 | col = 0; |
1259 | col = 0; |
1258 | num = screen.cur.col + 1; |
1260 | num = screen.cur.col + 1; |
|
|
1261 | |
1259 | if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur) |
1262 | if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur) |
1260 | || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur)) |
1263 | || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur)) |
1261 | CLEAR_SELECTION (); |
1264 | CLEAR_SELECTION (); |
1262 | break; |
1265 | break; |
|
|
1266 | |
1263 | case 2: /* erase whole line */ |
1267 | case 2: /* erase whole line */ |
1264 | col = 0; |
1268 | col = 0; |
1265 | num = ncol; |
1269 | num = ncol; |
1266 | line.l = 0; |
1270 | line.l = 0; |
1267 | if (selection.beg.row <= screen.cur.row |
1271 | if (selection.beg.row <= screen.cur.row |
… | |
… | |
1325 | if (row >= nrow) /* Out Of Bounds */ |
1329 | if (row >= nrow) /* Out Of Bounds */ |
1326 | return; |
1330 | return; |
1327 | |
1331 | |
1328 | min_it (num, nrow - row); |
1332 | min_it (num, nrow - row); |
1329 | |
1333 | |
|
|
1334 | /*TODO: the xlceararea/xfillrectangle below don't take scroll offste into account, ask mikachu for details */ |
1330 | if (rstyle & (RS_RVid | RS_Uline)) |
1335 | if (rstyle & (RS_RVid | RS_Uline)) |
1331 | ren = (rend_t) ~RS_None; |
1336 | ren = (rend_t) ~RS_None; |
1332 | else if (GET_BASEBG (rstyle) == Color_bg) |
1337 | else if (GET_BASEBG (rstyle) == Color_bg) |
1333 | { |
1338 | { |
1334 | ren = DEFAULT_RSTYLE; |
1339 | ren = DEFAULT_RSTYLE; |
1335 | CLEAR_ROWS (row, num); |
1340 | |
|
|
1341 | if (mapped) |
|
|
1342 | XClearArea (dpy, vt, 0, |
|
|
1343 | Row2Pixel (row), (unsigned int)width, |
|
|
1344 | (unsigned int)Height2Pixel (num), False); |
1336 | } |
1345 | } |
1337 | else |
1346 | else |
1338 | { |
1347 | { |
1339 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1348 | ren = rstyle & (RS_fgMask | RS_bgMask); |
|
|
1349 | |
1340 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1350 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1341 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1351 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1342 | ERASE_ROWS (row, num); |
1352 | XFillRectangle (dpy, vt, gc, |
|
|
1353 | 0, Row2Pixel (row), |
|
|
1354 | (unsigned int)width, |
|
|
1355 | (unsigned int)Height2Pixel (num)); |
1343 | gcvalue.foreground = pix_colors[Color_fg]; |
1356 | gcvalue.foreground = pix_colors[Color_fg]; |
1344 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1357 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1345 | } |
1358 | } |
1346 | |
1359 | |
1347 | for (; num--; row++) |
1360 | for (; num--; row++) |
… | |
… | |
1915 | void |
1928 | void |
1916 | rxvt_term::scr_printscreen (int fullhist) NOTHROW |
1929 | rxvt_term::scr_printscreen (int fullhist) NOTHROW |
1917 | { |
1930 | { |
1918 | #ifdef PRINTPIPE |
1931 | #ifdef PRINTPIPE |
1919 | int nrows, row_start; |
1932 | int nrows, row_start; |
1920 | FILE *fd; |
1933 | FILE *fd = popen_printer (); |
1921 | |
1934 | |
1922 | if ((fd = popen_printer ()) == NULL) |
1935 | if (!fd) |
1923 | return; |
1936 | return; |
1924 | |
1937 | |
1925 | if (fullhist) |
1938 | if (fullhist) |
1926 | { |
1939 | { |
1927 | nrows = nrow - top_row; |
1940 | nrows = nrow - top_row; |
… | |
… | |
2197 | continue; |
2210 | continue; |
2198 | |
2211 | |
2199 | // redraw one or more characters |
2212 | // redraw one or more characters |
2200 | |
2213 | |
2201 | // seek to the beginning of wide characters |
2214 | // seek to the beginning of wide characters |
2202 | while (stp[col] == NOCHAR && col > 0) |
2215 | while (expect_false (stp[col] == NOCHAR && col > 0)) |
2203 | --col; |
2216 | --col; |
2204 | |
2217 | |
2205 | rend_t rend = srp[col]; /* screen rendition (target rendtion) */ |
2218 | rend_t rend = srp[col]; /* screen rendition (target rendtion) */ |
2206 | text_t *text = stp + col; |
2219 | text_t *text = stp + col; |
2207 | int count = 1; |
2220 | int count = 1; |
… | |
… | |
2244 | |
2257 | |
2245 | col--; /* went one too far. move back */ |
2258 | col--; /* went one too far. move back */ |
2246 | count -= i; /* dump any matching trailing chars */ |
2259 | count -= i; /* dump any matching trailing chars */ |
2247 | |
2260 | |
2248 | // sometimes we optimize away the trailing NOCHAR's, add them back |
2261 | // sometimes we optimize away the trailing NOCHAR's, add them back |
2249 | while (i && text[count] == NOCHAR) |
2262 | while (expect_false (i && text[count] == NOCHAR)) |
2250 | count++, i--; |
2263 | count++, i--; |
2251 | |
2264 | |
2252 | /* |
2265 | /* |
2253 | * Determine the attributes for the string |
2266 | * Determine the attributes for the string |
2254 | */ |
2267 | */ |
2255 | int fore = fgcolor_of (rend); // desired foreground |
2268 | int fore = fgcolor_of (rend); // desired foreground |
2256 | int back = bgcolor_of (rend); // desired background |
2269 | int back = bgcolor_of (rend); // desired background |
2257 | |
2270 | |
2258 | // only do special processing if any attributes are set, which is unlikely |
2271 | // only do special processing if any attributes are set, which is unlikely |
2259 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2272 | if (expect_false (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful))) |
2260 | { |
2273 | { |
2261 | bool invert = rend & RS_RVid; |
2274 | bool invert = rend & RS_RVid; |
2262 | |
2275 | |
2263 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2276 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2264 | if (rend & RS_Bold && fore == Color_fg) |
2277 | if (rend & RS_Bold && fore == Color_fg) |
… | |
… | |
2347 | /* |
2360 | /* |
2348 | * Actually do the drawing of the string here |
2361 | * Actually do the drawing of the string here |
2349 | */ |
2362 | */ |
2350 | rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)]; |
2363 | rxvt_font *font = (*fontset[GET_STYLE (rend)])[GET_FONT (rend)]; |
2351 | |
2364 | |
2352 | if (have_bg && back == Color_bg) |
2365 | if (expect_true (have_bg && back == Color_bg)) |
2353 | { |
2366 | { |
2354 | // this is very ugly, maybe push it into ->draw? |
2367 | // this is very ugly, maybe push it into ->draw? |
2355 | |
2368 | |
2356 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2369 | for (i = 0; i < count; i++) /* don't draw empty strings */ |
2357 | if (text[i] != ' ') |
2370 | if (text[i] != ' ') |
… | |
… | |
2364 | did_clear: ; |
2377 | did_clear: ; |
2365 | } |
2378 | } |
2366 | else |
2379 | else |
2367 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2380 | font->draw (*drawable, xpixel, ypixel, text, count, fore, back); |
2368 | |
2381 | |
2369 | if (rend & RS_Uline && font->descent > 1 && fore != back) |
2382 | if (expect_false (rend & RS_Uline && font->descent > 1 && fore != back)) |
2370 | { |
2383 | { |
2371 | #if ENABLE_FRILLS |
2384 | #if ENABLE_FRILLS |
2372 | if (ISSET_PIXCOLOR (Color_underline)) |
2385 | if (ISSET_PIXCOLOR (Color_underline)) |
2373 | XSetForeground (dpy, gc, pix_colors[Color_underline]); |
2386 | XSetForeground (dpy, gc, pix_colors[Color_underline]); |
2374 | else |
2387 | else |
… | |
… | |
2478 | |
2491 | |
2479 | if (scrollBar.win) |
2492 | if (scrollBar.win) |
2480 | { |
2493 | { |
2481 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); |
2494 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); |
2482 | scrollBar.state = STATE_IDLE; |
2495 | scrollBar.state = STATE_IDLE; |
2483 | scrollbar_show (0); |
2496 | scrollBar.show (0); |
2484 | } |
2497 | } |
2485 | |
2498 | |
2486 | #endif |
2499 | #endif |
2487 | |
2500 | |
2488 | /* bgPixmap.apply () does not do the following : */ |
2501 | /* bgPixmap.apply () does not do the following : */ |
… | |
… | |
2585 | { |
2598 | { |
2586 | int row, wrote; |
2599 | int row, wrote; |
2587 | unsigned int width, towrite; |
2600 | unsigned int width, towrite; |
2588 | char r1[] = "\n"; |
2601 | char r1[] = "\n"; |
2589 | |
2602 | |
2590 | for (row = saveLines - nsaved; |
2603 | for (row = saveLines + top_row; |
2591 | row < saveLines + nrow - 1; row++) |
2604 | row < saveLines + nrow - 1; row++) |
2592 | { |
2605 | { |
2593 | width = row_buf[row].l >= 0 ? row_buf[row].l |
2606 | width = row_buf[row].l >= 0 ? row_buf[row].l |
2594 | : ncol; |
2607 | : ncol; |
2595 | for (towrite = width; towrite; towrite -= wrote) |
2608 | for (towrite = width; towrite; towrite -= wrote) |