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.289 by root, Fri Dec 14 05:25:26 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++)
1872void 1873void
1873rxvt_term::bell_cb (ev::timer &w, int revents) 1874rxvt_term::bell_cb (ev::timer &w, int revents)
1874{ 1875{
1875 rvideo_bell = false; 1876 rvideo_bell = false;
1876 scr_rvideo_mode (rvideo_mode); 1877 scr_rvideo_mode (rvideo_mode);
1878 refresh_check ();
1877} 1879}
1878#endif 1880#endif
1879 1881
1880/* ------------------------------------------------------------------------- */ 1882/* ------------------------------------------------------------------------- */
1881void 1883void
1903 1905
1904 if (option (Opt_visualBell)) 1906 if (option (Opt_visualBell))
1905 { 1907 {
1906 rvideo_bell = true; 1908 rvideo_bell = true;
1907 scr_rvideo_mode (rvideo_mode); 1909 scr_rvideo_mode (rvideo_mode);
1908 display->flush (); 1910 flush ();
1909 1911
1910 bell_ev.start (VISUAL_BELL_DURATION); 1912 bell_ev.start (VISUAL_BELL_DURATION);
1911 } 1913 }
1912 else 1914 else
1913 XBell (dpy, 0); 1915 XBell (dpy, 0);
1996 return; 1998 return;
1997 1999
1998 /* 2000 /*
1999 * A: set up vars 2001 * A: set up vars
2000 */ 2002 */
2003 refresh_count = 0;
2004
2001 have_bg = 0; 2005 have_bg = 0;
2002 refresh_count = 0;
2003
2004#ifdef HAVE_BG_PIXMAP 2006#ifdef HAVE_BG_PIXMAP
2005 have_bg |= bgPixmap.pixmap != None; 2007 have_bg = bgPixmap.pixmap != None;
2006#endif 2008#endif
2007 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */ 2009 ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
2008 2010
2009 /* 2011 /*
2010 * B: reverse any characters which are selected 2012 * B: reverse any characters which are selected
2263 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) 2265 if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful))
2264 { 2266 {
2265 bool invert = rend & RS_RVid; 2267 bool invert = rend & RS_RVid;
2266 2268
2267#ifndef NO_BOLD_UNDERLINE_REVERSE 2269#ifndef NO_BOLD_UNDERLINE_REVERSE
2268 if (rend & RS_Bold
2269 && fore == Color_fg) 2270 if (rend & RS_Bold && fore == Color_fg)
2270 { 2271 {
2271 if (ISSET_PIXCOLOR (Color_BD)) 2272 if (ISSET_PIXCOLOR (Color_BD))
2272 fore = Color_BD; 2273 fore = Color_BD;
2273# if !ENABLE_STYLES 2274# if !ENABLE_STYLES
2274 else 2275 else
2275 invert = !invert; 2276 invert = !invert;
2276# endif 2277# endif
2277 } 2278 }
2278 2279
2279 if (rend & RS_Italic 2280 if (rend & RS_Italic && fore == Color_fg)
2280 && fore == Color_fg)
2281 { 2281 {
2282 if (ISSET_PIXCOLOR (Color_IT)) 2282 if (ISSET_PIXCOLOR (Color_IT))
2283 fore = Color_IT; 2283 fore = Color_IT;
2284# if !ENABLE_STYLES 2284# if !ENABLE_STYLES
2285 else 2285 else
2379 XSetForeground (dpy, gc, pix_colors[Color_underline]); 2379 XSetForeground (dpy, gc, pix_colors[Color_underline]);
2380 else 2380 else
2381#endif 2381#endif
2382 XSetForeground (dpy, gc, pix_colors[fore]); 2382 XSetForeground (dpy, gc, pix_colors[fore]);
2383 2383
2384 XDrawLine (dpy, drawBuffer, gc, 2384 XDrawLine (dpy, vt, gc,
2385 xpixel, ypixel + font->ascent + 1, 2385 xpixel, ypixel + font->ascent + 1,
2386 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1); 2386 xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
2387 } 2387 }
2388 } /* for (col....) */ 2388 } /* for (col....) */
2389 } /* for (row....) */ 2389 } /* for (row....) */
2427 XSetForeground (dpy, gc, pix_colors[Color_cursor]); 2427 XSetForeground (dpy, gc, pix_colors[Color_cursor]);
2428 else 2428 else
2429#endif 2429#endif
2430 XSetForeground (dpy, gc, pix_colors[ccol1]); 2430 XSetForeground (dpy, gc, pix_colors[ccol1]);
2431 2431
2432 XDrawRectangle (dpy, drawBuffer, gc, 2432 XDrawRectangle (dpy, vt, gc,
2433 Col2Pixel (col), 2433 Col2Pixel (col),
2434 Row2Pixel (oldcursor.row), 2434 Row2Pixel (oldcursor.row),
2435 (unsigned int) (Width2Pixel (cursorwidth) - 1), 2435 (unsigned int) (Width2Pixel (cursorwidth) - 1),
2436 (unsigned int) (Height2Pixel (1) - lineSpace - 1)); 2436 (unsigned int) (Height2Pixel (1) - lineSpace - 1));
2437 } 2437 }
2475rxvt_term::scr_recolour () NOTHROW 2475rxvt_term::scr_recolour () NOTHROW
2476{ 2476{
2477#ifdef HAVE_BG_PIXMAP 2477#ifdef HAVE_BG_PIXMAP
2478 bgPixmap.apply (); 2478 bgPixmap.apply ();
2479#else 2479#else
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# if HAVE_SCROLLBARS 2484
2484 if (scrollBar.win) 2485 if (scrollBar.win)
2485 { 2486 {
2486 XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]); 2487 XSetWindowBackground (dpy, scrollBar.win, pix_colors[Color_border]);
2487 scrollBar.setIdle (); 2488 scrollBar.state = STATE_IDLE;
2488 scrollbar_show (0); 2489 scrollBar.show (0);
2489 } 2490 }
2491
2490# endif 2492#endif
2493
2494 /* bgPixmap.apply () does not do the following : */
2491 scr_clear (); 2495 scr_clear ();
2492 scr_touch (true); 2496 scr_touch (true);
2493 want_refresh = 1; 2497 want_refresh = 1;
2494#endif
2495
2496} 2498}
2497 2499
2498/* ------------------------------------------------------------------------- */ 2500/* ------------------------------------------------------------------------- */
2499void 2501void
2500rxvt_term::scr_clear (bool really) NOTHROW 2502rxvt_term::scr_clear (bool really) NOTHROW
2589{ 2591{
2590 int row, wrote; 2592 int row, wrote;
2591 unsigned int width, towrite; 2593 unsigned int width, towrite;
2592 char r1[] = "\n"; 2594 char r1[] = "\n";
2593 2595
2594 for (row = saveLines - nsaved; 2596 for (row = saveLines + top_row;
2595 row < saveLines + nrow - 1; row++) 2597 row < saveLines + nrow - 1; row++)
2596 { 2598 {
2597 width = row_buf[row].l >= 0 ? row_buf[row].l 2599 width = row_buf[row].l >= 0 ? row_buf[row].l
2598 : ncol; 2600 : ncol;
2599 for (towrite = width; towrite; towrite -= wrote) 2601 for (towrite = width; towrite; towrite -= wrote)
2650 /* convert normal newline chars into common keyboard Return key sequence */ 2652 /* convert normal newline chars into common keyboard Return key sequence */
2651 for (unsigned int i = 0; i < len; i++) 2653 for (unsigned int i = 0; i < len; i++)
2652 if (data[i] == C0_LF) 2654 if (data[i] == C0_LF)
2653 data[i] = C0_CR; 2655 data[i] = C0_CR;
2654 2656
2657 if (priv_modes & PrivMode_BracketPaste)
2658 tt_printf ("\e[200~");
2659
2655 tt_write (data, len); 2660 tt_write (data, len);
2661
2662 if (priv_modes & PrivMode_BracketPaste)
2663 tt_printf ("\e[201~");
2656} 2664}
2657 2665
2658/* ------------------------------------------------------------------------- */ 2666/* ------------------------------------------------------------------------- */
2659/* 2667/*
2660 * 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