… | |
… | |
118 | /* Fill part/all of a line with blanks. */ |
118 | /* Fill part/all of a line with blanks. */ |
119 | void |
119 | void |
120 | rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs) |
120 | rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs) |
121 | { |
121 | { |
122 | efs &= ~RS_baseattrMask; |
122 | efs &= ~RS_baseattrMask; |
123 | efs = SET_FONT (efs, TermWin.fontset->find_font (' ')); |
123 | efs = SET_FONT (efs, TermWin.ascii_map [' ' - 0x20]); |
124 | |
124 | |
125 | while (width--) |
125 | while (width--) |
126 | { |
126 | { |
127 | *et++ = ' '; |
127 | *et++ = ' '; |
128 | *er++ = efs; |
128 | *er++ = efs; |
… | |
… | |
705 | if (j > 0) |
705 | if (j > 0) |
706 | { |
706 | { |
707 | /* A: scroll up */ |
707 | /* A: scroll up */ |
708 | |
708 | |
709 | /* A1: Copy lines that will get clobbered by the rotation */ |
709 | /* A1: Copy lines that will get clobbered by the rotation */ |
|
|
710 | memcpy (buf_text, screen.text + row1, count * sizeof (text_t *)); |
|
|
711 | memcpy (buf_rend, screen.rend + row1, count * sizeof (rend_t *)); |
|
|
712 | |
|
|
713 | /* A2: Rotate lines */ |
|
|
714 | i = row2 - row1 - count + 1; |
|
|
715 | memmove (screen.tlen + row1, screen.tlen + row1 + count, i * sizeof (int16_t)); |
|
|
716 | memmove (screen.text + row1, screen.text + row1 + count, i * sizeof (text_t *)); |
|
|
717 | memmove (screen.rend + row1, screen.rend + row1 + count, i * sizeof (rend_t *)); |
|
|
718 | |
|
|
719 | j = row2 - count + 1, i = count; |
|
|
720 | } |
|
|
721 | else /* if (j < 0) */ |
|
|
722 | { |
|
|
723 | /* B: scroll down */ |
|
|
724 | |
|
|
725 | /* B1: Copy lines that will get clobbered by the rotation */ |
710 | for (i = 0, j = row1; i < count; i++, j++) |
726 | for (i = 0, j = row2; i < count; i++, j--) |
711 | { |
727 | { |
712 | buf_text[i] = screen.text[j]; |
728 | buf_text[i] = screen.text[j]; |
713 | buf_rend[i] = screen.rend[j]; |
729 | buf_rend[i] = screen.rend[j]; |
714 | } |
730 | } |
715 | |
731 | |
716 | /* A2: Rotate lines */ |
732 | /* B2: Rotate lines */ |
717 | for (j = row1, i = j + count; i <= row2; i++, j++) |
733 | for (j = row2, i = j - count; i >= row1; i--, j--) |
718 | { |
734 | { |
719 | screen.tlen[j] = screen.tlen[i]; |
735 | screen.tlen[j] = screen.tlen[i]; |
720 | screen.text[j] = screen.text[i]; |
736 | screen.text[j] = screen.text[i]; |
721 | screen.rend[j] = screen.rend[i]; |
737 | screen.rend[j] = screen.rend[i]; |
722 | } |
738 | } |
723 | |
739 | |
724 | j = row2 - count + 1, i = count; |
|
|
725 | } |
|
|
726 | else /* if (j < 0) */ |
|
|
727 | { |
|
|
728 | /* B: scroll down */ |
|
|
729 | |
|
|
730 | /* B1: Copy lines that will get clobbered by the rotation */ |
|
|
731 | for (i = 0, j = row2; i < count; i++, j--) |
|
|
732 | { |
|
|
733 | buf_text[i] = screen.text[j]; |
|
|
734 | buf_rend[i] = screen.rend[j]; |
|
|
735 | } |
|
|
736 | |
|
|
737 | /* B2: Rotate lines */ |
|
|
738 | for (j = row2, i = j - count; i >= row1; i--, j--) |
|
|
739 | { |
|
|
740 | screen.tlen[j] = screen.tlen[i]; |
|
|
741 | screen.text[j] = screen.text[i]; |
|
|
742 | screen.rend[j] = screen.rend[i]; |
|
|
743 | } |
|
|
744 | |
|
|
745 | j = row1, i = count; |
740 | j = row1, i = count; |
746 | count = -count; |
741 | count = -count; |
747 | } |
742 | } |
748 | |
743 | |
749 | /* C: Resurrect lines */ |
744 | /* C: Resurrect lines */ |
|
|
745 | memset (screen.tlen + j, 0, i * sizeof (int16_t)); |
|
|
746 | memcpy (screen.text + j, buf_text, i * sizeof (text_t *)); |
|
|
747 | memcpy (screen.rend + j, buf_rend, i * sizeof (text_t *)); |
|
|
748 | if (!spec) /* line length may not equal TermWin.ncol */ |
750 | for (; i--; j++) |
749 | for (; i--; j++) |
751 | { |
|
|
752 | screen.tlen[j] = 0; |
|
|
753 | screen.text[j] = buf_text[i]; |
|
|
754 | screen.rend[j] = buf_rend[i]; |
|
|
755 | |
|
|
756 | if (!spec) /* line length may not equal TermWin.ncol */ |
|
|
757 | scr_blank_screen_mem (screen.text, screen.rend, (unsigned int)j, rstyle); |
750 | scr_blank_screen_mem (screen.text, screen.rend, (unsigned int)j, rstyle); |
758 | } |
|
|
759 | |
751 | |
760 | return count; |
752 | return count; |
761 | } |
753 | } |
762 | |
754 | |
763 | /* ------------------------------------------------------------------------- */ |
755 | /* ------------------------------------------------------------------------- */ |
… | |
… | |
781 | |
773 | |
782 | D_SCREEN ((stderr, "rxvt_scr_add_lines (%d,%d)", nlines, len)); |
774 | D_SCREEN ((stderr, "rxvt_scr_add_lines (%d,%d)", nlines, len)); |
783 | ZERO_SCROLLBACK (); |
775 | ZERO_SCROLLBACK (); |
784 | if (nlines > 0) |
776 | if (nlines > 0) |
785 | { |
777 | { |
786 | nlines += (screen.cur.row - screen.bscroll); |
778 | nlines += screen.cur.row - screen.bscroll; |
787 | if ((nlines > 0) |
779 | if ((nlines > 0) |
788 | && (screen.tscroll == 0) |
780 | && (screen.tscroll == 0) |
789 | && (screen.bscroll == (TermWin.nrow - 1))) |
781 | && (screen.bscroll == (TermWin.nrow - 1))) |
790 | { |
782 | { |
791 | /* _at least_ this many lines need to be scrolled */ |
783 | /* _at least_ this many lines need to be scrolled */ |
… | |
… | |
794 | } |
786 | } |
795 | } |
787 | } |
796 | #ifdef DEBUG_STRICT |
788 | #ifdef DEBUG_STRICT |
797 | assert (screen.cur.col < last_col); |
789 | assert (screen.cur.col < last_col); |
798 | assert ((screen.cur.row < TermWin.nrow) |
790 | assert ((screen.cur.row < TermWin.nrow) |
799 | && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); |
791 | && (screen.cur.row >= - (int32_t)TermWin.nscrolled)); |
800 | #else /* drive with your eyes closed */ |
792 | #else /* drive with your eyes closed */ |
801 | MIN_IT (screen.cur.col, last_col - 1); |
793 | MIN_IT (screen.cur.col, last_col - 1); |
802 | MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); |
794 | MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1); |
803 | MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled); |
795 | MAX_IT (screen.cur.row, - (int32_t)TermWin.nscrolled); |
804 | #endif |
796 | #endif |
… | |
… | |
871 | scr_insdel_chars (1, INSERT); |
863 | scr_insdel_chars (1, INSERT); |
872 | |
864 | |
873 | // rely on wcwidth to tell us the character width, at least for non-latin1 |
865 | // rely on wcwidth to tell us the character width, at least for non-latin1 |
874 | // do wcwidth before further replacements, as wcwidth says that line-drawing |
866 | // do wcwidth before further replacements, as wcwidth says that line-drawing |
875 | // characters have width -1 (DOH!) on GNU/Linux sometimes. |
867 | // characters have width -1 (DOH!) on GNU/Linux sometimes. |
876 | int width = c < 256 ? 1 : wcwidth (c); |
868 | int width = c < 0x100 ? 1 : wcwidth (c); |
877 | |
869 | |
878 | if (charsets[screen.charset] == '0') // DEC SPECIAL |
870 | if (charsets[screen.charset] == '0') // DEC SPECIAL |
879 | { |
871 | { |
880 | // vt100 special graphics and line drawing |
872 | // vt100 special graphics and line drawing |
881 | static uint16_t vt100_0[32] = { // 5f .. 7e |
873 | static uint16_t vt100_0[32] = { // 5f .. 7e |
… | |
… | |
898 | // trim characters we can't store directly :( |
890 | // trim characters we can't store directly :( |
899 | if (c >= 0x10000) |
891 | if (c >= 0x10000) |
900 | c = rxvt_composite.compose (c); // map to lower 16 bits |
892 | c = rxvt_composite.compose (c); // map to lower 16 bits |
901 | #endif |
893 | #endif |
902 | bool bold = (Options & Opt_realBold) && ((rstyle & RS_Bold) != 0); |
894 | bool bold = (Options & Opt_realBold) && ((rstyle & RS_Bold) != 0); |
903 | rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c, bold)); |
895 | rend_t rend = SET_FONT (rstyle, |
|
|
896 | c > 0x7f || bold || c < 0x20 |
|
|
897 | ? TermWin.fontset->find_font (c, bold) |
|
|
898 | : TermWin.ascii_map [c - 0x20]); |
904 | |
899 | |
905 | do |
900 | do |
906 | { |
901 | { |
907 | stp[screen.cur.col] = c; |
902 | stp[screen.cur.col] = c; |
908 | srp[screen.cur.col] = rend; |
903 | srp[screen.cur.col] = rend; |
… | |
… | |
1289 | break; |
1284 | break; |
1290 | default: |
1285 | default: |
1291 | return; |
1286 | return; |
1292 | } |
1287 | } |
1293 | |
1288 | |
1294 | refresh_type |= REFRESH_BOUNDS; |
|
|
1295 | |
|
|
1296 | if (selection.op && current_screen == selection.screen |
1289 | if (selection.op && current_screen == selection.screen |
1297 | && ((selection.beg.row >= row && selection.beg.row <= row + num) |
1290 | && ((selection.beg.row >= row && selection.beg.row <= row + num) |
1298 | || (selection.end.row >= row |
1291 | || (selection.end.row >= row |
1299 | && selection.end.row <= row + num))) |
1292 | && selection.end.row <= row + num))) |
1300 | CLEAR_SELECTION (); |
1293 | CLEAR_SELECTION (); |
… | |
… | |
1747 | row_col_t rc[RC_COUNT]; |
1740 | row_col_t rc[RC_COUNT]; |
1748 | |
1741 | |
1749 | if (drawn_text == NULL) /* sanity check */ |
1742 | if (drawn_text == NULL) /* sanity check */ |
1750 | return; |
1743 | return; |
1751 | |
1744 | |
|
|
1745 | #ifndef NO_SLOW_LINK_SUPPORT |
|
|
1746 | if (refresh_type == FAST_REFRESH && !display->is_local) |
|
|
1747 | { |
|
|
1748 | y = 0; |
|
|
1749 | height = TermWin.height; |
|
|
1750 | } |
|
|
1751 | #endif |
|
|
1752 | |
1752 | #ifdef DEBUG_STRICT |
1753 | #ifdef DEBUG_STRICT |
1753 | x = max (x, 0); |
1754 | x = max (x, 0); |
1754 | x = min (x, (int)TermWin.width); |
1755 | x = min (x, (int)TermWin.width); |
1755 | y = max (y, 0); |
1756 | y = max (y, 0); |
1756 | y = min (y, (int)TermWin.height); |
1757 | y = min (y, (int)TermWin.height); |
… | |
… | |
1774 | |
1775 | |
1775 | for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) |
1776 | for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) |
1776 | fill_text (&drawn_text[i][rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); |
1777 | fill_text (&drawn_text[i][rc[PART_BEG].col], 0, rc[PART_END].col - rc[PART_BEG].col + 1); |
1777 | |
1778 | |
1778 | if (refresh) |
1779 | if (refresh) |
1779 | scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); |
1780 | scr_refresh (SLOW_REFRESH); |
1780 | } |
1781 | } |
1781 | |
1782 | |
1782 | /* ------------------------------------------------------------------------- */ |
1783 | /* ------------------------------------------------------------------------- */ |
1783 | /* |
1784 | /* |
1784 | * Refresh the entire screen |
1785 | * Refresh the entire screen |
… | |
… | |
1819 | * direction should be UP or DN |
1820 | * direction should be UP or DN |
1820 | */ |
1821 | */ |
1821 | int |
1822 | int |
1822 | rxvt_term::scr_page (enum page_dirn direction, int nlines) |
1823 | rxvt_term::scr_page (enum page_dirn direction, int nlines) |
1823 | { |
1824 | { |
1824 | int n; |
1825 | int n; |
1825 | uint16_t oldviewstart; |
1826 | uint16_t oldviewstart; |
1826 | |
1827 | |
1827 | D_SCREEN ((stderr, "rxvt_scr_page (%s, %d) view_start:%d", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start)); |
1828 | D_SCREEN ((stderr, "rxvt_scr_page (%s, %d) view_start:%d", ((direction == UP) ? "UP" : "DN"), nlines, TermWin.view_start)); |
1828 | #ifdef DEBUG_STRICT |
1829 | #ifdef DEBUG_STRICT |
1829 | assert ((nlines >= 0) && (nlines <= TermWin.nrow)); |
1830 | assert ((nlines >= 0) && (nlines <= TermWin.nrow)); |
1830 | #endif |
1831 | #endif |
… | |
… | |
1926 | ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) |
1927 | ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) |
1927 | |
1928 | |
1928 | void |
1929 | void |
1929 | rxvt_term::scr_refresh (unsigned char refresh_type) |
1930 | rxvt_term::scr_refresh (unsigned char refresh_type) |
1930 | { |
1931 | { |
1931 | unsigned char clearfirst, /* first character writes before cell */ |
|
|
1932 | clearlast, /* last character writes beyond cell */ |
|
|
1933 | must_clear, /* use draw_string not draw_image_string */ |
1932 | unsigned char must_clear, /* use draw_string not draw_image_string */ |
1934 | rvid, /* reverse video this position */ |
1933 | rvid, /* reverse video this position */ |
1935 | showcursor; /* show the cursor */ |
1934 | showcursor; /* show the cursor */ |
1936 | int16_t col, row, /* column/row we're processing */ |
1935 | int16_t col, row, /* column/row we're processing */ |
1937 | ocrow; /* old cursor row */ |
1936 | ocrow; /* old cursor row */ |
1938 | int i, /* tmp */ |
1937 | int i, /* tmp */ |
… | |
… | |
1947 | return; |
1946 | return; |
1948 | |
1947 | |
1949 | /* |
1948 | /* |
1950 | * A: set up vars |
1949 | * A: set up vars |
1951 | */ |
1950 | */ |
1952 | clearfirst = clearlast = must_clear = 0; |
1951 | must_clear = 0; |
1953 | |
1952 | |
1954 | refresh_count = 0; |
1953 | refresh_count = 0; |
1955 | |
1954 | |
1956 | row_offset = TermWin.saveLines - TermWin.view_start; |
1955 | row_offset = TermWin.saveLines - TermWin.view_start; |
1957 | |
|
|
1958 | if ((refresh_type & REFRESH_BOUNDS)) |
|
|
1959 | { |
|
|
1960 | clearfirst = clearlast = 1; |
|
|
1961 | refresh_type &= ~REFRESH_BOUNDS; |
|
|
1962 | } |
|
|
1963 | |
1956 | |
1964 | #ifdef XPM_BACKGROUND |
1957 | #ifdef XPM_BACKGROUND |
1965 | must_clear |= (bgPixmap.pixmap != None); |
1958 | must_clear |= (bgPixmap.pixmap != None); |
1966 | #endif |
1959 | #endif |
1967 | #ifdef TRANSPARENT |
1960 | #ifdef TRANSPARENT |
… | |
… | |
2055 | /* |
2048 | /* |
2056 | * D: CopyArea pass - very useful for slower links |
2049 | * D: CopyArea pass - very useful for slower links |
2057 | * This has been deliberately kept simple. |
2050 | * This has been deliberately kept simple. |
2058 | */ |
2051 | */ |
2059 | i = num_scr; |
2052 | i = num_scr; |
|
|
2053 | if (!display->is_local |
2060 | if (refresh_type == FAST_REFRESH && num_scr_allow && i |
2054 | && refresh_type == FAST_REFRESH && num_scr_allow && i |
2061 | && abs (i) < TermWin.nrow && !must_clear) |
2055 | && abs (i) < TermWin.nrow && !must_clear) |
2062 | { |
2056 | { |
2063 | int16_t nits; |
2057 | int16_t nits; |
2064 | int j; |
2058 | int j; |
2065 | rend_t *drp2; |
2059 | rend_t *drp2; |
… | |
… | |
2235 | back = Color_RV; |
2229 | back = Color_RV; |
2236 | #endif |
2230 | #endif |
2237 | } |
2231 | } |
2238 | |
2232 | |
2239 | #ifdef TEXT_BLINK |
2233 | #ifdef TEXT_BLINK |
2240 | if (rend & RS_Blink && back == Color_bg) |
2234 | if (rend & RS_Blink && (back == Color_bg || fore == Color_bg)) |
2241 | { |
2235 | { |
2242 | if (!text_blink_ev.active) |
2236 | if (!text_blink_ev.active) |
2243 | { |
2237 | { |
2244 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
2238 | text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); |
2245 | hidden_text = 0; |
2239 | hidden_text = 0; |
… | |
… | |
2275 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2269 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, Color_bg); |
2276 | } |
2270 | } |
2277 | else |
2271 | else |
2278 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2272 | font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back); |
2279 | |
2273 | |
2280 | if ((rend & RS_Uline) && (font->descent > 1)) |
2274 | if (rend & RS_Uline && font->descent > 1 && fore != back) |
2281 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2275 | XDrawLine (display->display, drawBuffer, TermWin.gc, |
2282 | xpixel, ypixel + font->ascent + 1, |
2276 | xpixel, ypixel + font->ascent + 1, |
2283 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2277 | xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); |
2284 | } /* for (col....) */ |
2278 | } /* for (col....) */ |
2285 | } /* for (row....) */ |
2279 | } /* for (row....) */ |
… | |
… | |
2320 | /* |
2314 | /* |
2321 | * H: cleanup selection |
2315 | * H: cleanup selection |
2322 | */ |
2316 | */ |
2323 | scr_reverse_selection (); |
2317 | scr_reverse_selection (); |
2324 | |
2318 | |
2325 | /* |
|
|
2326 | * I: other general cleanup |
|
|
2327 | */ |
|
|
2328 | #if 0 |
|
|
2329 | if (clearfirst && TermWin.int_bwidth) |
|
|
2330 | /* |
|
|
2331 | * clear the whole screen height, note that width == 0 is treated |
|
|
2332 | * specially by XClearArea |
|
|
2333 | */ |
|
|
2334 | XClearArea (display->display, TermWin.vt, 0, 0, |
|
|
2335 | (unsigned int)TermWin.int_bwidth, |
|
|
2336 | (unsigned int)TermWin_TotalHeight (), False); |
|
|
2337 | |
|
|
2338 | if (clearlast && TermWin.int_bwidth) |
|
|
2339 | /* |
|
|
2340 | * clear the whole screen height, note that width == 0 is treated |
|
|
2341 | * specially by XClearArea |
|
|
2342 | */ |
|
|
2343 | XClearArea (display->display, TermWin.vt, |
|
|
2344 | TermWin.width + TermWin.int_bwidth, 0, |
|
|
2345 | (unsigned int)TermWin.int_bwidth, |
|
|
2346 | (unsigned int)TermWin_TotalHeight (), False); |
|
|
2347 | #endif |
|
|
2348 | |
|
|
2349 | if (refresh_type & SMOOTH_REFRESH) |
2319 | if (refresh_type & SMOOTH_REFRESH) |
2350 | XSync (display->display, False); |
2320 | XFlush (display->display); |
2351 | |
2321 | |
2352 | num_scr = 0; |
2322 | num_scr = 0; |
2353 | num_scr_allow = 1; |
2323 | num_scr_allow = 1; |
2354 | want_refresh = 0; /* screen is current */ |
2324 | want_refresh = 0; /* screen is current */ |
2355 | } |
2325 | } |