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.318 by root, Tue Nov 4 22:44:09 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 if (current_screen != PRIMARY)
466 scr_swap_screen ();
467
468 scr_scroll_region (0, MAX_ROWS - 1);
469 scr_rendition (0, ~RS_None);
470 scr_insert_mode (0);
460} 471}
461 472
462/* ------------------------------------------------------------------------- * 473/* ------------------------------------------------------------------------- *
463 * PROCESS SCREEN COMMANDS * 474 * PROCESS SCREEN COMMANDS *
464 * ------------------------------------------------------------------------- */ 475 * ------------------------------------------------------------------------- */
906 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); 917 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
907 918
908 // if the character doesn't fit into the remaining columns... 919 // if the character doesn't fit into the remaining columns...
909 if (expect_false (screen.cur.col > ncol - width && ncol >= width)) 920 if (expect_false (screen.cur.col > ncol - width && ncol >= width))
910 { 921 {
911 // ...output spaces 922 // ... artificially enlargen the previous one
912 c = ' '; 923 c = NOCHAR;
913 // and try the same character next loop iteration 924 // and try the same character next loop iteration
914 --str; 925 --str;
915 } 926 }
916 927
917 line->touch (); 928 line->touch ();
1464 line_t *line = &ROW(row); 1475 line_t *line = &ROW(row);
1465 1476
1466 line->touch (); 1477 line->touch ();
1467 line->is_longer (0); 1478 line->is_longer (0);
1468 1479
1480 // nuke wide spanning the start
1481 if (line->t[screen.cur.col] == NOCHAR)
1482 scr_kill_char (*line, screen.cur.col);
1483
1469 switch (insdel) 1484 switch (insdel)
1470 { 1485 {
1471 case INSERT: 1486 case INSERT:
1472 line->l = min (line->l + count, ncol); 1487 line->l = min (line->l + count, ncol);
1488
1489 if (line->t[screen.cur.col] == NOCHAR)
1490 scr_kill_char (*line, screen.cur.col);
1473 1491
1474 for (int col = ncol - 1; (col - count) >= screen.cur.col; col--) 1492 for (int col = ncol - 1; (col - count) >= screen.cur.col; col--)
1475 { 1493 {
1476 line->t[col] = line->t[col - count]; 1494 line->t[col] = line->t[col - count];
1477 line->r[col] = line->r[col - count]; 1495 line->r[col] = line->r[col - count];
1498 case ERASE: 1516 case ERASE:
1499 screen.cur.col += count; /* don't worry if > ncol */ 1517 screen.cur.col += count; /* don't worry if > ncol */
1500 selection_check (1); 1518 selection_check (1);
1501 screen.cur.col -= count; 1519 screen.cur.col -= count;
1502 1520
1521 // nuke wide char after the end
1522 if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR)
1523 scr_kill_char (*line, screen.cur.col + count);
1524
1503 scr_blank_line (*line, screen.cur.col, count, rstyle); 1525 scr_blank_line (*line, screen.cur.col, count, rstyle);
1504 break; 1526 break;
1505 1527
1506 case DELETE: 1528 case DELETE:
1507 {
1508 line->l = max (line->l - count, 0); 1529 line->l = max (line->l - count, 0);
1509 1530
1510 rend_t tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1531 // nuke wide char spanning the end
1532 if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR)
1533 scr_kill_char (*line, screen.cur.col + count);
1511 1534
1512 for (int col = screen.cur.col; (col + count) < ncol; col++) 1535 for (int col = screen.cur.col; (col + count) < ncol; col++)
1513 { 1536 {
1514 line->t[col] = line->t[col + count]; 1537 line->t[col] = line->t[col + count];
1515 line->r[col] = line->r[col + count]; 1538 line->r[col] = line->r[col + count];
1516 } 1539 }
1517 1540
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); 1541 scr_blank_line (*line, ncol - count, count,
1542 line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask));
1523 1543
1524 if (selection.op && current_screen == selection.screen 1544 if (selection.op && current_screen == selection.screen
1525 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1545 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1526 { 1546 {
1527 if (selection.end.row != screen.cur.row 1547 if (selection.end.row != screen.cur.row
1528 || (screen.cur.col >= selection.beg.col - count) 1548 || (screen.cur.col >= selection.beg.col - count)
1529 || selection.end.col >= ncol) 1549 || selection.end.col >= ncol)
1530 CLEAR_SELECTION (); 1550 CLEAR_SELECTION ();
1531 else 1551 else
1532 { 1552 {
1533 /* shift selection */ 1553 /* shift selection */
1534 selection.beg.col -= count; 1554 selection.beg.col -= count;
1535 selection.mark.col -= count; /* XXX: yes? */ 1555 selection.mark.col -= count; /* XXX: yes? */
1536 selection.end.col -= count; 1556 selection.end.col -= count;
1537 } 1557 }
1538 }
1539 } 1558 }
1540 1559
1541 break; 1560 break;
1542 } 1561 }
1543} 1562}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines