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.313 by root, Tue Nov 4 14:25:10 2008 UTC vs.
Revision 1.315 by root, Tue Nov 4 14:38:29 2008 UTC

1446 * Insert/Delete <count> characters from the current position 1446 * Insert/Delete <count> characters from the current position
1447 */ 1447 */
1448void 1448void
1449rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW 1449rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW
1450{ 1450{
1451 int col, row;
1452 rend_t tr;
1453
1454 want_refresh = 1; 1451 want_refresh = 1;
1455 ZERO_SCROLLBACK (); 1452 ZERO_SCROLLBACK ();
1456 1453
1457 if (count <= 0) 1454 if (count <= 0)
1458 return; 1455 return;
1460 scr_do_wrap (); 1457 scr_do_wrap ();
1461 1458
1462 selection_check (1); 1459 selection_check (1);
1463 min_it (count, ncol - screen.cur.col); 1460 min_it (count, ncol - screen.cur.col);
1464 1461
1465 row = screen.cur.row; 1462 int row = screen.cur.row;
1466 1463
1467 line_t *line = &ROW(row); 1464 line_t *line = &ROW(row);
1468 1465
1469 line->touch (); 1466 line->touch ();
1470 line->is_longer (0); 1467 line->is_longer (0);
1471 1468
1469 // nuke wide char at beginning
1470 if (line->t[screen.cur.col] == NOCHAR)
1471 scr_kill_char (*line, screen.cur.col);
1472
1472 switch (insdel) 1473 switch (insdel)
1473 { 1474 {
1474 case INSERT: 1475 case INSERT:
1475 for (col = ncol - 1; (col - count) >= screen.cur.col; col--) 1476 line->l = min (line->l + count, ncol);
1477
1478 if (line->t[screen.cur.col] == NOCHAR)
1479 scr_kill_char (*line, screen.cur.col);
1480
1481 for (int col = ncol - 1; (col - count) >= screen.cur.col; col--)
1476 { 1482 {
1477 line->t[col] = line->t[col - count]; 1483 line->t[col] = line->t[col - count];
1478 line->r[col] = line->r[col - count]; 1484 line->r[col] = line->r[col - count];
1479 } 1485 }
1480
1481 line->l = min (line->l + count, ncol);
1482 1486
1483 if (selection.op && current_screen == selection.screen 1487 if (selection.op && current_screen == selection.screen
1484 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1488 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1485 { 1489 {
1486 if (selection.end.row != screen.cur.row 1490 if (selection.end.row != screen.cur.row
1501 case ERASE: 1505 case ERASE:
1502 screen.cur.col += count; /* don't worry if > ncol */ 1506 screen.cur.col += count; /* don't worry if > ncol */
1503 selection_check (1); 1507 selection_check (1);
1504 screen.cur.col -= count; 1508 screen.cur.col -= count;
1505 1509
1510 // nuke wide char after the end
1511 if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR)
1512 scr_kill_char (*line, screen.cur.col + count);
1513
1506 scr_blank_line (*line, screen.cur.col, count, rstyle); 1514 scr_blank_line (*line, screen.cur.col, count, rstyle);
1507 break; 1515 break;
1508 1516
1509 case DELETE: 1517 case DELETE:
1518 {
1519 line->l = max (line->l - count, 0);
1520
1510 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1521 rend_t tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask);
1511 1522
1512 for (col = screen.cur.col; (col + count) < ncol; col++) 1523 for (int col = screen.cur.col; (col + count) < ncol; col++)
1513 { 1524 {
1514 line->t[col] = line->t[col + count]; 1525 line->t[col] = line->t[col + count];
1515 line->r[col] = line->r[col + count]; 1526 line->r[col] = line->r[col + count];
1516 } 1527 }
1517 1528
1518 line->l = max (line->l - count, 0); 1529 // nuke wide char at the end
1530 if (line->t[screen.cur.col] == NOCHAR)
1531 scr_kill_char (*line, screen.cur.col);
1532
1519 scr_blank_line (*line, ncol - count, count, tr); 1533 scr_blank_line (*line, ncol - count, count, tr);
1520 1534
1521 if (selection.op && current_screen == selection.screen 1535 if (selection.op && current_screen == selection.screen
1522 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1536 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1523 { 1537 {
1524 if (selection.end.row != screen.cur.row 1538 if (selection.end.row != screen.cur.row
1525 || (screen.cur.col >= selection.beg.col - count) 1539 || (screen.cur.col >= selection.beg.col - count)
1526 || selection.end.col >= ncol) 1540 || selection.end.col >= ncol)
1527 CLEAR_SELECTION (); 1541 CLEAR_SELECTION ();
1528 else 1542 else
1529 { 1543 {
1530 /* shift selection */ 1544 /* shift selection */
1531 selection.beg.col -= count; 1545 selection.beg.col -= count;
1532 selection.mark.col -= count; /* XXX: yes? */ 1546 selection.mark.col -= count; /* XXX: yes? */
1533 selection.end.col -= count; 1547 selection.end.col -= count;
1534 } 1548 }
1549 }
1535 } 1550 }
1536 1551
1537 break; 1552 break;
1538 } 1553 }
1539} 1554}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines