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.297 by root, Wed Jan 9 01:14:29 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
1227/* 1211/*
1228 * Erase part or whole of a line 1212 * Erase part or whole of a line
1229 * XTERM_SEQ: Clear line to right: ESC [ 0 K 1213 * XTERM_SEQ: Clear line to right: ESC [ 0 K
1230 * XTERM_SEQ: Clear line to left : ESC [ 1 K 1214 * XTERM_SEQ: Clear line to left : ESC [ 1 K
1231 * 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
1232 */ 1217 */
1233void 1218void
1234rxvt_term::scr_erase_line (int mode) NOTHROW 1219rxvt_term::scr_erase_line (int mode) NOTHROW
1235{ 1220{
1236 unsigned int col, num; 1221 unsigned int col, num;
1245 line.touch (); 1230 line.touch ();
1246 line.is_longer (0); 1231 line.is_longer (0);
1247 1232
1248 switch (mode) 1233 switch (mode)
1249 { 1234 {
1235 case 3:
1236 if (screen.flags & Screen_WrapNext)
1237 return;
1238
1239 /* fall through */
1240
1250 case 0: /* erase to end of line */ 1241 case 0: /* erase to end of line */
1251 col = screen.cur.col; 1242 col = screen.cur.col;
1252 num = ncol - col; 1243 num = ncol - col;
1253 min_it (line.l, col); 1244 min_it (line.l, col);
1245
1254 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1246 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1255 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1247 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1256 CLEAR_SELECTION (); 1248 CLEAR_SELECTION ();
1257 break; 1249 break;
1250
1258 case 1: /* erase to beginning of line */ 1251 case 1: /* erase to beginning of line */
1259 col = 0; 1252 col = 0;
1260 num = screen.cur.col + 1; 1253 num = screen.cur.col + 1;
1254
1261 if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur) 1255 if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur)
1262 || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur)) 1256 || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur))
1263 CLEAR_SELECTION (); 1257 CLEAR_SELECTION ();
1264 break; 1258 break;
1259
1265 case 2: /* erase whole line */ 1260 case 2: /* erase whole line */
1266 col = 0; 1261 col = 0;
1267 num = ncol; 1262 num = ncol;
1268 line.l = 0; 1263 line.l = 0;
1269 if (selection.beg.row <= screen.cur.row 1264 if (selection.beg.row <= screen.cur.row
1327 if (row >= nrow) /* Out Of Bounds */ 1322 if (row >= nrow) /* Out Of Bounds */
1328 return; 1323 return;
1329 1324
1330 min_it (num, nrow - row); 1325 min_it (num, nrow - row);
1331 1326
1327 /*TODO: the xlceararea/xfillrectangle below don't take scroll offste into account, ask mikachu for details */
1332 if (rstyle & (RS_RVid | RS_Uline)) 1328 if (rstyle & (RS_RVid | RS_Uline))
1333 ren = (rend_t) ~RS_None; 1329 ren = (rend_t) ~RS_None;
1334 else if (GET_BASEBG (rstyle) == Color_bg) 1330 else if (GET_BASEBG (rstyle) == Color_bg)
1335 { 1331 {
1336 ren = DEFAULT_RSTYLE; 1332 ren = DEFAULT_RSTYLE;
1337 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);
1338 } 1338 }
1339 else 1339 else
1340 { 1340 {
1341 ren = rstyle & (RS_fgMask | RS_bgMask); 1341 ren = rstyle & (RS_fgMask | RS_bgMask);
1342
1342 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; 1343 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1343 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1344 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1344 ERASE_ROWS (row, num); 1345 XFillRectangle (dpy, vt, gc,
1346 0, Row2Pixel (row),
1347 (unsigned int)width,
1348 (unsigned int)Height2Pixel (num));
1345 gcvalue.foreground = pix_colors[Color_fg]; 1349 gcvalue.foreground = pix_colors[Color_fg];
1346 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1350 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1347 } 1351 }
1348 1352
1349 for (; num--; row++) 1353 for (; num--; row++)
1994 return; 1998 return;
1995 1999
1996 /* 2000 /*
1997 * A: set up vars 2001 * A: set up vars
1998 */ 2002 */
2003 refresh_count = 0;
2004
1999 have_bg = 0; 2005 have_bg = 0;
2000 refresh_count = 0;
2001
2002#ifdef HAVE_BG_PIXMAP 2006#ifdef HAVE_BG_PIXMAP
2003 have_bg |= bgPixmap.pixmap != None; 2007 have_bg = bgPixmap.pixmap != None;
2004#endif 2008#endif
2005 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 2009 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
2006 2010
2007 /* 2011 /*
2008 * B: reverse any characters which are selected 2012 * B: reverse any characters which are selected
2375 XSetForeground (dpy, gc, pix_colors[Color_underline]); 2379 XSetForeground (dpy, gc, pix_colors[Color_underline]);
2376 else 2380 else
2377#endif 2381#endif
2378 XSetForeground (dpy, gc, pix_colors[fore]); 2382 XSetForeground (dpy, gc, pix_colors[fore]);
2379 2383
2380 XDrawLine (dpy, drawBuffer, gc, 2384 XDrawLine (dpy, vt, gc,
2381 xpixel, ypixel + font->ascent + 1, 2385 xpixel, ypixel + font->ascent + 1,
2382 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); 2386 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
2383 } 2387 }
2384 } /* for (col....) */ 2388 } /* for (col....) */
2385 } /* for (row....) */ 2389 } /* for (row....) */
2423 XSetForeground (dpy, gc, pix_colors[Color_cursor]); 2427 XSetForeground (dpy, gc, pix_colors[Color_cursor]);
2424 else 2428 else
2425#endif 2429#endif
2426 XSetForeground (dpy, gc, pix_colors[ccol1]); 2430 XSetForeground (dpy, gc, pix_colors[ccol1]);
2427 2431
2428 XDrawRectangle (dpy, drawBuffer, gc, 2432 XDrawRectangle (dpy, vt, gc,
2429 Col2Pixel (col), 2433 Col2Pixel (col),
2430 Row2Pixel (oldcursor.row), 2434 Row2Pixel (oldcursor.row),
2431 (unsigned int) (Width2Pixel (cursorwidth) - 1), 2435 (unsigned int) (Width2Pixel (cursorwidth) - 1),
2432 (unsigned int) (Height2Pixel (1) - lineSpace - 1)); 2436 (unsigned int) (Height2Pixel (1) - lineSpace - 1));
2433 } 2437 }
2476 2480
2477 XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); 2481 XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]);
2478 XClearWindow (dpy, parent[0]); 2482 XClearWindow (dpy, parent[0]);
2479 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); 2483 XSetWindowBackground (dpy, vt, pix_colors[Color_bg]);
2480 2484
2481# if HAVE_SCROLLBARS
2482 if (scrollBar.win) 2485 if (scrollBar.win)
2483 { 2486 {
2484 XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); 2487 XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]);
2485 scrollBar.setIdle (); 2488 scrollBar.state = STATE_IDLE;
2486 scrollbar_show (0); 2489 scrollBar.show (0);
2487 } 2490 }
2491
2488# endif 2492#endif
2489 2493
2494 /* bgPixmap.apply () does not do the following : */
2490 scr_clear (); 2495 scr_clear ();
2491 scr_touch (true); 2496 scr_touch (true);
2492 want_refresh = 1; 2497 want_refresh = 1;
2493
2494#endif
2495} 2498}
2496 2499
2497/* ------------------------------------------------------------------------- */ 2500/* ------------------------------------------------------------------------- */
2498void 2501void
2499rxvt_term::scr_clear (bool really) NOTHROW 2502rxvt_term::scr_clear (bool really) NOTHROW
2588{ 2591{
2589 int row, wrote; 2592 int row, wrote;
2590 unsigned int width, towrite; 2593 unsigned int width, towrite;
2591 char r1[] = "\n"; 2594 char r1[] = "\n";
2592 2595
2593 for (row = saveLines - nsaved; 2596 for (row = saveLines + top_row;
2594 row < saveLines + nrow - 1; row++) 2597 row < saveLines + nrow - 1; row++)
2595 { 2598 {
2596 width = row_buf[row].l >= 0 ? row_buf[row].l 2599 width = row_buf[row].l >= 0 ? row_buf[row].l
2597 : ncol; 2600 : ncol;
2598 for (towrite = width; towrite; towrite -= wrote) 2601 for (towrite = width; towrite; towrite -= wrote)
2649 /* convert normal newline chars into common keyboard Return key sequence */ 2652 /* convert normal newline chars into common keyboard Return key sequence */
2650 for (unsigned int i = 0; i < len; i++) 2653 for (unsigned int i = 0; i < len; i++)
2651 if (data[i] == C0_LF) 2654 if (data[i] == C0_LF)
2652 data[i] = C0_CR; 2655 data[i] = C0_CR;
2653 2656
2657 if (priv_modes & PrivMode_BracketPaste)
2658 tt_printf ("\e[200~");
2659
2654 tt_write (data, len); 2660 tt_write (data, len);
2661
2662 if (priv_modes & PrivMode_BracketPaste)
2663 tt_printf ("\e[201~");
2655} 2664}
2656 2665
2657/* ------------------------------------------------------------------------- */ 2666/* ------------------------------------------------------------------------- */
2658/* 2667/*
2659 * 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