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.317 by root, Tue Nov 4 15:09:51 2008 UTC vs.
Revision 1.324 by root, Wed Nov 5 00:01:01 2008 UTC

158 * ------------------------------------------------------------------------- */ 158 * ------------------------------------------------------------------------- */
159 159
160void 160void
161rxvt_term::scr_reset () 161rxvt_term::scr_reset ()
162{ 162{
163#if ENABLE_OVERLAY 163 scr_soft_reset ();
164 scr_overlay_off ();
165#endif
166 164
167 rvideo_mode = false;
168 view_start = 0; 165 view_start = 0;
169 num_scr = 0; 166 num_scr = 0;
170 167
171 if (ncol == 0) 168 if (ncol == 0)
172 ncol = 80; 169 ncol = 80;
174 if (nrow == 0) 171 if (nrow == 0)
175 nrow = 24; 172 nrow = 24;
176 173
177 if (ncol == prev_ncol && nrow == prev_nrow) 174 if (ncol == prev_ncol && nrow == prev_nrow)
178 return; 175 return;
179
180 if (current_screen != PRIMARY)
181 scr_swap_screen ();
182 176
183 // we need at least two lines for wrapping to work correctly 177 // we need at least two lines for wrapping to work correctly
184 while (nrow + saveLines < 2) 178 while (nrow + saveLines < 2)
185 { 179 {
186 //TODO//FIXME 180 //TODO//FIXME
399 delete old_ta; 393 delete old_ta;
400 delete old_ra; 394 delete old_ra;
401 395
402 clamp_it (screen.cur.row, 0, nrow - 1); 396 clamp_it (screen.cur.row, 0, nrow - 1);
403 clamp_it (screen.cur.col, 0, ncol - 1); 397 clamp_it (screen.cur.col, 0, ncol - 1);
404
405 free (tabs);
406 } 398 }
407 399
408 CLEAR_ALL_SELECTION (); 400 CLEAR_ALL_SELECTION ();
409 401
410 prev_nrow = nrow; 402 prev_nrow = nrow;
411 prev_ncol = ncol; 403 prev_ncol = ncol;
412
413 tabs = (char *)rxvt_malloc (ncol);
414
415 for (int col = ncol; --col; )
416 tabs [col] = col % TABSIZE == 0;
417
418 if (current_screen != PRIMARY)
419 scr_swap_screen ();
420 404
421 tt_winch (); 405 tt_winch ();
422 406
423 HOOK_INVOKE ((this, HOOK_RESET, DT_END)); 407 HOOK_INVOKE ((this, HOOK_RESET, DT_END));
424} 408}
436 delete ralloc; ralloc = 0; 420 delete ralloc; ralloc = 0;
437 421
438 free (row_buf); 422 free (row_buf);
439 free (swap_buf); 423 free (swap_buf);
440 free (drawn_buf); 424 free (drawn_buf);
425 row_buf = 0; // signal that we freed all the arrays above
426
441 free (tabs); 427 free (tabs);
442 428 tabs = 0;
443 row_buf = 0; // signal that we freed all the arrays
444 } 429 }
445} 430}
446 431
447/* ------------------------------------------------------------------------- */ 432/* ------------------------------------------------------------------------- */
448/* 433/*
449 * Hard reset 434 * Hard/Soft reset
450 */ 435 */
451void 436void
452rxvt_term::scr_poweron () 437rxvt_term::scr_poweron ()
453{ 438{
454 scr_release (); 439 scr_release ();
455 prev_nrow = prev_ncol = 0; 440 prev_nrow = prev_ncol = 0;
456 scr_reset (); 441 scr_reset ();
457 442
458 scr_clear (true); 443 scr_clear (true);
459 scr_refresh (); 444 scr_refresh ();
445}
446
447void
448rxvt_term::scr_soft_reset ()
449{
450 /* only affects modes, nothing drastic such as clearing the screen */
451#if ENABLE_OVERLAY
452 scr_overlay_off ();
453#endif
454
455 rvideo_mode = false;
456
457 if (current_screen != PRIMARY)
458 scr_swap_screen ();
459
460 free (tabs);
461 tabs = (char *)rxvt_malloc (ncol);
462
463 for (int col = ncol; --col; )
464 tabs [col] = col % TABSIZE == 0;
465
466 scr_scroll_region (0, MAX_ROWS - 1);
467 scr_rendition (0, ~RS_None);
468 scr_insert_mode (0);
460} 469}
461 470
462/* ------------------------------------------------------------------------- * 471/* ------------------------------------------------------------------------- *
463 * PROCESS SCREEN COMMANDS * 472 * PROCESS SCREEN COMMANDS *
464 * ------------------------------------------------------------------------- */ 473 * ------------------------------------------------------------------------- */
1333 if (row >= nrow) /* Out Of Bounds */ 1342 if (row >= nrow) /* Out Of Bounds */
1334 return; 1343 return;
1335 1344
1336 min_it (num, nrow - row); 1345 min_it (num, nrow - row);
1337 1346
1338 /*TODO: the xlceararea/xfillrectangle below don't take scroll offste into account, ask mikachu for details */ 1347 // TODO: the code below does not work when view_start != 0
1348 // the workaround is to disable the clear and use a normal refresh
1349 // when view_start != 0. mysterious.
1339 if (rstyle & (RS_RVid | RS_Uline)) 1350 if (rstyle & (RS_RVid | RS_Uline))
1340 ren = (rend_t) ~RS_None; 1351 ren = (rend_t) ~RS_None;
1341 else if (GET_BASEBG (rstyle) == Color_bg) 1352 else if (GET_BASEBG (rstyle) == Color_bg)
1342 { 1353 {
1343 ren = DEFAULT_RSTYLE; 1354 ren = DEFAULT_RSTYLE;
1344 1355
1345 if (mapped) 1356 if (mapped && !view_start)
1346 XClearArea (dpy, vt, 0, 1357 XClearArea (dpy, vt, 0,
1347 Row2Pixel (row), (unsigned int)width, 1358 Row2Pixel (row - view_start), (unsigned int)width,
1348 (unsigned int)Height2Pixel (num), False); 1359 (unsigned int)Height2Pixel (num), False);
1349 } 1360 }
1350 else 1361 else
1351 { 1362 {
1352 ren = rstyle & (RS_fgMask | RS_bgMask); 1363 ren = rstyle & (RS_fgMask | RS_bgMask);
1353 1364
1365 if (mapped && !view_start)
1366 {
1354 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; 1367 gcvalue.foreground = pix_colors[bgcolor_of (rstyle)];
1355 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1368 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1356 XFillRectangle (dpy, vt, gc, 1369 XFillRectangle (dpy, vt, gc,
1357 0, Row2Pixel (row), 1370 0, Row2Pixel (row - view_start),
1358 (unsigned int)width, 1371 (unsigned int)width,
1359 (unsigned int)Height2Pixel (num)); 1372 (unsigned int)Height2Pixel (num));
1360 gcvalue.foreground = pix_colors[Color_fg]; 1373 gcvalue.foreground = pix_colors[Color_fg];
1361 XChangeGC (dpy, gc, GCForeground, &gcvalue); 1374 XChangeGC (dpy, gc, GCForeground, &gcvalue);
1375 }
1362 } 1376 }
1363 1377
1364 for (; num--; row++) 1378 for (; num--; row++)
1365 { 1379 {
1366 scr_blank_screen_mem (ROW(row), rstyle); 1380 scr_blank_screen_mem (ROW(row), rstyle);
1381
1382 if (!view_start)
1367 scr_blank_line (drawn_buf [row], 0, ncol, ren); 1383 scr_blank_line (drawn_buf [row], 0, ncol, ren);
1368 } 1384 }
1369} 1385}
1370 1386
1371#if !ENABLE_MINIMAL 1387#if !ENABLE_MINIMAL
1372void 1388void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines