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.296 by root, Wed Jan 9 01:05:24 2008 UTC vs.
Revision 1.307 by root, Fri Jun 27 00:44:32 2008 UTC

83 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) 83 ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col)
84#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ 84#define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \
85 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) 85 ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col)
86 86
87/* 87/*
88 * CLEAR_ROWS : clear <num> rows starting from row <row>
89 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> 88 * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y>
90 * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour
91 */ 89 */
92#define drawBuffer vt
93
94#define CLEAR_ROWS(row, num) \
95 if (mapped) \
96 XClearArea (dpy, drawBuffer, 0, \
97 Row2Pixel (row), (unsigned int)width, \
98 (unsigned int)Height2Pixel (num), False)
99
100#define CLEAR_CHARS(x, y, num) \ 90#define CLEAR_CHARS(x, y, num) \
101 if (mapped) \ 91 if (mapped) \
102 XClearArea (dpy, drawBuffer, x, y, \ 92 XClearArea (dpy, vt, x, y, \
103 (unsigned int)Width2Pixel (num), \ 93 (unsigned int)Width2Pixel (num), \
104 (unsigned int)Height2Pixel (1), False) 94 (unsigned int)Height2Pixel (1), False)
105
106#define ERASE_ROWS(row, num) \
107 XFillRectangle (dpy, drawBuffer, gc, \
108 0, Row2Pixel (row), \
109 (unsigned int)width, \
110 (unsigned int)Height2Pixel (num))
111 95
112/* ------------------------------------------------------------------------- * 96/* ------------------------------------------------------------------------- *
113 * SCREEN `COMMON' ROUTINES * 97 * SCREEN `COMMON' ROUTINES *
114 * ------------------------------------------------------------------------- */ 98 * ------------------------------------------------------------------------- */
115 99
1017 { 1001 {
1018 if (screen.cur.row > 0) 1002 if (screen.cur.row > 0)
1019 { 1003 {
1020#ifdef TERMCAP_HAS_BW 1004#ifdef TERMCAP_HAS_BW
1021 screen.cur.col = ncol - 1; 1005 screen.cur.col = ncol - 1;
1022 screen.cur.row--; 1006 --screen.cur.row;
1007
1023 want_refresh = 1; 1008 want_refresh = 1;
1024#endif 1009#endif
1025 } 1010 }
1026 } 1011 }
1027 else 1012 else
1226/* 1211/*
1227 * Erase part or whole of a line 1212 * Erase part or whole of a line
1228 * XTERM_SEQ: Clear line to right: ESC [ 0 K 1213 * XTERM_SEQ: Clear line to right: ESC [ 0 K
1229 * XTERM_SEQ: Clear line to left : ESC [ 1 K 1214 * XTERM_SEQ: Clear line to left : ESC [ 1 K
1230 * XTERM_SEQ: Clear whole line : ESC [ 2 K 1215 * XTERM_SEQ: Clear whole line : ESC [ 2 K
1216 * extension: clear to right unless wrapped: ESC [ 3 K
1231 */ 1217 */
1232void 1218void
1233rxvt_term::scr_erase_line (int mode) NOTHROW 1219rxvt_term::scr_erase_line (int mode) NOTHROW
1234{ 1220{
1235 unsigned int col, num; 1221 unsigned int col, num;
1244 line.touch (); 1230 line.touch ();
1245 line.is_longer (0); 1231 line.is_longer (0);
1246 1232
1247 switch (mode) 1233 switch (mode)
1248 { 1234 {
1235 case 3:
1236 if (screen.flags & Screen_WrapNext)
1237 return;
1238
1239 /* fall through */
1240
1249 case 0: /* erase to end of line */ 1241 case 0: /* erase to end of line */
1250 col = screen.cur.col; 1242 col = screen.cur.col;
1251 num = ncol - col; 1243 num = ncol - col;
1252 min_it (line.l, col); 1244 min_it (line.l, col);
1245
1253 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1246 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1254 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1247 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1255 CLEAR_SELECTION (); 1248 CLEAR_SELECTION ();
1256 break; 1249 break;
1250
1257 case 1: /* erase to beginning of line */ 1251 case 1: /* erase to beginning of line */
1258 col = 0; 1252 col = 0;
1259 num = screen.cur.col + 1; 1253 num = screen.cur.col + 1;
1254
1260 if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur) 1255 if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur)
1261 || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur)) 1256 || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur))
1262 CLEAR_SELECTION (); 1257 CLEAR_SELECTION ();
1263 break; 1258 break;
1259
1264 case 2: /* erase whole line */ 1260 case 2: /* erase whole line */
1265 col = 0; 1261 col = 0;
1266 num = ncol; 1262 num = ncol;
1267 line.l = 0; 1263 line.l = 0;
1268 if (selection.beg.row <= screen.cur.row 1264 if (selection.beg.row <= screen.cur.row
1326 if (row >= nrow) /* Out Of Bounds */ 1322 if (row >= nrow) /* Out Of Bounds */
1327 return; 1323 return;
1328 1324
1329 min_it (num, nrow - row); 1325 min_it (num, nrow - row);
1330 1326
1327 /*TODO: the xlceararea/xfillrectangle below don't take scroll offste into account, ask mikachu for details */
1331 if (rstyle & (RS_RVid | RS_Uline)) 1328 if (rstyle & (RS_RVid | RS_Uline))
1332 ren = (rend_t) ~RS_None; 1329 ren = (rend_t) ~RS_None;
1333 else if (GET_BASEBG (rstyle) == Color_bg) 1330 else if (GET_BASEBG (rstyle) == Color_bg)
1334 { 1331 {
1335 ren = DEFAULT_RSTYLE; 1332 ren = DEFAULT_RSTYLE;
1336 CLEAR_ROWS (row, num); 1333
1334 if (mapped)
1335 XClearArea (dpy, vt, 0,
1336 Row2Pixel (row), (unsigned int)width,
1337 (unsigned int)Height2Pixel (num), False);
1337 } 1338 }
1338 else 1339 else
1339 { 1340 {
1340 ren = rstyle & (RS_fgMask | RS_bgMask); 1341 ren = rstyle & (RS_fgMask | RS_bgMask);
1342
1341 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; 1343 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1342 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1344 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1343 ERASE_ROWS (row, num); 1345 XFillRectangle (dpy, vt, gc,
1346 0, Row2Pixel (row),
1347 (unsigned int)width,
1348 (unsigned int)Height2Pixel (num));
1344 gcvalue.foreground = pix_colors[Color_fg]; 1349 gcvalue.foreground = pix_colors[Color_fg];
1345 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1350 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1346 } 1351 }
1347 1352
1348 for (; num--; row++) 1353 for (; num--; row++)
1993 return; 1998 return;
1994 1999
1995 /* 2000 /*
1996 * A: set up vars 2001 * A: set up vars
1997 */ 2002 */
2003 refresh_count = 0;
2004
1998 have_bg = 0; 2005 have_bg = 0;
1999 refresh_count = 0;
2000
2001#ifdef HAVE_BG_PIXMAP 2006#ifdef HAVE_BG_PIXMAP
2002 have_bg |= bgPixmap.pixmap != None; 2007 have_bg = bgPixmap.pixmap != None;
2003#endif 2008#endif
2004 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 2009 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
2005 2010
2006 /* 2011 /*
2007 * B: reverse any characters which are selected 2012 * B: reverse any characters which are selected
2374 XSetForeground (dpy, gc, pix_colors[Color_underline]); 2379 XSetForeground (dpy, gc, pix_colors[Color_underline]);
2375 else 2380 else
2376#endif 2381#endif
2377 XSetForeground (dpy, gc, pix_colors[fore]); 2382 XSetForeground (dpy, gc, pix_colors[fore]);
2378 2383
2379 XDrawLine (dpy, drawBuffer, gc, 2384 XDrawLine (dpy, vt, gc,
2380 xpixel, ypixel + font->ascent + 1, 2385 xpixel, ypixel + font->ascent + 1,
2381 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); 2386 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
2382 } 2387 }
2383 } /* for (col....) */ 2388 } /* for (col....) */
2384 } /* for (row....) */ 2389 } /* for (row....) */
2422 XSetForeground (dpy, gc, pix_colors[Color_cursor]); 2427 XSetForeground (dpy, gc, pix_colors[Color_cursor]);
2423 else 2428 else
2424#endif 2429#endif
2425 XSetForeground (dpy, gc, pix_colors[ccol1]); 2430 XSetForeground (dpy, gc, pix_colors[ccol1]);
2426 2431
2427 XDrawRectangle (dpy, drawBuffer, gc, 2432 XDrawRectangle (dpy, vt, gc,
2428 Col2Pixel (col), 2433 Col2Pixel (col),
2429 Row2Pixel (oldcursor.row), 2434 Row2Pixel (oldcursor.row),
2430 (unsigned int) (Width2Pixel (cursorwidth) - 1), 2435 (unsigned int) (Width2Pixel (cursorwidth) - 1),
2431 (unsigned int) (Height2Pixel (1) - lineSpace - 1)); 2436 (unsigned int) (Height2Pixel (1) - lineSpace - 1));
2432 } 2437 }
2475 2480
2476 XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); 2481 XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]);
2477 XClearWindow (dpy, parent[0]); 2482 XClearWindow (dpy, parent[0]);
2478 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); 2483 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
2479 2484
2480# if HAVE_SCROLLBARS
2481 if (scrollBar.win) 2485 if (scrollBar.win)
2482 { 2486 {
2483 XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); 2487 XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]);
2484 scrollBar.setIdle (); 2488 scrollBar.state = STATE_IDLE;
2485 scrollbar_show (0); 2489 scrollBar.show (0);
2486 } 2490 }
2491
2487# endif 2492#endif
2488 2493
2494 /* bgPixmap.apply () does not do the following : */
2489 scr_clear (); 2495 scr_clear ();
2490 scr_touch (true); 2496 scr_touch (true);
2491 want_refresh = 1; 2497 want_refresh = 1;
2492
2493#endif
2494} 2498}
2495 2499
2496/* ------------------------------------------------------------------------- */ 2500/* ------------------------------------------------------------------------- */
2497void 2501void
2498rxvt_term::scr_clear (bool really) NOTHROW 2502rxvt_term::scr_clear (bool really) NOTHROW
2587{ 2591{
2588 int row, wrote; 2592 int row, wrote;
2589 unsigned int width, towrite; 2593 unsigned int width, towrite;
2590 char r1[] = "\n"; 2594 char r1[] = "\n";
2591 2595
2592 for (row = saveLines - nsaved; 2596 for (row = saveLines + top_row;
2593 row < saveLines + nrow - 1; row++) 2597 row < saveLines + nrow - 1; row++)
2594 { 2598 {
2595 width = row_buf[row].l >= 0 ? row_buf[row].l 2599 width = row_buf[row].l >= 0 ? row_buf[row].l
2596 : ncol; 2600 : ncol;
2597 for (towrite = width; towrite; towrite -= wrote) 2601 for (towrite = width; towrite; towrite -= wrote)
2648 /* convert normal newline chars into common keyboard Return key sequence */ 2652 /* convert normal newline chars into common keyboard Return key sequence */
2649 for (unsigned int i = 0; i < len; i++) 2653 for (unsigned int i = 0; i < len; i++)
2650 if (data[i] == C0_LF) 2654 if (data[i] == C0_LF)
2651 data[i] = C0_CR; 2655 data[i] = C0_CR;
2652 2656
2657 if (priv_modes & PrivMode_BracketPaste)
2658 tt_printf ("\e[200~");
2659
2653 tt_write (data, len); 2660 tt_write (data, len);
2661
2662 if (priv_modes & PrivMode_BracketPaste)
2663 tt_printf ("\e[201~");
2654} 2664}
2655 2665
2656/* ------------------------------------------------------------------------- */ 2666/* ------------------------------------------------------------------------- */
2657/* 2667/*
2658 * Respond to a notification that a primary selection has been sent 2668 * Respond to a notification that a primary selection has been sent

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines