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