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.312 by root, Tue Nov 4 13:30:41 2008 UTC vs.
Revision 1.314 by root, Tue Nov 4 14:34:13 2008 UTC

132 132
133 l.l = 0; 133 l.l = 0;
134 l.f = 0; 134 l.f = 0;
135} 135}
136 136
137// nuke a single wide character at the given column
138void
139rxvt_term::scr_kill_char (line_t &l, int col) const NOTHROW
140{
141 // find begin
142 while (col > 0 && l.t[col] == NOCHAR)
143 col--;
144
145 rend_t rend = l.r[col] & ~RS_baseattrMask;
146 rend = SET_FONT (rend, FONTSET (rend)->find_font (' '));
147
148 // found begin, nuke
149 do {
150 l.t[col] = ' ';
151 l.r[col] = rend;
152 col++;
153 } while (col < ncol && l.t[col] == NOCHAR);
154}
155
137/* ------------------------------------------------------------------------- * 156/* ------------------------------------------------------------------------- *
138 * SCREEN INITIALISATION * 157 * SCREEN INITIALISATION *
139 * ------------------------------------------------------------------------- */ 158 * ------------------------------------------------------------------------- */
140 159
141void 160void
880 if (expect_false ( 899 if (expect_false (
881 line->t[screen.cur.col] == NOCHAR 900 line->t[screen.cur.col] == NOCHAR
882 || (screen.cur.col < ncol - 1 901 || (screen.cur.col < ncol - 1
883 && line->t[screen.cur.col + 1] == NOCHAR) 902 && line->t[screen.cur.col + 1] == NOCHAR)
884 )) 903 ))
885 { 904 scr_kill_char (*line, screen.cur.col);
886 int col = screen.cur.col;
887
888 // find begin
889 while (col > 0 && line->t[col] == NOCHAR)
890 col--;
891
892 rend_t rend = SET_FONT (line->r[col], FONTSET (line->r[col])->find_font (' '));
893
894 // found begin, nuke
895 do {
896 line->t[col] = ' ';
897 line->r[col] = rend;
898 col++;
899 } while (col < ncol && line->t[col] == NOCHAR);
900 }
901 905
902 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); 906 rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
903 907
904 // if the character doesn't fit into the remaining columns... 908 // if the character doesn't fit into the remaining columns...
905 if (expect_false (screen.cur.col > ncol - width && ncol >= width)) 909 if (expect_false (screen.cur.col > ncol - width && ncol >= width))
1442 * Insert/Delete <count> characters from the current position 1446 * Insert/Delete <count> characters from the current position
1443 */ 1447 */
1444void 1448void
1445rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW 1449rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW
1446{ 1450{
1447 int col, row;
1448 rend_t tr;
1449
1450 want_refresh = 1; 1451 want_refresh = 1;
1451 ZERO_SCROLLBACK (); 1452 ZERO_SCROLLBACK ();
1452 1453
1453 if (count <= 0) 1454 if (count <= 0)
1454 return; 1455 return;
1456 scr_do_wrap (); 1457 scr_do_wrap ();
1457 1458
1458 selection_check (1); 1459 selection_check (1);
1459 min_it (count, ncol - screen.cur.col); 1460 min_it (count, ncol - screen.cur.col);
1460 1461
1461 row = screen.cur.row; 1462 int row = screen.cur.row;
1462 1463
1463 line_t *line = &ROW(row); 1464 line_t *line = &ROW(row);
1464 1465
1465 line->touch (); 1466 line->touch ();
1466 line->is_longer (0); 1467 line->is_longer (0);
1467 1468
1468 switch (insdel) 1469 switch (insdel)
1469 { 1470 {
1470 case INSERT: 1471 case INSERT:
1471 for (col = ncol - 1; (col - count) >= screen.cur.col; col--) 1472 line->l = min (line->l + count, ncol);
1473
1474 for (int col = ncol - 1; (col - count) >= screen.cur.col; col--)
1472 { 1475 {
1473 line->t[col] = line->t[col - count]; 1476 line->t[col] = line->t[col - count];
1474 line->r[col] = line->r[col - count]; 1477 line->r[col] = line->r[col - count];
1475 } 1478 }
1476
1477 line->l = min (line->l + count, ncol);
1478 1479
1479 if (selection.op && current_screen == selection.screen 1480 if (selection.op && current_screen == selection.screen
1480 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1481 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1481 { 1482 {
1482 if (selection.end.row != screen.cur.row 1483 if (selection.end.row != screen.cur.row
1501 1502
1502 scr_blank_line (*line, screen.cur.col, count, rstyle); 1503 scr_blank_line (*line, screen.cur.col, count, rstyle);
1503 break; 1504 break;
1504 1505
1505 case DELETE: 1506 case DELETE:
1507 {
1508 line->l = max (line->l - count, 0);
1509
1506 tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); 1510 rend_t tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask);
1507 1511
1508 for (col = screen.cur.col; (col + count) < ncol; col++) 1512 for (int col = screen.cur.col; (col + count) < ncol; col++)
1509 { 1513 {
1510 line->t[col] = line->t[col + count]; 1514 line->t[col] = line->t[col + count];
1511 line->r[col] = line->r[col + count]; 1515 line->r[col] = line->r[col + count];
1512 } 1516 }
1513 1517
1514 line->l = max (line->l - count, 0); 1518 // nuke wide char at the end
1519 if (line->t[screen.cur.col] == NOCHAR)
1520 scr_kill_char (*line, screen.cur.col);
1521
1515 scr_blank_line (*line, ncol - count, count, tr); 1522 scr_blank_line (*line, ncol - count, count, tr);
1516 1523
1517 if (selection.op && current_screen == selection.screen 1524 if (selection.op && current_screen == selection.screen
1518 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) 1525 && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))
1519 { 1526 {
1520 if (selection.end.row != screen.cur.row 1527 if (selection.end.row != screen.cur.row
1521 || (screen.cur.col >= selection.beg.col - count) 1528 || (screen.cur.col >= selection.beg.col - count)
1522 || selection.end.col >= ncol) 1529 || selection.end.col >= ncol)
1523 CLEAR_SELECTION (); 1530 CLEAR_SELECTION ();
1524 else 1531 else
1525 { 1532 {
1526 /* shift selection */ 1533 /* shift selection */
1527 selection.beg.col -= count; 1534 selection.beg.col -= count;
1528 selection.mark.col -= count; /* XXX: yes? */ 1535 selection.mark.col -= count; /* XXX: yes? */
1529 selection.end.col -= count; 1536 selection.end.col -= count;
1530 } 1537 }
1538 }
1531 } 1539 }
1532 1540
1533 break; 1541 break;
1534 } 1542 }
1535} 1543}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines