… | |
… | |
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 | */ |
1231 | void |
1218 | void |
1232 | rxvt_term::scr_erase_line (int mode) NOTHROW |
1219 | rxvt_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++) |
… | |
… | |
1992 | return; |
1998 | return; |
1993 | |
1999 | |
1994 | /* |
2000 | /* |
1995 | * A: set up vars |
2001 | * A: set up vars |
1996 | */ |
2002 | */ |
|
|
2003 | refresh_count = 0; |
|
|
2004 | |
1997 | have_bg = 0; |
2005 | have_bg = 0; |
1998 | refresh_count = 0; |
|
|
1999 | |
|
|
2000 | #ifdef HAVE_BG_PIXMAP |
2006 | #ifdef HAVE_BG_PIXMAP |
2001 | have_bg |= bgPixmap.pixmap != None; |
2007 | have_bg = bgPixmap.pixmap != None; |
2002 | #endif |
2008 | #endif |
2003 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2009 | ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ |
2004 | |
2010 | |
2005 | /* |
2011 | /* |
2006 | * B: reverse any characters which are selected |
2012 | * B: reverse any characters which are selected |
… | |
… | |
2474 | |
2480 | |
2475 | XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); |
2481 | XSetWindowBackground (dpy, parent[0], pix_colors[Color_border]); |
2476 | XClearWindow (dpy, parent[0]); |
2482 | XClearWindow (dpy, parent[0]); |
2477 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2483 | XSetWindowBackground (dpy, vt, pix_colors[Color_bg]); |
2478 | |
2484 | |
2479 | # if HAVE_SCROLLBARS |
|
|
2480 | if (scrollBar.win) |
2485 | if (scrollBar.win) |
2481 | { |
2486 | { |
2482 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); |
2487 | XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); |
2483 | scrollBar.setIdle (); |
2488 | scrollBar.state = STATE_IDLE; |
2484 | scrollbar_show (0); |
2489 | scrollBar.show (0); |
2485 | } |
2490 | } |
|
|
2491 | |
2486 | # endif |
2492 | #endif |
2487 | |
2493 | |
|
|
2494 | /* bgPixmap.apply () does not do the following : */ |
2488 | scr_clear (); |
2495 | scr_clear (); |
2489 | scr_touch (true); |
2496 | scr_touch (true); |
2490 | want_refresh = 1; |
2497 | want_refresh = 1; |
2491 | |
|
|
2492 | #endif |
|
|
2493 | } |
2498 | } |
2494 | |
2499 | |
2495 | /* ------------------------------------------------------------------------- */ |
2500 | /* ------------------------------------------------------------------------- */ |
2496 | void |
2501 | void |
2497 | rxvt_term::scr_clear (bool really) NOTHROW |
2502 | rxvt_term::scr_clear (bool really) NOTHROW |
… | |
… | |
2586 | { |
2591 | { |
2587 | int row, wrote; |
2592 | int row, wrote; |
2588 | unsigned int width, towrite; |
2593 | unsigned int width, towrite; |
2589 | char r1[] = "\n"; |
2594 | char r1[] = "\n"; |
2590 | |
2595 | |
2591 | for (row = saveLines - nsaved; |
2596 | for (row = saveLines + top_row; |
2592 | row < saveLines + nrow - 1; row++) |
2597 | row < saveLines + nrow - 1; row++) |
2593 | { |
2598 | { |
2594 | width = row_buf[row].l >= 0 ? row_buf[row].l |
2599 | width = row_buf[row].l >= 0 ? row_buf[row].l |
2595 | : ncol; |
2600 | : ncol; |
2596 | for (towrite = width; towrite; towrite -= wrote) |
2601 | for (towrite = width; towrite; towrite -= wrote) |