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.394 by sf-exg, Thu Sep 1 08:11:27 2011 UTC vs.
Revision 1.413 by root, Wed Jan 18 12:39:14 2012 UTC

455 scr_clear (true); 455 scr_clear (true);
456 scr_refresh (); 456 scr_refresh ();
457} 457}
458 458
459void 459void
460rxvt_term::scr_soft_reset () 460rxvt_term::scr_soft_reset () NOTHROW
461{ 461{
462 /* only affects modes, nothing drastic such as clearing the screen */ 462 /* only affects modes, nothing drastic such as clearing the screen */
463#if ENABLE_OVERLAY 463#if ENABLE_OVERLAY
464 scr_overlay_off (); 464 scr_overlay_off ();
465#endif 465#endif
520 assert (s->cur.row >= 0); 520 assert (s->cur.row >= 0);
521 assert (s->cur.col >= 0); 521 assert (s->cur.col >= 0);
522} 522}
523 523
524void 524void
525rxvt_term::scr_swap_screen () 525rxvt_term::scr_swap_screen () NOTHROW
526{ 526{
527 if (!option (Opt_secondaryScreen)) 527 if (!option (Opt_secondaryScreen))
528 return; 528 return;
529 529
530 for (int i = prev_nrow; i--; ) 530 for (int i = prev_nrow; i--; )
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))
682 else 687 else
683 scr_blank_screen_mem (l, rstyle); 688 scr_blank_screen_mem (l, rstyle);
684 } 689 }
685 690
686 // move and/or clear selection, if any 691 // move and/or clear selection, if any
687 if (selection.op && current_screen == selection.screen) 692 if (selection.op && current_screen == selection.screen
693 && selection.beg.row <= row2)
688 { 694 {
689 selection.beg.row -= count; 695 selection.beg.row -= count;
690 selection.end.row -= count; 696 selection.end.row -= count;
691 selection.mark.row -= count; 697 selection.mark.row -= count;
692 698
693 if (selection.beg.row < top_row 699 selection_check (0);
694 || selection.end.row < top_row
695 || selection.mark.row < top_row)
696 {
697 CLEAR_ALL_SELECTION ();
698 selection.op = SELECTION_CLEAR;
699 }
700 } 700 }
701 701
702 // finally move the view window, if desired 702 // finally move the view window, if desired
703 if (option (Opt_scrollWithBuffer) 703 if (option (Opt_scrollWithBuffer)
704 && view_start != 0 704 && view_start != 0
780rxvt_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
781{ 781{
782 if (len <= 0) /* sanity */ 782 if (len <= 0) /* sanity */
783 return; 783 return;
784 784
785 unsigned char checksel; 785 bool checksel;
786 unicode_t c; 786 unicode_t c;
787 int ncol = this->ncol; 787 int ncol = this->ncol;
788 const wchar_t *strend = str + len; 788 const wchar_t *strend = str + len;
789 789
790 want_refresh = 1; 790 want_refresh = 1;
1312 scr_blank_line (line, col, num, rstyle); 1312 scr_blank_line (line, col, num, rstyle);
1313} 1313}
1314 1314
1315/* ------------------------------------------------------------------------- */ 1315/* ------------------------------------------------------------------------- */
1316/* 1316/*
1317 * Erase part of whole of the screen 1317 * Erase part or whole of the screen
1318 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J 1318 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J
1319 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J 1319 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J
1320 * XTERM_SEQ: Clear whole screen : ESC [ 2 J 1320 * XTERM_SEQ: Clear whole screen : ESC [ 2 J
1321 */ 1321 */
1322void 1322void
1331 ZERO_SCROLLBACK (); 1331 ZERO_SCROLLBACK ();
1332 1332
1333 switch (mode) 1333 switch (mode)
1334 { 1334 {
1335 case 0: /* erase to end of screen */ 1335 case 0: /* erase to end of screen */
1336 selection_check (1);
1337 scr_erase_line (0); 1336 scr_erase_line (0);
1338 row = screen.cur.row + 1; /* possible OOB */ 1337 row = screen.cur.row + 1; /* possible OOB */
1339 num = nrow - row; 1338 num = nrow - row;
1340 break; 1339 break;
1341 case 1: /* erase to beginning of screen */ 1340 case 1: /* erase to beginning of screen */
1342 selection_check (3);
1343 scr_erase_line (1); 1341 scr_erase_line (1);
1344 row = 0; 1342 row = 0;
1345 num = screen.cur.row; 1343 num = screen.cur.row;
1346 break; 1344 break;
1347 case 2: /* erase whole screen */ 1345 case 2: /* erase whole screen */
1348 selection_check (3);
1349 row = 0; 1346 row = 0;
1350 num = nrow; 1347 num = nrow;
1351 break; 1348 break;
1352 default: 1349 default:
1353 return; 1350 return;
1370 { 1367 {
1371 ren = DEFAULT_RSTYLE; 1368 ren = DEFAULT_RSTYLE;
1372 1369
1373 if (mapped) 1370 if (mapped)
1374 XClearArea (dpy, vt, 0, 1371 XClearArea (dpy, vt, 0,
1375 Row2Pixel (row - view_start), (unsigned int)width, 1372 Row2Pixel (row - view_start), (unsigned int)vt_width,
1376 (unsigned int)Height2Pixel (num), False); 1373 (unsigned int)Height2Pixel (num), False);
1377 } 1374 }
1378 else 1375 else
1379 { 1376 {
1380 ren = rstyle & (RS_fgMask | RS_bgMask); 1377 ren = rstyle & (RS_fgMask | RS_bgMask);
1383 { 1380 {
1384 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; 1381 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1385 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1382 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1386 XFillRectangle (dpy, vt, gc, 1383 XFillRectangle (dpy, vt, gc,
1387 0, Row2Pixel (row - view_start), 1384 0, Row2Pixel (row - view_start),
1388 (unsigned int)width, 1385 (unsigned int)vt_width,
1389 (unsigned int)Height2Pixel (num)); 1386 (unsigned int)Height2Pixel (num));
1390 gcvalue.foreground = pix_colors[Color_fg]; 1387 gcvalue.foreground = pix_colors[Color_fg];
1391 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1388 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1392 } 1389 }
1393 } 1390 }
1424 1421
1425 want_refresh = 1; 1422 want_refresh = 1;
1426 ZERO_SCROLLBACK (); 1423 ZERO_SCROLLBACK ();
1427 1424
1428 num_scr_allow = 0; 1425 num_scr_allow = 0;
1429 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 ();
1430 1431
1431 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); 1432 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E'));
1432 for (int row = nrow; row--; ) 1433 for (int row = nrow; row--; )
1433 { 1434 {
1434 line_t &line = ROW(row); 1435 line_t &line = ROW(row);
1875 * Refresh the entire screen 1876 * Refresh the entire screen
1876 */ 1877 */
1877void 1878void
1878rxvt_term::scr_touch (bool refresh) NOTHROW 1879rxvt_term::scr_touch (bool refresh) NOTHROW
1879{ 1880{
1880 scr_expose (0, 0, width, height, refresh); 1881 scr_expose (0, 0, vt_width, vt_height, refresh);
1881} 1882}
1882 1883
1883/* ------------------------------------------------------------------------- */ 1884/* ------------------------------------------------------------------------- */
1884/* 1885/*
1885 * 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
2047 * A: set up vars 2048 * A: set up vars
2048 */ 2049 */
2049 refresh_count = 0; 2050 refresh_count = 0;
2050 2051
2051 unsigned int old_screen_flags = screen.flags; 2052 unsigned int old_screen_flags = screen.flags;
2052 char have_bg = 0; 2053 bool have_bg = 0;
2053#ifdef HAVE_BG_PIXMAP 2054#ifdef HAVE_BG_PIXMAP
2054 have_bg = bg_pixmap != None; 2055 have_bg = bg_pixmap != None;
2055#endif 2056#endif
2056 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 2057 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
2057 2058
2063 HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END)); 2064 HOOK_INVOKE ((this, HOOK_REFRESH_BEGIN, DT_END));
2064#if ENABLE_OVERLAY 2065#if ENABLE_OVERLAY
2065 scr_swap_overlay (); 2066 scr_swap_overlay ();
2066#endif 2067#endif
2067 2068
2068 char showcursor = screen.flags & Screen_VisibleCursor; 2069 bool showcursor = screen.flags & Screen_VisibleCursor;
2069 2070
2070 /* 2071 /*
2071 * C: set the cursor character (s) 2072 * C: set the cursor character (s)
2072 */ 2073 */
2073 { 2074 {
2074 unsigned char setoldcursor; 2075 bool setoldcursor;
2075 2076
2076#ifdef CURSOR_BLINK 2077#ifdef CURSOR_BLINK
2077 if (hidden_cursor) 2078 if (hidden_cursor)
2078 showcursor = 0; 2079 showcursor = 0;
2079#endif 2080#endif
2166 { 2167 {
2167 int16_t nits; 2168 int16_t nits;
2168 int i = num_scr; 2169 int i = num_scr;
2169 int j; 2170 int j;
2170 int len, wlen; 2171 int len, wlen;
2171 dLocal (int, num_scr);
2172 2172
2173 j = nrow; 2173 j = nrow;
2174 wlen = len = -1; 2174 wlen = len = -1;
2175 row = i > 0 ? 0 : j - 1; 2175 row = i > 0 ? 0 : j - 1;
2176 2176
2667 */ 2667 */
2668#if 0 2668#if 0
2669void 2669void
2670rxvt_term::scr_dump (int fd) NOTHROW 2670rxvt_term::scr_dump (int fd) NOTHROW
2671{ 2671{
2672 int row, wrote; 2672 // if this method is needed, it can be implemented by factoring the
2673 unsigned int width, towrite; 2673 // relevant code in scr_printscreen
2674 const char r1[] = "\n";
2675
2676 for (row = saveLines + top_row;
2677 row < saveLines + nrow - 1; row++)
2678 {
2679 width = row_buf[row].l >= 0 ? row_buf[row].l
2680 : ncol;
2681 for (towrite = width; towrite; towrite -= wrote)
2682 {
2683 wrote = write (fd, & (row_buf[row].t[width - towrite]),
2684 towrite);
2685 if (wrote < 0)
2686 return; /* XXX: death, no report */
2687 }
2688 if (row_buf[row].l >= 0)
2689 if (write (fd, r1, 1) <= 0)
2690 return; /* XXX: death, no report */
2691 }
2692} 2674}
2693#endif 2675#endif
2694 2676
2695/* ------------------------------------------------------------------------- * 2677/* ------------------------------------------------------------------------- *
2696 * CHARACTER SELECTION * 2678 * CHARACTER SELECTION *
2697 * ------------------------------------------------------------------------- */ 2679 * ------------------------------------------------------------------------- */
2698void 2680void
2699rxvt_term::selection_check (int check_more) NOTHROW 2681rxvt_term::selection_check (int check_more) NOTHROW
2700{ 2682{
2701 row_col_t pos;
2702
2703 if (!selection.op) 2683 if (!selection.op)
2704 return; 2684 return;
2705 2685
2706 pos.row = pos.col = 0;
2707 if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) 2686 if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow)
2708 || !IN_RANGE_EXC (selection.mark.row, top_row, nrow) 2687 || !IN_RANGE_EXC (selection.mark.row, top_row, nrow)
2709 || !IN_RANGE_EXC (selection.end.row, top_row, nrow) 2688 || !IN_RANGE_EXC (selection.end.row, top_row, nrow)
2710 || (check_more == 1 2689 || (check_more == 1
2711 && current_screen == selection.screen 2690 && current_screen == selection.screen
2712 && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) 2691 && !ROWCOL_IS_BEFORE (screen.cur, selection.beg)
2713 && ROWCOL_IS_BEFORE (screen.cur, selection.end)) 2692 && ROWCOL_IS_BEFORE (screen.cur, selection.end)))
2714 || (check_more == 2
2715 && ROWCOL_IS_BEFORE (selection.beg, pos)
2716 && ROWCOL_IS_AFTER (selection.end, pos))
2717 || (check_more == 3
2718 && ROWCOL_IS_AFTER (selection.end, pos))
2719 || (check_more == 4 /* screen width change */
2720 && (selection.beg.row != selection.end.row
2721 || selection.end.col > ncol)))
2722 CLEAR_SELECTION (); 2693 CLEAR_ALL_SELECTION ();
2723} 2694}
2724 2695
2725/* ------------------------------------------------------------------------- */ 2696/* ------------------------------------------------------------------------- */
2726/* 2697/*
2727 * Paste a selection direct to the command fd 2698 * Paste a selection direct to the command fd
2733 for (unsigned int i = 0; i < len; i++) 2704 for (unsigned int i = 0; i < len; i++)
2734 if (data[i] == C0_LF) 2705 if (data[i] == C0_LF)
2735 data[i] = C0_CR; 2706 data[i] = C0_CR;
2736 2707
2737 if (priv_modes & PrivMode_BracketPaste) 2708 if (priv_modes & PrivMode_BracketPaste)
2738 tt_printf ("\e[200~"); 2709 tt_printf ("\x1b[200~");
2739 2710
2740 tt_write (data, len); 2711 tt_write (data, len);
2741 2712
2742 if (priv_modes & PrivMode_BracketPaste) 2713 if (priv_modes & PrivMode_BracketPaste)
2743 tt_printf ("\e[201~"); 2714 tt_printf ("\x1b[201~");
2744} 2715}
2745 2716
2746void 2717void
2747rxvt_term::paste (char *data, unsigned int len) NOTHROW 2718rxvt_term::paste (char *data, unsigned int len) NOTHROW
2748{ 2719{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines