… | |
… | |
158 | * ------------------------------------------------------------------------- */ |
158 | * ------------------------------------------------------------------------- */ |
159 | |
159 | |
160 | void |
160 | void |
161 | rxvt_term::scr_reset () |
161 | rxvt_term::scr_reset () |
162 | { |
162 | { |
163 | scr_soft_reset (); |
|
|
164 | |
|
|
165 | view_start = 0; |
163 | view_start = 0; |
166 | num_scr = 0; |
164 | num_scr = 0; |
167 | |
165 | |
168 | if (ncol == 0) |
166 | if (ncol == 0) |
169 | ncol = 80; |
167 | ncol = 80; |
… | |
… | |
280 | |
278 | |
281 | if (top_row) |
279 | if (top_row) |
282 | { |
280 | { |
283 | // Re-wrap lines. This is rather ugly, possibly because I am too dumb |
281 | // Re-wrap lines. This is rather ugly, possibly because I am too dumb |
284 | // to come up with a lean and mean algorithm. |
282 | // to come up with a lean and mean algorithm. |
|
|
283 | // TODO: maybe optimise when width didn't change |
285 | |
284 | |
286 | row_col_t ocur = screen.cur; |
285 | row_col_t ocur = screen.cur; |
287 | ocur.row = MOD (term_start + ocur.row, prev_total_rows); |
286 | ocur.row = MOD (term_start + ocur.row, prev_total_rows); |
288 | |
287 | |
289 | do |
288 | do |
… | |
… | |
395 | |
394 | |
396 | clamp_it (screen.cur.row, 0, nrow - 1); |
395 | clamp_it (screen.cur.row, 0, nrow - 1); |
397 | clamp_it (screen.cur.col, 0, ncol - 1); |
396 | clamp_it (screen.cur.col, 0, ncol - 1); |
398 | } |
397 | } |
399 | |
398 | |
|
|
399 | free (tabs); |
|
|
400 | tabs = (char *)rxvt_malloc (ncol); |
|
|
401 | |
|
|
402 | for (int col = ncol; --col; ) |
|
|
403 | tabs [col] = col % TABSIZE == 0; |
|
|
404 | |
400 | CLEAR_ALL_SELECTION (); |
405 | CLEAR_ALL_SELECTION (); |
401 | |
406 | |
402 | prev_nrow = nrow; |
407 | prev_nrow = nrow; |
403 | prev_ncol = ncol; |
408 | prev_ncol = ncol; |
404 | |
409 | |
… | |
… | |
436 | void |
441 | void |
437 | rxvt_term::scr_poweron () |
442 | rxvt_term::scr_poweron () |
438 | { |
443 | { |
439 | scr_release (); |
444 | scr_release (); |
440 | prev_nrow = prev_ncol = 0; |
445 | prev_nrow = prev_ncol = 0; |
|
|
446 | rvideo_mode = false; |
|
|
447 | scr_soft_reset (); |
441 | scr_reset (); |
448 | scr_reset (); |
442 | |
449 | |
443 | scr_clear (true); |
450 | scr_clear (true); |
444 | scr_refresh (); |
451 | scr_refresh (); |
445 | } |
452 | } |
… | |
… | |
450 | /* only affects modes, nothing drastic such as clearing the screen */ |
457 | /* only affects modes, nothing drastic such as clearing the screen */ |
451 | #if ENABLE_OVERLAY |
458 | #if ENABLE_OVERLAY |
452 | scr_overlay_off (); |
459 | scr_overlay_off (); |
453 | #endif |
460 | #endif |
454 | |
461 | |
455 | rvideo_mode = false; |
|
|
456 | |
|
|
457 | if (current_screen != PRIMARY) |
462 | if (current_screen != PRIMARY) |
458 | scr_swap_screen (); |
463 | 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 | |
464 | |
466 | scr_scroll_region (0, MAX_ROWS - 1); |
465 | scr_scroll_region (0, MAX_ROWS - 1); |
467 | scr_rendition (0, ~RS_None); |
466 | scr_rendition (0, ~RS_None); |
468 | scr_insert_mode (0); |
467 | scr_insert_mode (0); |
469 | } |
468 | } |
… | |
… | |
1342 | if (row >= nrow) /* Out Of Bounds */ |
1341 | if (row >= nrow) /* Out Of Bounds */ |
1343 | return; |
1342 | return; |
1344 | |
1343 | |
1345 | min_it (num, nrow - row); |
1344 | min_it (num, nrow - row); |
1346 | |
1345 | |
1347 | /*TODO: the xlceararea/xfillrectangle below don't take scroll offste into account, ask mikachu for details */ |
1346 | // TODO: the code below does not work when view_start != 0 |
|
|
1347 | // the workaround is to disable the clear and use a normal refresh |
|
|
1348 | // when view_start != 0. mysterious. |
1348 | if (rstyle & (RS_RVid | RS_Uline)) |
1349 | if (rstyle & (RS_RVid | RS_Uline)) |
1349 | ren = (rend_t) ~RS_None; |
1350 | ren = (rend_t) ~RS_None; |
1350 | else if (GET_BASEBG (rstyle) == Color_bg) |
1351 | else if (GET_BASEBG (rstyle) == Color_bg) |
1351 | { |
1352 | { |
1352 | ren = DEFAULT_RSTYLE; |
1353 | ren = DEFAULT_RSTYLE; |
1353 | |
1354 | |
1354 | if (mapped) |
1355 | if (mapped && !view_start) |
1355 | XClearArea (dpy, vt, 0, |
1356 | XClearArea (dpy, vt, 0, |
1356 | Row2Pixel (row - view_start), (unsigned int)width, |
1357 | Row2Pixel (row - view_start), (unsigned int)width, |
1357 | (unsigned int)Height2Pixel (num), False); |
1358 | (unsigned int)Height2Pixel (num), False); |
1358 | } |
1359 | } |
1359 | else |
1360 | else |
1360 | { |
1361 | { |
1361 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1362 | ren = rstyle & (RS_fgMask | RS_bgMask); |
1362 | |
1363 | |
|
|
1364 | if (mapped && !view_start) |
|
|
1365 | { |
1363 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1366 | gcvalue.foreground = pix_colors[bgcolor_of (rstyle)]; |
1364 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1367 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1365 | XFillRectangle (dpy, vt, gc, |
1368 | XFillRectangle (dpy, vt, gc, |
1366 | 0, Row2Pixel (row - view_start), |
1369 | 0, Row2Pixel (row - view_start), |
1367 | (unsigned int)width, |
1370 | (unsigned int)width, |
1368 | (unsigned int)Height2Pixel (num)); |
1371 | (unsigned int)Height2Pixel (num)); |
1369 | gcvalue.foreground = pix_colors[Color_fg]; |
1372 | gcvalue.foreground = pix_colors[Color_fg]; |
1370 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
1373 | XChangeGC (dpy, gc, GCForeground, &gcvalue); |
|
|
1374 | } |
1371 | } |
1375 | } |
1372 | |
1376 | |
1373 | for (; num--; row++) |
1377 | for (; num--; row++) |
1374 | { |
1378 | { |
1375 | scr_blank_screen_mem (ROW(row), rstyle); |
1379 | scr_blank_screen_mem (ROW(row), rstyle); |
|
|
1380 | |
|
|
1381 | if (!view_start) |
1376 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1382 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1377 | } |
1383 | } |
1378 | } |
1384 | } |
1379 | |
1385 | |
1380 | #if !ENABLE_MINIMAL |
1386 | #if !ENABLE_MINIMAL |
1381 | void |
1387 | void |
… | |
… | |
1534 | { |
1540 | { |
1535 | line->t[col] = line->t[col + count]; |
1541 | line->t[col] = line->t[col + count]; |
1536 | line->r[col] = line->r[col + count]; |
1542 | line->r[col] = line->r[col + count]; |
1537 | } |
1543 | } |
1538 | |
1544 | |
1539 | scr_blank_line (*line, ncol - count, count, |
1545 | scr_blank_line (*line, ncol - count, count, rstyle); |
1540 | line->r[ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask)); |
|
|
1541 | |
1546 | |
1542 | if (selection.op && current_screen == selection.screen |
1547 | if (selection.op && current_screen == selection.screen |
1543 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1548 | && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)) |
1544 | { |
1549 | { |
1545 | if (selection.end.row != screen.cur.row |
1550 | if (selection.end.row != screen.cur.row |