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.82 by root, Wed Aug 4 03:33:53 2004 UTC vs.
Revision 1.85 by root, Sun Aug 8 16:43:21 2004 UTC

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 */
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
1292 break; 1284 break;
1293 default: 1285 default:
1294 return; 1286 return;
1295 } 1287 }
1296 1288
1297 refresh_type |= REFRESH_BOUNDS;
1298
1299 if (selection.op && current_screen == selection.screen 1289 if (selection.op && current_screen == selection.screen
1300 && ((selection.beg.row >= row && selection.beg.row <= row + num) 1290 && ((selection.beg.row >= row && selection.beg.row <= row + num)
1301 || (selection.end.row >= row 1291 || (selection.end.row >= row
1302 && selection.end.row <= row + num))) 1292 && selection.end.row <= row + num)))
1303 CLEAR_SELECTION (); 1293 CLEAR_SELECTION ();
1785 1775
1786 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++)
1787 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);
1788 1778
1789 if (refresh) 1779 if (refresh)
1790 scr_refresh (SLOW_REFRESH | REFRESH_BOUNDS); 1780 scr_refresh (SLOW_REFRESH);
1791} 1781}
1792 1782
1793/* ------------------------------------------------------------------------- */ 1783/* ------------------------------------------------------------------------- */
1794/* 1784/*
1795 * Refresh the entire screen 1785 * Refresh the entire screen
1830 * direction should be UP or DN 1820 * direction should be UP or DN
1831 */ 1821 */
1832int 1822int
1833rxvt_term::scr_page (enum page_dirn direction, int nlines) 1823rxvt_term::scr_page (enum page_dirn direction, int nlines)
1834{ 1824{
1835 int n; 1825 int n;
1836 uint16_t oldviewstart; 1826 uint16_t oldviewstart;
1837 1827
1838 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));
1839#ifdef DEBUG_STRICT 1829#ifdef DEBUG_STRICT
1840 assert ((nlines >= 0) && (nlines <= TermWin.nrow)); 1830 assert ((nlines >= 0) && (nlines <= TermWin.nrow));
1841#endif 1831#endif
1937 ((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)
1938 1928
1939void 1929void
1940rxvt_term::scr_refresh (unsigned char refresh_type) 1930rxvt_term::scr_refresh (unsigned char refresh_type)
1941{ 1931{
1942 unsigned char clearfirst, /* first character writes before cell */
1943 clearlast, /* last character writes beyond cell */
1944 must_clear, /* use draw_string not draw_image_string */ 1932 unsigned char must_clear, /* use draw_string not draw_image_string */
1945 rvid, /* reverse video this position */ 1933 rvid, /* reverse video this position */
1946 showcursor; /* show the cursor */ 1934 showcursor; /* show the cursor */
1947 int16_t col, row, /* column/row we're processing */ 1935 int16_t col, row, /* column/row we're processing */
1948 ocrow; /* old cursor row */ 1936 ocrow; /* old cursor row */
1949 int i, /* tmp */ 1937 int i, /* tmp */
1958 return; 1946 return;
1959 1947
1960 /* 1948 /*
1961 * A: set up vars 1949 * A: set up vars
1962 */ 1950 */
1963 clearfirst = clearlast = must_clear = 0; 1951 must_clear = 0;
1964 1952
1965 refresh_count = 0; 1953 refresh_count = 0;
1966 1954
1967 row_offset = TermWin.saveLines - TermWin.view_start; 1955 row_offset = TermWin.saveLines - TermWin.view_start;
1968
1969 if ((refresh_type & REFRESH_BOUNDS))
1970 {
1971 clearfirst = clearlast = 1;
1972 refresh_type &= ~REFRESH_BOUNDS;
1973 }
1974 1956
1975#ifdef XPM_BACKGROUND 1957#ifdef XPM_BACKGROUND
1976 must_clear |= (bgPixmap.pixmap != None); 1958 must_clear |= (bgPixmap.pixmap != None);
1977#endif 1959#endif
1978#ifdef TRANSPARENT 1960#ifdef TRANSPARENT
2331 2313
2332 /* 2314 /*
2333 * H: cleanup selection 2315 * H: cleanup selection
2334 */ 2316 */
2335 scr_reverse_selection (); 2317 scr_reverse_selection ();
2336
2337 /*
2338 * I: other general cleanup
2339 */
2340#if 0
2341 if (clearfirst && TermWin.int_bwidth)
2342 /*
2343 * clear the whole screen height, note that width == 0 is treated
2344 * specially by XClearArea
2345 */
2346 XClearArea (display->display, TermWin.vt, 0, 0,
2347 (unsigned int)TermWin.int_bwidth,
2348 (unsigned int)TermWin_TotalHeight (), False);
2349
2350 if (clearlast && TermWin.int_bwidth)
2351 /*
2352 * clear the whole screen height, note that width == 0 is treated
2353 * specially by XClearArea
2354 */
2355 XClearArea (display->display, TermWin.vt,
2356 TermWin.width + TermWin.int_bwidth, 0,
2357 (unsigned int)TermWin.int_bwidth,
2358 (unsigned int)TermWin_TotalHeight (), False);
2359#endif
2360 2318
2361 if (refresh_type & SMOOTH_REFRESH) 2319 if (refresh_type & SMOOTH_REFRESH)
2362 XFlush (display->display); 2320 XFlush (display->display);
2363 2321
2364 num_scr = 0; 2322 num_scr = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines