… | |
… | |
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 |
|
|
138 | void |
|
|
139 | rxvt_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 start, 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 | |
141 | void |
160 | void |
… | |
… | |
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)) |
906 | { |
910 | { |
907 | // ...output spaces |
911 | // ... artificially enlargen the previous one |
908 | c = ' '; |
912 | c = NOCHAR; |
909 | // and try the same character next loop iteration |
913 | // and try the same character next loop iteration |
910 | --str; |
914 | --str; |
911 | } |
915 | } |
912 | |
916 | |
913 | line->touch (); |
917 | line->touch (); |
… | |
… | |
1442 | * Insert/Delete <count> characters from the current position |
1446 | * Insert/Delete <count> characters from the current position |
1443 | */ |
1447 | */ |
1444 | void |
1448 | void |
1445 | rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW |
1449 | rxvt_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 | |
|
|
1469 | // nuke wide spanning the start |
|
|
1470 | if (line->t[screen.cur.col] == NOCHAR) |
|
|
1471 | scr_kill_char (*line, screen.cur.col); |
|
|
1472 | |
1468 | switch (insdel) |
1473 | switch (insdel) |
1469 | { |
1474 | { |
1470 | case INSERT: |
1475 | case INSERT: |
1471 | 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--) |
1472 | { |
1482 | { |
1473 | line->t[col] = line->t[col - count]; |
1483 | line->t[col] = line->t[col - count]; |
1474 | line->r[col] = line->r[col - count]; |
1484 | line->r[col] = line->r[col - count]; |
1475 | } |
1485 | } |
1476 | |
|
|
1477 | line->l = min (line->l + count, ncol); |
|
|
1478 | |
1486 | |
1479 | if (selection.op && current_screen == selection.screen |
1487 | if (selection.op && current_screen == selection.screen |
1480 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1488 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1481 | { |
1489 | { |
1482 | if (selection.end.row != screen.cur.row |
1490 | if (selection.end.row != screen.cur.row |
… | |
… | |
1497 | case ERASE: |
1505 | case ERASE: |
1498 | screen.cur.col += count; /* don't worry if > ncol */ |
1506 | screen.cur.col += count; /* don't worry if > ncol */ |
1499 | selection_check (1); |
1507 | selection_check (1); |
1500 | screen.cur.col -= count; |
1508 | screen.cur.col -= count; |
1501 | |
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 | |
1502 | scr_blank_line (*line, screen.cur.col, count, rstyle); |
1514 | scr_blank_line (*line, screen.cur.col, count, rstyle); |
1503 | break; |
1515 | break; |
1504 | |
1516 | |
1505 | case DELETE: |
1517 | case DELETE: |
1506 | tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); |
1518 | line->l = max (line->l - count, 0); |
1507 | |
1519 | |
|
|
1520 | // nuke wide char spanning the end |
|
|
1521 | if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR) |
|
|
1522 | scr_kill_char (*line, screen.cur.col + count); |
|
|
1523 | |
1508 | for (col = screen.cur.col; (col + count) < ncol; col++) |
1524 | for (int col = screen.cur.col; (col + count) < ncol; col++) |
1509 | { |
1525 | { |
1510 | line->t[col] = line->t[col + count]; |
1526 | line->t[col] = line->t[col + count]; |
1511 | line->r[col] = line->r[col + count]; |
1527 | line->r[col] = line->r[col + count]; |
1512 | } |
1528 | } |
1513 | |
1529 | |
1514 | line->l = max (line->l - count, 0); |
|
|
1515 | scr_blank_line (*line, ncol - count, count, tr); |
1530 | scr_blank_line (*line, ncol - count, count, |
|
|
1531 | line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask)); |
1516 | |
1532 | |
1517 | if (selection.op && current_screen == selection.screen |
1533 | if (selection.op && current_screen == selection.screen |
1518 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1534 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1519 | { |
1535 | { |
1520 | if (selection.end.row != screen.cur.row |
1536 | if (selection.end.row != screen.cur.row |