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.399 by sf-exg, Thu Nov 3 10:42:17 2011 UTC vs.
Revision 1.412 by root, Wed Jan 18 12:26:59 2012 UTC

549 return; 549 return;
550 550
551 want_refresh = 1; 551 want_refresh = 1;
552 view_start = 0; 552 view_start = 0;
553 553
554 selection_check (2); /* check for boundary cross */ 554 /* check for boundary cross */
555 row_col_t pos;
556 pos.row = pos.col = 0;
557 if (ROWCOL_IS_BEFORE (selection.beg, pos)
558 && ROWCOL_IS_AFTER (selection.end, pos))
559 CLEAR_SELECTION ();
555 560
556 current_screen = scrn; 561 current_screen = scrn;
557 562
558#if NSCREENS 563#if NSCREENS
559 if (option (Opt_secondaryScreen)) 564 if (option (Opt_secondaryScreen))
681 } 686 }
682 else 687 else
683 scr_blank_screen_mem (l, rstyle); 688 scr_blank_screen_mem (l, rstyle);
684 } 689 }
685 690
691 // move and/or clear selection, if any
692 if (selection.op && current_screen == selection.screen
693 && selection.beg.row <= row2)
694 {
695 selection.beg.row -= count;
696 selection.end.row -= count;
697 selection.mark.row -= count;
698
699 selection_check (0);
700 }
701
686 // finally move the view window, if desired 702 // finally move the view window, if desired
687 if (option (Opt_scrollWithBuffer) 703 if (option (Opt_scrollWithBuffer)
688 && view_start != 0 704 && view_start != 0
689 && view_start != -saveLines) 705 && view_start != -saveLines)
690 scr_page (UP, count); 706 scr_page (UP, count);
692 if (SHOULD_INVOKE (HOOK_SCROLL_BACK)) 708 if (SHOULD_INVOKE (HOOK_SCROLL_BACK))
693 HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END)); 709 HOOK_INVOKE ((this, HOOK_SCROLL_BACK, DT_INT, count, DT_INT, top_row, DT_END));
694 } 710 }
695 else 711 else
696 { 712 {
713 if (selection.op && current_screen == selection.screen)
714 {
715 if ((selection.beg.row < row1 && selection.end.row > row1)
716 || (selection.beg.row < row2 && selection.end.row > row2)
717 || (selection.beg.row - count < row1 && selection.beg.row >= row1)
718 || (selection.beg.row - count > row2 && selection.beg.row <= row2)
719 || (selection.end.row - count < row1 && selection.end.row >= row1)
720 || (selection.end.row - count > row2 && selection.end.row <= row2))
721 {
722 CLEAR_ALL_SELECTION ();
723 selection.op = SELECTION_CLEAR;
724 }
725 else if (selection.end.row >= row1 && selection.end.row <= row2)
726 {
727 /* move selected region too */
728 selection.beg.row -= count;
729 selection.end.row -= count;
730 selection.mark.row -= count;
731
732 selection_check (0);
733 }
734 }
735
697 // use a simple and robust scrolling algorithm, this 736 // use a simple and robust scrolling algorithm, this
698 // part of scr_scroll_text is not time-critical. 737 // part of scr_scroll_text is not time-critical.
699 738
700 // sever line above scroll region 739 // sever line above scroll region
701 if (row1) 740 if (row1)
728 l.is_longer (0); 767 l.is_longer (0);
729 l.touch (); 768 l.touch ();
730 } 769 }
731 } 770 }
732 771
733 // move and/or clear selection, if any
734 if (selection.op && current_screen == selection.screen)
735 {
736 if ((selection.beg.row < row1 && selection.end.row > row1)
737 || (selection.beg.row < row2 && selection.end.row > row2)
738 || (selection.beg.row - count < row1 && selection.beg.row >= row1)
739 || (selection.beg.row - count > row2 && selection.beg.row <= row2)
740 || (selection.end.row - count < row1 && selection.end.row >= row1)
741 || (selection.end.row - count > row2 && selection.end.row <= row2))
742 CLEAR_ALL_SELECTION ();
743 else if (selection.end.row >= row1 && selection.end.row <= row2)
744 {
745 /* move selected region too */
746 selection.beg.row -= count;
747 selection.end.row -= count;
748 selection.mark.row -= count;
749
750 selection_check (0);
751 }
752 }
753
754 return count; 772 return count;
755} 773}
756 774
757/* ------------------------------------------------------------------------- */ 775/* ------------------------------------------------------------------------- */
758/* 776/*
762rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW 780rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW
763{ 781{
764 if (len <= 0) /* sanity */ 782 if (len <= 0) /* sanity */
765 return; 783 return;
766 784
767 unsigned char checksel; 785 bool checksel;
768 unicode_t c; 786 unicode_t c;
769 int ncol = this->ncol; 787 int ncol = this->ncol;
770 const wchar_t *strend = str + len; 788 const wchar_t *strend = str + len;
771 789
772 want_refresh = 1; 790 want_refresh = 1;
1294 scr_blank_line (line, col, num, rstyle); 1312 scr_blank_line (line, col, num, rstyle);
1295} 1313}
1296 1314
1297/* ------------------------------------------------------------------------- */ 1315/* ------------------------------------------------------------------------- */
1298/* 1316/*
1299 * Erase part of whole of the screen 1317 * Erase part or whole of the screen
1300 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J 1318 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J
1301 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J 1319 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J
1302 * XTERM_SEQ: Clear whole screen : ESC [ 2 J 1320 * XTERM_SEQ: Clear whole screen : ESC [ 2 J
1303 */ 1321 */
1304void 1322void
1313 ZERO_SCROLLBACK (); 1331 ZERO_SCROLLBACK ();
1314 1332
1315 switch (mode) 1333 switch (mode)
1316 { 1334 {
1317 case 0: /* erase to end of screen */ 1335 case 0: /* erase to end of screen */
1318 selection_check (1);
1319 scr_erase_line (0); 1336 scr_erase_line (0);
1320 row = screen.cur.row + 1; /* possible OOB */ 1337 row = screen.cur.row + 1; /* possible OOB */
1321 num = nrow - row; 1338 num = nrow - row;
1322 break; 1339 break;
1323 case 1: /* erase to beginning of screen */ 1340 case 1: /* erase to beginning of screen */
1324 selection_check (3);
1325 scr_erase_line (1); 1341 scr_erase_line (1);
1326 row = 0; 1342 row = 0;
1327 num = screen.cur.row; 1343 num = screen.cur.row;
1328 break; 1344 break;
1329 case 2: /* erase whole screen */ 1345 case 2: /* erase whole screen */
1330 selection_check (3);
1331 row = 0; 1346 row = 0;
1332 num = nrow; 1347 num = nrow;
1333 break; 1348 break;
1334 default: 1349 default:
1335 return; 1350 return;
1352 { 1367 {
1353 ren = DEFAULT_RSTYLE; 1368 ren = DEFAULT_RSTYLE;
1354 1369
1355 if (mapped) 1370 if (mapped)
1356 XClearArea (dpy, vt, 0, 1371 XClearArea (dpy, vt, 0,
1357 Row2Pixel (row - view_start), (unsigned int)width, 1372 Row2Pixel (row - view_start), (unsigned int)vt_width,
1358 (unsigned int)Height2Pixel (num), False); 1373 (unsigned int)Height2Pixel (num), False);
1359 } 1374 }
1360 else 1375 else
1361 { 1376 {
1362 ren = rstyle & (RS_fgMask | RS_bgMask); 1377 ren = rstyle & (RS_fgMask | RS_bgMask);
1365 { 1380 {
1366 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; 1381 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1367 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1382 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1368 XFillRectangle (dpy, vt, gc, 1383 XFillRectangle (dpy, vt, gc,
1369 0, Row2Pixel (row - view_start), 1384 0, Row2Pixel (row - view_start),
1370 (unsigned int)width, 1385 (unsigned int)vt_width,
1371 (unsigned int)Height2Pixel (num)); 1386 (unsigned int)Height2Pixel (num));
1372 gcvalue.foreground = pix_colors[Color_fg]; 1387 gcvalue.foreground = pix_colors[Color_fg];
1373 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1388 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1374 } 1389 }
1375 } 1390 }
1406 1421
1407 want_refresh = 1; 1422 want_refresh = 1;
1408 ZERO_SCROLLBACK (); 1423 ZERO_SCROLLBACK ();
1409 1424
1410 num_scr_allow = 0; 1425 num_scr_allow = 0;
1411 selection_check (3); 1426
1427 row_col_t pos;
1428 pos.row = pos.col = 0;
1429 if (ROWCOL_IS_AFTER (selection.end, pos))
1430 CLEAR_SELECTION ();
1412 1431
1413 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); 1432 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E'));
1414 for (int row = nrow; row--; ) 1433 for (int row = nrow; row--; )
1415 { 1434 {
1416 line_t &line = ROW(row); 1435 line_t &line = ROW(row);
1857 * Refresh the entire screen 1876 * Refresh the entire screen
1858 */ 1877 */
1859void 1878void
1860rxvt_term::scr_touch (bool refresh) NOTHROW 1879rxvt_term::scr_touch (bool refresh) NOTHROW
1861{ 1880{
1862 scr_expose (0, 0, width, height, refresh); 1881 scr_expose (0, 0, vt_width, vt_height, refresh);
1863} 1882}
1864 1883
1865/* ------------------------------------------------------------------------- */ 1884/* ------------------------------------------------------------------------- */
1866/* 1885/*
1867 * Move the display so that the line represented by scrollbar value Y is at 1886 * Move the display so that the line represented by scrollbar value Y is at
2029 * A: set up vars 2048 * A: set up vars
2030 */ 2049 */
2031 refresh_count = 0; 2050 refresh_count = 0;
2032 2051
2033 unsigned int old_screen_flags = screen.flags; 2052 unsigned int old_screen_flags = screen.flags;
2034 char have_bg = 0; 2053 bool have_bg = 0;
2035#ifdef HAVE_BG_PIXMAP 2054#ifdef HAVE_BG_PIXMAP
2036 have_bg = bg_pixmap != None; 2055 have_bg = bg_pixmap != None;
2037#endif 2056#endif
2038 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 2057 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
2039 2058
2045 HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); 2064 HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END));
2046#if ENABLE_OVERLAY 2065#if ENABLE_OVERLAY
2047 scr_swap_overlay (); 2066 scr_swap_overlay ();
2048#endif 2067#endif
2049 2068
2050 char showcursor = screen.flags & Screen_VisibleCursor; 2069 bool showcursor = screen.flags & Screen_VisibleCursor;
2051 2070
2052 /* 2071 /*
2053 * C: set the cursor character (s) 2072 * C: set the cursor character (s)
2054 */ 2073 */
2055 { 2074 {
2056 unsigned char setoldcursor; 2075 bool setoldcursor;
2057 2076
2058#ifdef CURSOR_BLINK 2077#ifdef CURSOR_BLINK
2059 if (hidden_cursor) 2078 if (hidden_cursor)
2060 showcursor = 0; 2079 showcursor = 0;
2061#endif 2080#endif
2148 { 2167 {
2149 int16_t nits; 2168 int16_t nits;
2150 int i = num_scr; 2169 int i = num_scr;
2151 int j; 2170 int j;
2152 int len, wlen; 2171 int len, wlen;
2153 dLocal (int, num_scr);
2154 2172
2155 j = nrow; 2173 j = nrow;
2156 wlen = len = -1; 2174 wlen = len = -1;
2157 row = i > 0 ? 0 : j - 1; 2175 row = i > 0 ? 0 : j - 1;
2158 2176
2649 */ 2667 */
2650#if 0 2668#if 0
2651void 2669void
2652rxvt_term::scr_dump (int fd) NOTHROW 2670rxvt_term::scr_dump (int fd) NOTHROW
2653{ 2671{
2654 int row, wrote; 2672 // if this method is needed, it can be implemented by factoring the
2655 unsigned int width, towrite; 2673 // relevant code in scr_printscreen
2656 const char r1[] = "\n";
2657
2658 for (row = saveLines + top_row;
2659 row < saveLines + nrow - 1; row++)
2660 {
2661 width = row_buf[row].l >= 0 ? row_buf[row].l
2662 : ncol;
2663 for (towrite = width; towrite; towrite -= wrote)
2664 {
2665 wrote = write (fd, & (row_buf[row].t[width - towrite]),
2666 towrite);
2667 if (wrote < 0)
2668 return; /* XXX: death, no report */
2669 }
2670 if (row_buf[row].l >= 0)
2671 if (write (fd, r1, 1) <= 0)
2672 return; /* XXX: death, no report */
2673 }
2674} 2674}
2675#endif 2675#endif
2676 2676
2677/* ------------------------------------------------------------------------- * 2677/* ------------------------------------------------------------------------- *
2678 * CHARACTER SELECTION * 2678 * CHARACTER SELECTION *
2680void 2680void
2681rxvt_term::selection_check (int check_more) NOTHROW 2681rxvt_term::selection_check (int check_more) NOTHROW
2682{ 2682{
2683 if (!selection.op) 2683 if (!selection.op)
2684 return; 2684 return;
2685
2686 row_col_t pos;
2687 pos.row = pos.col = 0;
2688 2685
2689 if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) 2686 if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow)
2690 || !IN_RANGE_EXC (selection.mark.row, top_row, nrow) 2687 || !IN_RANGE_EXC (selection.mark.row, top_row, nrow)
2691 || !IN_RANGE_EXC (selection.end.row, top_row, nrow) 2688 || !IN_RANGE_EXC (selection.end.row, top_row, nrow)
2692 || (check_more == 1 2689 || (check_more == 1
2693 && current_screen == selection.screen 2690 && current_screen == selection.screen
2694 && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) 2691 && !ROWCOL_IS_BEFORE (screen.cur, selection.beg)
2695 && ROWCOL_IS_BEFORE (screen.cur, selection.end)) 2692 && ROWCOL_IS_BEFORE (screen.cur, selection.end)))
2696 || (check_more == 2
2697 && ROWCOL_IS_BEFORE (selection.beg, pos)
2698 && ROWCOL_IS_AFTER (selection.end, pos))
2699 || (check_more == 3
2700 && ROWCOL_IS_AFTER (selection.end, pos)))
2701 CLEAR_ALL_SELECTION (); 2693 CLEAR_ALL_SELECTION ();
2702} 2694}
2703 2695
2704/* ------------------------------------------------------------------------- */ 2696/* ------------------------------------------------------------------------- */
2705/* 2697/*
2712 for (unsigned int i = 0; i < len; i++) 2704 for (unsigned int i = 0; i < len; i++)
2713 if (data[i] == C0_LF) 2705 if (data[i] == C0_LF)
2714 data[i] = C0_CR; 2706 data[i] = C0_CR;
2715 2707
2716 if (priv_modes & PrivMode_BracketPaste) 2708 if (priv_modes & PrivMode_BracketPaste)
2717 tt_printf ("\e[200~"); 2709 tt_printf ("\x1b[200~");
2718 2710
2719 tt_write (data, len); 2711 tt_write (data, len);
2720 2712
2721 if (priv_modes & PrivMode_BracketPaste) 2713 if (priv_modes & PrivMode_BracketPaste)
2722 tt_printf ("\e[201~"); 2714 tt_printf ("\x1b[201~");
2723} 2715}
2724 2716
2725void 2717void
2726rxvt_term::paste (char *data, unsigned int len) NOTHROW 2718rxvt_term::paste (char *data, unsigned int len) NOTHROW
2727{ 2719{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines