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.404 by sf-exg, Tue Nov 15 20:07:10 2011 UTC vs.
Revision 1.411 by sf-exg, Mon Jan 9 21:12:08 2012 UTC

49 if (option (Opt_scrollTtyOutput)) \ 49 if (option (Opt_scrollTtyOutput)) \
50 view_start = 0 50 view_start = 0
51#define CLEAR_SELECTION() \ 51#define CLEAR_SELECTION() \
52 selection.beg.row = selection.beg.col \ 52 selection.beg.row = selection.beg.col \
53 = selection.end.row = selection.end.col = 0 53 = selection.end.row = selection.end.col = 0
54#define CLEAR_SELECTION_MARK() \ 54#define CLEAR_ALL_SELECTION() \
55 selection.beg.row = selection.beg.col \
56 = selection.mark.row = selection.mark.col \
55 selection.mark.row = selection.mark.col = 0 57 = selection.end.row = selection.end.col = 0
56 58
57#define ROW_AND_COL_IS_AFTER(A, B, C, D) \ 59#define ROW_AND_COL_IS_AFTER(A, B, C, D) \
58 (((A) > (C)) || (((A) == (C)) && ((B) > (D)))) 60 (((A) > (C)) || (((A) == (C)) && ((B) > (D))))
59#define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ 61#define ROW_AND_COL_IS_BEFORE(A, B, C, D) \
60 (((A) < (C)) || (((A) == (C)) && ((B) < (D)))) 62 (((A) < (C)) || (((A) == (C)) && ((B) < (D))))
403 tabs = (char *)rxvt_malloc (ncol); 405 tabs = (char *)rxvt_malloc (ncol);
404 406
405 for (int col = ncol; col--; ) 407 for (int col = ncol; col--; )
406 tabs [col] = col % TABSIZE == 0; 408 tabs [col] = col % TABSIZE == 0;
407 409
408 CLEAR_SELECTION (); 410 CLEAR_ALL_SELECTION ();
409 CLEAR_SELECTION_MARK ();
410 411
411 prev_nrow = nrow; 412 prev_nrow = nrow;
412 prev_ncol = ncol; 413 prev_ncol = ncol;
413 414
414 tt_winch (); 415 tt_winch ();
548 return; 549 return;
549 550
550 want_refresh = 1; 551 want_refresh = 1;
551 view_start = 0; 552 view_start = 0;
552 553
553 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 ();
554 560
555 current_screen = scrn; 561 current_screen = scrn;
556 562
557#if NSCREENS 563#if NSCREENS
558 if (option (Opt_secondaryScreen)) 564 if (option (Opt_secondaryScreen))
711 || (selection.beg.row - count < row1 && selection.beg.row >= row1) 717 || (selection.beg.row - count < row1 && selection.beg.row >= row1)
712 || (selection.beg.row - count > row2 && selection.beg.row <= row2) 718 || (selection.beg.row - count > row2 && selection.beg.row <= row2)
713 || (selection.end.row - count < row1 && selection.end.row >= row1) 719 || (selection.end.row - count < row1 && selection.end.row >= row1)
714 || (selection.end.row - count > row2 && selection.end.row <= row2)) 720 || (selection.end.row - count > row2 && selection.end.row <= row2))
715 { 721 {
716 CLEAR_SELECTION (); 722 CLEAR_ALL_SELECTION ();
717 if (!IN_RANGE_EXC (selection.mark.row, top_row, nrow)) 723 selection.op = SELECTION_CLEAR;
718 CLEAR_SELECTION_MARK ();
719 } 724 }
720 else if (selection.end.row >= row1 && selection.end.row <= row2) 725 else if (selection.end.row >= row1 && selection.end.row <= row2)
721 { 726 {
722 /* move selected region too */ 727 /* move selected region too */
723 selection.beg.row -= count; 728 selection.beg.row -= count;
1307 scr_blank_line (line, col, num, rstyle); 1312 scr_blank_line (line, col, num, rstyle);
1308} 1313}
1309 1314
1310/* ------------------------------------------------------------------------- */ 1315/* ------------------------------------------------------------------------- */
1311/* 1316/*
1312 * Erase part of whole of the screen 1317 * Erase part or whole of the screen
1313 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J 1318 * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J
1314 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J 1319 * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J
1315 * XTERM_SEQ: Clear whole screen : ESC [ 2 J 1320 * XTERM_SEQ: Clear whole screen : ESC [ 2 J
1316 */ 1321 */
1317void 1322void
1326 ZERO_SCROLLBACK (); 1331 ZERO_SCROLLBACK ();
1327 1332
1328 switch (mode) 1333 switch (mode)
1329 { 1334 {
1330 case 0: /* erase to end of screen */ 1335 case 0: /* erase to end of screen */
1331 selection_check (1);
1332 scr_erase_line (0); 1336 scr_erase_line (0);
1333 row = screen.cur.row + 1; /* possible OOB */ 1337 row = screen.cur.row + 1; /* possible OOB */
1334 num = nrow - row; 1338 num = nrow - row;
1335 break; 1339 break;
1336 case 1: /* erase to beginning of screen */ 1340 case 1: /* erase to beginning of screen */
1337 selection_check (3);
1338 scr_erase_line (1); 1341 scr_erase_line (1);
1339 row = 0; 1342 row = 0;
1340 num = screen.cur.row; 1343 num = screen.cur.row;
1341 break; 1344 break;
1342 case 2: /* erase whole screen */ 1345 case 2: /* erase whole screen */
1343 selection_check (3);
1344 row = 0; 1346 row = 0;
1345 num = nrow; 1347 num = nrow;
1346 break; 1348 break;
1347 default: 1349 default:
1348 return; 1350 return;
1365 { 1367 {
1366 ren = DEFAULT_RSTYLE; 1368 ren = DEFAULT_RSTYLE;
1367 1369
1368 if (mapped) 1370 if (mapped)
1369 XClearArea (dpy, vt, 0, 1371 XClearArea (dpy, vt, 0,
1370 Row2Pixel (row - view_start), (unsigned int)width, 1372 Row2Pixel (row - view_start), (unsigned int)vt_width,
1371 (unsigned int)Height2Pixel (num), False); 1373 (unsigned int)Height2Pixel (num), False);
1372 } 1374 }
1373 else 1375 else
1374 { 1376 {
1375 ren = rstyle & (RS_fgMask | RS_bgMask); 1377 ren = rstyle & (RS_fgMask | RS_bgMask);
1378 { 1380 {
1379 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; 1381 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1380 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1382 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1381 XFillRectangle (dpy, vt, gc, 1383 XFillRectangle (dpy, vt, gc,
1382 0, Row2Pixel (row - view_start), 1384 0, Row2Pixel (row - view_start),
1383 (unsigned int)width, 1385 (unsigned int)vt_width,
1384 (unsigned int)Height2Pixel (num)); 1386 (unsigned int)Height2Pixel (num));
1385 gcvalue.foreground = pix_colors[Color_fg]; 1387 gcvalue.foreground = pix_colors[Color_fg];
1386 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1388 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1387 } 1389 }
1388 } 1390 }
1419 1421
1420 want_refresh = 1; 1422 want_refresh = 1;
1421 ZERO_SCROLLBACK (); 1423 ZERO_SCROLLBACK ();
1422 1424
1423 num_scr_allow = 0; 1425 num_scr_allow = 0;
1424 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 ();
1425 1431
1426 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E')); 1432 fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E'));
1427 for (int row = nrow; row--; ) 1433 for (int row = nrow; row--; )
1428 { 1434 {
1429 line_t &line = ROW(row); 1435 line_t &line = ROW(row);
1870 * Refresh the entire screen 1876 * Refresh the entire screen
1871 */ 1877 */
1872void 1878void
1873rxvt_term::scr_touch (bool refresh) NOTHROW 1879rxvt_term::scr_touch (bool refresh) NOTHROW
1874{ 1880{
1875 scr_expose (0, 0, width, height, refresh); 1881 scr_expose (0, 0, vt_width, vt_height, refresh);
1876} 1882}
1877 1883
1878/* ------------------------------------------------------------------------- */ 1884/* ------------------------------------------------------------------------- */
1879/* 1885/*
1880 * 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
2161 { 2167 {
2162 int16_t nits; 2168 int16_t nits;
2163 int i = num_scr; 2169 int i = num_scr;
2164 int j; 2170 int j;
2165 int len, wlen; 2171 int len, wlen;
2166 dLocal (int, num_scr);
2167 2172
2168 j = nrow; 2173 j = nrow;
2169 wlen = len = -1; 2174 wlen = len = -1;
2170 row = i > 0 ? 0 : j - 1; 2175 row = i > 0 ? 0 : j - 1;
2171 2176
2662 */ 2667 */
2663#if 0 2668#if 0
2664void 2669void
2665rxvt_term::scr_dump (int fd) NOTHROW 2670rxvt_term::scr_dump (int fd) NOTHROW
2666{ 2671{
2667 int row, wrote; 2672 // if this method is needed, it can be implemented by factoring the
2668 unsigned int width, towrite; 2673 // relevant code in scr_printscreen
2669 const char r1[] = "\n";
2670
2671 for (row = saveLines + top_row;
2672 row < saveLines + nrow - 1; row++)
2673 {
2674 width = row_buf[row].l >= 0 ? row_buf[row].l
2675 : ncol;
2676 for (towrite = width; towrite; towrite -= wrote)
2677 {
2678 wrote = write (fd, & (row_buf[row].t[width - towrite]),
2679 towrite);
2680 if (wrote < 0)
2681 return; /* XXX: death, no report */
2682 }
2683 if (row_buf[row].l >= 0)
2684 if (write (fd, r1, 1) <= 0)
2685 return; /* XXX: death, no report */
2686 }
2687} 2674}
2688#endif 2675#endif
2689 2676
2690/* ------------------------------------------------------------------------- * 2677/* ------------------------------------------------------------------------- *
2691 * CHARACTER SELECTION * 2678 * CHARACTER SELECTION *
2694rxvt_term::selection_check (int check_more) NOTHROW 2681rxvt_term::selection_check (int check_more) NOTHROW
2695{ 2682{
2696 if (!selection.op) 2683 if (!selection.op)
2697 return; 2684 return;
2698 2685
2699 row_col_t pos;
2700 pos.row = pos.col = 0;
2701
2702 if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) 2686 if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow)
2687 || !IN_RANGE_EXC (selection.mark.row, top_row, nrow)
2703 || !IN_RANGE_EXC (selection.end.row, top_row, nrow) 2688 || !IN_RANGE_EXC (selection.end.row, top_row, nrow)
2704 || (check_more == 1 2689 || (check_more == 1
2705 && current_screen == selection.screen 2690 && current_screen == selection.screen
2706 && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) 2691 && !ROWCOL_IS_BEFORE (screen.cur, selection.beg)
2707 && ROWCOL_IS_BEFORE (screen.cur, selection.end)) 2692 && ROWCOL_IS_BEFORE (screen.cur, selection.end)))
2708 || (check_more == 2
2709 && ROWCOL_IS_BEFORE (selection.beg, pos)
2710 && ROWCOL_IS_AFTER (selection.end, pos))
2711 || (check_more == 3
2712 && ROWCOL_IS_AFTER (selection.end, pos)))
2713 CLEAR_SELECTION (); 2693 CLEAR_ALL_SELECTION ();
2714
2715 if (!IN_RANGE_EXC (selection.mark.row, top_row, nrow))
2716 CLEAR_SELECTION_MARK ();
2717} 2694}
2718 2695
2719/* ------------------------------------------------------------------------- */ 2696/* ------------------------------------------------------------------------- */
2720/* 2697/*
2721 * Paste a selection direct to the command fd 2698 * Paste a selection direct to the command fd

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines