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.314 by root, Tue Nov 4 14:34:13 2008 UTC vs.
Revision 1.319 by root, Tue Nov 4 23:08:44 2008 UTC

143 col--; 143 col--;
144 144
145 rend_t rend = l.r[col] & ~RS_baseattrMask; 145 rend_t rend = l.r[col] & ~RS_baseattrMask;
146 rend = SET_FONT (rend, FONTSET (rend)->find_font (' ')); 146 rend = SET_FONT (rend, FONTSET (rend)->find_font (' '));
147 147
148 // found begin, nuke 148 // found start, nuke
149 do { 149 do {
150 l.t[col] = ' '; 150 l.t[col] = ' ';
151 l.r[col] = rend; 151 l.r[col] = rend;
152 col++; 152 col++;
153 } while (col < ncol && l.t[col] == NOCHAR); 153 } while (col < ncol && l.t[col] == NOCHAR);
158 * ------------------------------------------------------------------------- */ 158 * ------------------------------------------------------------------------- */
159 159
160void 160void
161rxvt_term::scr_reset () 161rxvt_term::scr_reset ()
162{ 162{
163#if ENABLE_OVERLAY
164 scr_overlay_off ();
165#endif
166
167 rvideo_mode = false;
168 view_start = 0; 163 view_start = 0;
169 num_scr = 0; 164 num_scr = 0;
170 165
171 if (ncol == 0) 166 if (ncol == 0)
172 ncol = 80; 167 ncol = 80;
174 if (nrow == 0) 169 if (nrow == 0)
175 nrow = 24; 170 nrow = 24;
176 171
177 if (ncol == prev_ncol && nrow == prev_nrow) 172 if (ncol == prev_ncol && nrow == prev_nrow)
178 return; 173 return;
179
180 if (current_screen != PRIMARY)
181 scr_swap_screen ();
182 174
183 // we need at least two lines for wrapping to work correctly 175 // we need at least two lines for wrapping to work correctly
184 while (nrow + saveLines < 2) 176 while (nrow + saveLines < 2)
185 { 177 {
186 //TODO//FIXME 178 //TODO//FIXME
399 delete old_ta; 391 delete old_ta;
400 delete old_ra; 392 delete old_ra;
401 393
402 clamp_it (screen.cur.row, 0, nrow - 1); 394 clamp_it (screen.cur.row, 0, nrow - 1);
403 clamp_it (screen.cur.col, 0, ncol - 1); 395 clamp_it (screen.cur.col, 0, ncol - 1);
404
405 free (tabs);
406 } 396 }
407 397
408 CLEAR_ALL_SELECTION (); 398 CLEAR_ALL_SELECTION ();
409 399
410 prev_nrow = nrow; 400 prev_nrow = nrow;
411 prev_ncol = ncol; 401 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 402
421 tt_winch (); 403 tt_winch ();
422 404
423 HOOK_INVOKE ((this, HOOK_RESET, DT_END)); 405 HOOK_INVOKE ((this, HOOK_RESET, DT_END));
424} 406}
436 delete ralloc; ralloc = 0; 418 delete ralloc; ralloc = 0;
437 419
438 free (row_buf); 420 free (row_buf);
439 free (swap_buf); 421 free (swap_buf);
440 free (drawn_buf); 422 free (drawn_buf);
423 row_buf = 0; // signal that we freed all the arrays above
424
441 free (tabs); 425 free (tabs);
442 426 tabs = 0;
443 row_buf = 0; // signal that we freed all the arrays
444 } 427 }
445} 428}
446 429
447/* ------------------------------------------------------------------------- */ 430/* ------------------------------------------------------------------------- */
448/* 431/*
449 * Hard reset 432 * Hard/Soft reset
450 */ 433 */
451void 434void
452rxvt_term::scr_poweron () 435rxvt_term::scr_poweron ()
453{ 436{
454 scr_release (); 437 scr_release ();
455 prev_nrow = prev_ncol = 0; 438 prev_nrow = prev_ncol = 0;
439 scr_soft_reset ();
456 scr_reset (); 440 scr_reset ();
457 441
458 scr_clear (true); 442 scr_clear (true);
459 scr_refresh (); 443 scr_refresh ();
444}
445
446void
447rxvt_term::scr_soft_reset ()
448{
449 /* only affects modes, nothing drastic such as clearing the screen */
450#if ENABLE_OVERLAY
451 scr_overlay_off ();
452#endif
453
454 rvideo_mode = false;
455
456 if (current_screen != PRIMARY)
457 scr_swap_screen ();
458
459 free (tabs);
460 tabs = (char *)rxvt_malloc (ncol);
461
462 for (int col = ncol; --col; )
463 tabs [col] = col % TABSIZE == 0;
464
465 scr_scroll_region (0, MAX_ROWS - 1);
466 scr_rendition (0, ~RS_None);
467 scr_insert_mode (0);
460} 468}
461 469
462/* ------------------------------------------------------------------------- * 470/* ------------------------------------------------------------------------- *
463 * PROCESS SCREEN COMMANDS * 471 * PROCESS SCREEN COMMANDS *
464 * ------------------------------------------------------------------------- */ 472 * ------------------------------------------------------------------------- */
906 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); 914 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
907 915
908 // if the character doesn't fit into the remaining columns... 916 // if the character doesn't fit into the remaining columns...
909 if (expect_false (screen.cur.col > ncol - width && ncol >= width)) 917 if (expect_false (screen.cur.col > ncol - width && ncol >= width))
910 { 918 {
911 // ...output spaces 919 // ... artificially enlargen the previous one
912 c = ' '; 920 c = NOCHAR;
913 // and try the same character next loop iteration 921 // and try the same character next loop iteration
914 --str; 922 --str;
915 } 923 }
916 924
917 line->touch (); 925 line->touch ();
1464 line_t *line = &ROW(row); 1472 line_t *line = &ROW(row);
1465 1473
1466 line->touch (); 1474 line->touch ();
1467 line->is_longer (0); 1475 line->is_longer (0);
1468 1476
1477 // nuke wide spanning the start
1478 if (line->t[screen.cur.col] == NOCHAR)
1479 scr_kill_char (*line, screen.cur.col);
1480
1469 switch (insdel) 1481 switch (insdel)
1470 { 1482 {
1471 case INSERT: 1483 case INSERT:
1472 line->l = min (line->l + count, ncol); 1484 line->l = min (line->l + count, ncol);
1485
1486 if (line->t[screen.cur.col] == NOCHAR)
1487 scr_kill_char (*line, screen.cur.col);
1473 1488
1474 for (int col = ncol - 1; (col - count) >= screen.cur.col; col--) 1489 for (int col = ncol - 1; (col - count) >= screen.cur.col; col--)
1475 { 1490 {
1476 line->t[col] = line->t[col - count]; 1491 line->t[col] = line->t[col - count];
1477 line->r[col] = line->r[col - count]; 1492 line->r[col] = line->r[col - count];
1498 case ERASE: 1513 case ERASE:
1499 screen.cur.col += count; /* don't worry if > ncol */ 1514 screen.cur.col += count; /* don't worry if > ncol */
1500 selection_check (1); 1515 selection_check (1);
1501 screen.cur.col -= count; 1516 screen.cur.col -= count;
1502 1517
1518 // nuke wide char after the end
1519 if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR)
1520 scr_kill_char (*line, screen.cur.col + count);
1521
1503 scr_blank_line (*line, screen.cur.col, count, rstyle); 1522 scr_blank_line (*line, screen.cur.col, count, rstyle);
1504 break; 1523 break;
1505 1524
1506 case DELETE: 1525 case DELETE:
1507 {
1508 line->l = max (line->l - count, 0); 1526 line->l = max (line->l - count, 0);
1509 1527
1510 rend_t tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1528 // nuke wide char spanning the end
1529 if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR)
1530 scr_kill_char (*line, screen.cur.col + count);
1511 1531
1512 for (int col = screen.cur.col; (col + count) < ncol; col++) 1532 for (int col = screen.cur.col; (col + count) < ncol; col++)
1513 { 1533 {
1514 line->t[col] = line->t[col + count]; 1534 line->t[col] = line->t[col + count];
1515 line->r[col] = line->r[col + count]; 1535 line->r[col] = line->r[col + count];
1516 } 1536 }
1517 1537
1518 // nuke wide char at the end
1519 if (line->t[screen.cur.col] == NOCHAR)
1520 scr_kill_char (*line, screen.cur.col);
1521
1522 scr_blank_line (*line, ncol - count, count, tr); 1538 scr_blank_line (*line, ncol - count, count,
1539 line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask));
1523 1540
1524 if (selection.op && current_screen == selection.screen 1541 if (selection.op && current_screen == selection.screen
1525 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1542 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1526 { 1543 {
1527 if (selection.end.row != screen.cur.row 1544 if (selection.end.row != screen.cur.row
1528 || (screen.cur.col >= selection.beg.col - count) 1545 || (screen.cur.col >= selection.beg.col - count)
1529 || selection.end.col >= ncol) 1546 || selection.end.col >= ncol)
1530 CLEAR_SELECTION (); 1547 CLEAR_SELECTION ();
1531 else 1548 else
1532 { 1549 {
1533 /* shift selection */ 1550 /* shift selection */
1534 selection.beg.col -= count; 1551 selection.beg.col -= count;
1535 selection.mark.col -= count; /* XXX: yes? */ 1552 selection.mark.col -= count; /* XXX: yes? */
1536 selection.end.col -= count; 1553 selection.end.col -= count;
1537 } 1554 }
1538 }
1539 } 1555 }
1540 1556
1541 break; 1557 break;
1542 } 1558 }
1543} 1559}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines