… | |
… | |
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 | |
160 | void |
160 | void |
161 | rxvt_term::scr_reset () |
161 | rxvt_term::scr_reset () |
162 | { |
162 | { |
163 | #if ENABLE_OVERLAY |
163 | scr_soft_reset (); |
164 | scr_overlay_off (); |
|
|
165 | #endif |
|
|
166 | |
164 | |
167 | rvideo_mode = false; |
|
|
168 | view_start = 0; |
165 | view_start = 0; |
169 | num_scr = 0; |
166 | num_scr = 0; |
170 | |
167 | |
171 | if (ncol == 0) |
168 | if (ncol == 0) |
172 | ncol = 80; |
169 | ncol = 80; |
… | |
… | |
174 | if (nrow == 0) |
171 | if (nrow == 0) |
175 | nrow = 24; |
172 | nrow = 24; |
176 | |
173 | |
177 | if (ncol == prev_ncol && nrow == prev_nrow) |
174 | if (ncol == prev_ncol && nrow == prev_nrow) |
178 | return; |
175 | return; |
179 | |
|
|
180 | if (current_screen != PRIMARY) |
|
|
181 | scr_swap_screen (); |
|
|
182 | |
176 | |
183 | // we need at least two lines for wrapping to work correctly |
177 | // we need at least two lines for wrapping to work correctly |
184 | while (nrow + saveLines < 2) |
178 | while (nrow + saveLines < 2) |
185 | { |
179 | { |
186 | //TODO//FIXME |
180 | //TODO//FIXME |
… | |
… | |
399 | delete old_ta; |
393 | delete old_ta; |
400 | delete old_ra; |
394 | delete old_ra; |
401 | |
395 | |
402 | clamp_it (screen.cur.row, 0, nrow - 1); |
396 | clamp_it (screen.cur.row, 0, nrow - 1); |
403 | clamp_it (screen.cur.col, 0, ncol - 1); |
397 | clamp_it (screen.cur.col, 0, ncol - 1); |
404 | |
|
|
405 | free (tabs); |
|
|
406 | } |
398 | } |
407 | |
399 | |
408 | CLEAR_ALL_SELECTION (); |
400 | CLEAR_ALL_SELECTION (); |
409 | |
401 | |
410 | prev_nrow = nrow; |
402 | prev_nrow = nrow; |
411 | prev_ncol = ncol; |
403 | 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 | |
404 | |
421 | tt_winch (); |
405 | tt_winch (); |
422 | |
406 | |
423 | HOOK_INVOKE ((this, HOOK_RESET, DT_END)); |
407 | HOOK_INVOKE ((this, HOOK_RESET, DT_END)); |
424 | } |
408 | } |
… | |
… | |
436 | delete ralloc; ralloc = 0; |
420 | delete ralloc; ralloc = 0; |
437 | |
421 | |
438 | free (row_buf); |
422 | free (row_buf); |
439 | free (swap_buf); |
423 | free (swap_buf); |
440 | free (drawn_buf); |
424 | free (drawn_buf); |
|
|
425 | row_buf = 0; // signal that we freed all the arrays above |
|
|
426 | |
441 | free (tabs); |
427 | free (tabs); |
442 | |
428 | tabs = 0; |
443 | row_buf = 0; // signal that we freed all the arrays |
|
|
444 | } |
429 | } |
445 | } |
430 | } |
446 | |
431 | |
447 | /* ------------------------------------------------------------------------- */ |
432 | /* ------------------------------------------------------------------------- */ |
448 | /* |
433 | /* |
449 | * Hard reset |
434 | * Hard/Soft reset |
450 | */ |
435 | */ |
451 | void |
436 | void |
452 | rxvt_term::scr_poweron () |
437 | rxvt_term::scr_poweron () |
453 | { |
438 | { |
454 | scr_release (); |
439 | scr_release (); |
455 | prev_nrow = prev_ncol = 0; |
440 | prev_nrow = prev_ncol = 0; |
456 | scr_reset (); |
441 | scr_reset (); |
457 | |
442 | |
458 | scr_clear (true); |
443 | scr_clear (true); |
459 | scr_refresh (); |
444 | scr_refresh (); |
|
|
445 | } |
|
|
446 | |
|
|
447 | void |
|
|
448 | rxvt_term::scr_soft_reset () |
|
|
449 | { |
|
|
450 | /* only affects modes, nothing drastic such as clearing the screen */ |
|
|
451 | #if ENABLE_OVERLAY |
|
|
452 | scr_overlay_off (); |
|
|
453 | #endif |
|
|
454 | |
|
|
455 | rvideo_mode = false; |
|
|
456 | |
|
|
457 | if (current_screen != PRIMARY) |
|
|
458 | scr_swap_screen (); |
|
|
459 | |
|
|
460 | free (tabs); |
|
|
461 | tabs = (char *)rxvt_malloc (ncol); |
|
|
462 | |
|
|
463 | for (int col = ncol; --col; ) |
|
|
464 | tabs [col] = col % TABSIZE == 0; |
|
|
465 | |
|
|
466 | scr_scroll_region (0, MAX_ROWS - 1); |
|
|
467 | scr_rendition (0, ~RS_None); |
|
|
468 | scr_insert_mode (0); |
460 | } |
469 | } |
461 | |
470 | |
462 | /* ------------------------------------------------------------------------- * |
471 | /* ------------------------------------------------------------------------- * |
463 | * PROCESS SCREEN COMMANDS * |
472 | * PROCESS SCREEN COMMANDS * |
464 | * ------------------------------------------------------------------------- */ |
473 | * ------------------------------------------------------------------------- */ |
… | |
… | |
906 | rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); |
915 | rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); |
907 | |
916 | |
908 | // if the character doesn't fit into the remaining columns... |
917 | // if the character doesn't fit into the remaining columns... |
909 | if (expect_false (screen.cur.col > ncol - width && ncol >= width)) |
918 | if (expect_false (screen.cur.col > ncol - width && ncol >= width)) |
910 | { |
919 | { |
911 | // ...output spaces |
920 | // ... artificially enlargen the previous one |
912 | c = ' '; |
921 | c = NOCHAR; |
913 | // and try the same character next loop iteration |
922 | // and try the same character next loop iteration |
914 | --str; |
923 | --str; |
915 | } |
924 | } |
916 | |
925 | |
917 | line->touch (); |
926 | line->touch (); |
… | |
… | |
1342 | { |
1351 | { |
1343 | ren = DEFAULT_RSTYLE; |
1352 | ren = DEFAULT_RSTYLE; |
1344 | |
1353 | |
1345 | if (mapped) |
1354 | if (mapped) |
1346 | XClearArea (dpy, vt, 0, |
1355 | XClearArea (dpy, vt, 0, |
1347 | Row2Pixel (row), (unsigned int)width, |
1356 | Row2Pixel (row - view_start), (unsigned int)width, |
1348 | (unsigned int)Height2Pixel (num), False); |
1357 | (unsigned int)Height2Pixel (num), False); |
1349 | } |
1358 | } |
1350 | else |
1359 | else |
1351 | { |
1360 | { |
1352 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1361 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1353 | |
1362 | |
1354 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1363 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1355 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1364 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1356 | XFillRectangle (dpy, vt, gc, |
1365 | XFillRectangle (dpy, vt, gc, |
1357 | 0, Row2Pixel (row), |
1366 | 0, Row2Pixel (row - view_start), |
1358 | (unsigned int)width, |
1367 | (unsigned int)width, |
1359 | (unsigned int)Height2Pixel (num)); |
1368 | (unsigned int)Height2Pixel (num)); |
1360 | gcvalue.foreground = pix_colors[Color_fg]; |
1369 | gcvalue.foreground = pix_colors[Color_fg]; |
1361 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1370 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1362 | } |
1371 | } |
… | |
… | |
1446 | * Insert/Delete <count> characters from the current position |
1455 | * Insert/Delete <count> characters from the current position |
1447 | */ |
1456 | */ |
1448 | void |
1457 | void |
1449 | rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW |
1458 | rxvt_term::scr_insdel_chars (int count, int insdel) NOTHROW |
1450 | { |
1459 | { |
1451 | int col, row; |
|
|
1452 | rend_t tr; |
|
|
1453 | |
|
|
1454 | want_refresh = 1; |
1460 | want_refresh = 1; |
1455 | ZERO_SCROLLBACK (); |
1461 | ZERO_SCROLLBACK (); |
1456 | |
1462 | |
1457 | if (count <= 0) |
1463 | if (count <= 0) |
1458 | return; |
1464 | return; |
… | |
… | |
1460 | scr_do_wrap (); |
1466 | scr_do_wrap (); |
1461 | |
1467 | |
1462 | selection_check (1); |
1468 | selection_check (1); |
1463 | min_it (count, ncol - screen.cur.col); |
1469 | min_it (count, ncol - screen.cur.col); |
1464 | |
1470 | |
1465 | row = screen.cur.row; |
1471 | int row = screen.cur.row; |
1466 | |
1472 | |
1467 | line_t *line = &ROW(row); |
1473 | line_t *line = &ROW(row); |
1468 | |
1474 | |
1469 | line->touch (); |
1475 | line->touch (); |
1470 | line->is_longer (0); |
1476 | line->is_longer (0); |
1471 | |
1477 | |
|
|
1478 | // nuke wide spanning the start |
|
|
1479 | if (line->t[screen.cur.col] == NOCHAR) |
|
|
1480 | scr_kill_char (*line, screen.cur.col); |
|
|
1481 | |
1472 | switch (insdel) |
1482 | switch (insdel) |
1473 | { |
1483 | { |
1474 | case INSERT: |
1484 | case INSERT: |
1475 | for (col = ncol - 1; (col - count) >= screen.cur.col; col--) |
1485 | line->l = min (line->l + count, ncol); |
|
|
1486 | |
|
|
1487 | if (line->t[screen.cur.col] == NOCHAR) |
|
|
1488 | scr_kill_char (*line, screen.cur.col); |
|
|
1489 | |
|
|
1490 | for (int col = ncol - 1; (col - count) >= screen.cur.col; col--) |
1476 | { |
1491 | { |
1477 | line->t[col] = line->t[col - count]; |
1492 | line->t[col] = line->t[col - count]; |
1478 | line->r[col] = line->r[col - count]; |
1493 | line->r[col] = line->r[col - count]; |
1479 | } |
1494 | } |
1480 | |
|
|
1481 | line->l = min (line->l + count, ncol); |
|
|
1482 | |
1495 | |
1483 | if (selection.op && current_screen == selection.screen |
1496 | if (selection.op && current_screen == selection.screen |
1484 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1497 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1485 | { |
1498 | { |
1486 | if (selection.end.row != screen.cur.row |
1499 | if (selection.end.row != screen.cur.row |
… | |
… | |
1501 | case ERASE: |
1514 | case ERASE: |
1502 | screen.cur.col += count; /* don't worry if > ncol */ |
1515 | screen.cur.col += count; /* don't worry if > ncol */ |
1503 | selection_check (1); |
1516 | selection_check (1); |
1504 | screen.cur.col -= count; |
1517 | screen.cur.col -= count; |
1505 | |
1518 | |
|
|
1519 | // nuke wide char after the end |
|
|
1520 | if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR) |
|
|
1521 | scr_kill_char (*line, screen.cur.col + count); |
|
|
1522 | |
1506 | scr_blank_line (*line, screen.cur.col, count, rstyle); |
1523 | scr_blank_line (*line, screen.cur.col, count, rstyle); |
1507 | break; |
1524 | break; |
1508 | |
1525 | |
1509 | case DELETE: |
1526 | case DELETE: |
1510 | tr = line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); |
1527 | line->l = max (line->l - count, 0); |
1511 | |
1528 | |
|
|
1529 | // nuke wide char spanning the end |
|
|
1530 | if (screen.cur.col + count < ncol && line->t[screen.cur.col + count] == NOCHAR) |
|
|
1531 | scr_kill_char (*line, screen.cur.col + count); |
|
|
1532 | |
1512 | for (col = screen.cur.col; (col + count) < ncol; col++) |
1533 | for (int col = screen.cur.col; (col + count) < ncol; col++) |
1513 | { |
1534 | { |
1514 | line->t[col] = line->t[col + count]; |
1535 | line->t[col] = line->t[col + count]; |
1515 | line->r[col] = line->r[col + count]; |
1536 | line->r[col] = line->r[col + count]; |
1516 | } |
1537 | } |
1517 | |
1538 | |
1518 | line->l = max (line->l - count, 0); |
|
|
1519 | scr_blank_line (*line, ncol - count, count, tr); |
1539 | scr_blank_line (*line, ncol - count, count, |
|
|
1540 | line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask)); |
1520 | |
1541 | |
1521 | if (selection.op && current_screen == selection.screen |
1542 | if (selection.op && current_screen == selection.screen |
1522 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1543 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1523 | { |
1544 | { |
1524 | if (selection.end.row != screen.cur.row |
1545 | if (selection.end.row != screen.cur.row |