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.305 by ayin, Thu Feb 21 10:30: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 CLEAR_ROWS(row, num) \
93 if (mapped) \
94 XClearArea (dpy, vt, 0, \
95 Row2Pixel (row), (unsigned int)width, \
96 (unsigned int)Height2Pixel (num), False)
97
98#define CLEAR_CHARS(x, y, num) \ 90#define CLEAR_CHARS(x, y, num) \
99 if (mapped) \ 91 if (mapped) \
100 XClearArea (dpy, vt, x, y, \ 92 XClearArea (dpy, vt, x, y, \
101 (unsigned int)Width2Pixel (num), \ 93 (unsigned int)Width2Pixel (num), \
102 (unsigned int)Height2Pixel (1), False) 94 (unsigned int)Height2Pixel (1), False)
103
104#define ERASE_ROWS(row, num) \
105 XFillRectangle (dpy, vt, gc, \
106 0, Row2Pixel (row), \
107 (unsigned int)width, \
108 (unsigned int)Height2Pixel (num))
109 95
110/* ------------------------------------------------------------------------- * 96/* ------------------------------------------------------------------------- *
111 * SCREEN `COMMON' ROUTINES * 97 * SCREEN `COMMON' ROUTINES *
112 * ------------------------------------------------------------------------- */ 98 * ------------------------------------------------------------------------- */
113 99
1225/* 1211/*
1226 * Erase part or whole of a line 1212 * Erase part or whole of a line
1227 * XTERM_SEQ: Clear line to right: ESC [ 0 K 1213 * XTERM_SEQ: Clear line to right: ESC [ 0 K
1228 * XTERM_SEQ: Clear line to left : ESC [ 1 K 1214 * XTERM_SEQ: Clear line to left : ESC [ 1 K
1229 * 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
1230 */ 1217 */
1231void 1218void
1232rxvt_term::scr_erase_line (int mode) NOTHROW 1219rxvt_term::scr_erase_line (int mode) NOTHROW
1233{ 1220{
1234 unsigned int col, num; 1221 unsigned int col, num;
1243 line.touch (); 1230 line.touch ();
1244 line.is_longer (0); 1231 line.is_longer (0);
1245 1232
1246 switch (mode) 1233 switch (mode)
1247 { 1234 {
1235 case 3:
1236 if (screen.flags & Screen_WrapNext)
1237 return;
1238
1239 /* fall through */
1240
1248 case 0: /* erase to end of line */ 1241 case 0: /* erase to end of line */
1249 col = screen.cur.col; 1242 col = screen.cur.col;
1250 num = ncol - col; 1243 num = ncol - col;
1251 min_it (line.l, col); 1244 min_it (line.l, col);
1245
1252 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) 1246 if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
1253 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) 1247 || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
1254 CLEAR_SELECTION (); 1248 CLEAR_SELECTION ();
1255 break; 1249 break;
1250
1256 case 1: /* erase to beginning of line */ 1251 case 1: /* erase to beginning of line */
1257 col = 0; 1252 col = 0;
1258 num = screen.cur.col + 1; 1253 num = screen.cur.col + 1;
1254
1259 if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur) 1255 if (ROWCOL_IN_ROW_AT_OR_BEFORE (selection.beg, screen.cur)
1260 || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur)) 1256 || ROWCOL_IN_ROW_AT_OR_BEFORE (selection.end, screen.cur))
1261 CLEAR_SELECTION (); 1257 CLEAR_SELECTION ();
1262 break; 1258 break;
1259
1263 case 2: /* erase whole line */ 1260 case 2: /* erase whole line */
1264 col = 0; 1261 col = 0;
1265 num = ncol; 1262 num = ncol;
1266 line.l = 0; 1263 line.l = 0;
1267 if (selection.beg.row <= screen.cur.row 1264 if (selection.beg.row <= screen.cur.row
1325 if (row >= nrow) /* Out Of Bounds */ 1322 if (row >= nrow) /* Out Of Bounds */
1326 return; 1323 return;
1327 1324
1328 min_it (num, nrow - row); 1325 min_it (num, nrow - row);
1329 1326
1327 /*TODO: the xlceararea/xfillrectangle below don't take scroll offste into account, ask mikachu for details */
1330 if (rstyle & (RS_RVid | RS_Uline)) 1328 if (rstyle & (RS_RVid | RS_Uline))
1331 ren = (rend_t) ~RS_None; 1329 ren = (rend_t) ~RS_None;
1332 else if (GET_BASEBG (rstyle) == Color_bg) 1330 else if (GET_BASEBG (rstyle) == Color_bg)
1333 { 1331 {
1334 ren = DEFAULT_RSTYLE; 1332 ren = DEFAULT_RSTYLE;
1335 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);
1336 } 1338 }
1337 else 1339 else
1338 { 1340 {
1339 ren = rstyle & (RS_fgMask | RS_bgMask); 1341 ren = rstyle & (RS_fgMask | RS_bgMask);
1342
1340 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; 1343 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1341 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1344 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1342 ERASE_ROWS (row, num); 1345 XFillRectangle (dpy, vt, gc,
1346 0, Row2Pixel (row),
1347 (unsigned int)width,
1348 (unsigned int)Height2Pixel (num));
1343 gcvalue.foreground = pix_colors[Color_fg]; 1349 gcvalue.foreground = pix_colors[Color_fg];
1344 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1350 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1345 } 1351 }
1346 1352
1347 for (; num--; row++) 1353 for (; num--; row++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines