… | |
… | |
239 | { |
239 | { |
240 | /* |
240 | /* |
241 | * add or delete rows as appropriate |
241 | * add or delete rows as appropriate |
242 | */ |
242 | */ |
243 | |
243 | |
244 | printf ("resize %d:%d => %d:%d\n", prev_nrow, prev_ncol, nrow, ncol);//D |
|
|
245 | |
|
|
246 | rxvt_salloc *old_ta = talloc; talloc = new rxvt_salloc (ncol * sizeof (text_t)); |
244 | rxvt_salloc *old_ta = talloc; talloc = new rxvt_salloc (ncol * sizeof (text_t)); |
247 | rxvt_salloc *old_ra = ralloc; ralloc = new rxvt_salloc (ncol * sizeof (rend_t)); |
245 | rxvt_salloc *old_ra = ralloc; ralloc = new rxvt_salloc (ncol * sizeof (rend_t)); |
248 | |
246 | |
249 | #if 0 |
247 | #if 0 |
250 | if (nrow < prev_nrow) |
248 | if (nrow < prev_nrow) |
… | |
… | |
255 | lfree (drawn_buf[row]); |
253 | lfree (drawn_buf[row]); |
256 | } |
254 | } |
257 | } |
255 | } |
258 | #endif |
256 | #endif |
259 | |
257 | |
260 | drawn_buf = (line_t *) rxvt_realloc (drawn_buf, nrow * sizeof (line_t)); |
258 | drawn_buf = (line_t *)rxvt_realloc (drawn_buf, nrow * sizeof (line_t)); |
261 | temp_buf = (line_t *) rxvt_realloc (temp_buf , nrow * sizeof (line_t)); |
259 | temp_buf = (line_t *)rxvt_realloc (temp_buf , nrow * sizeof (line_t)); |
262 | swap_buf = (line_t *) rxvt_realloc (swap_buf , nrow * sizeof (line_t)); |
260 | swap_buf = (line_t *)rxvt_realloc (swap_buf , nrow * sizeof (line_t)); |
263 | |
261 | |
264 | for (int row = min (nrow, prev_nrow); row--; ) |
262 | for (int row = min (nrow, prev_nrow); row--; ) |
265 | { |
263 | { |
266 | lresize (drawn_buf[row]); |
264 | lresize (drawn_buf[row]); |
267 | lresize (swap_buf [row]); |
265 | lresize (swap_buf [row]); |
… | |
… | |
273 | drawn_buf[row].clear (); scr_blank_screen_mem (drawn_buf[row], DEFAULT_RSTYLE); |
271 | drawn_buf[row].clear (); scr_blank_screen_mem (drawn_buf[row], DEFAULT_RSTYLE); |
274 | } |
272 | } |
275 | |
273 | |
276 | line_t *old_buf = row_buf; row_buf = (line_t *)rxvt_calloc (total_rows, sizeof (line_t)); |
274 | line_t *old_buf = row_buf; row_buf = (line_t *)rxvt_calloc (total_rows, sizeof (line_t)); |
277 | |
275 | |
278 | // re-wrap lines, this is rather ugly, possibly because I am too dumb |
|
|
279 | // to come up with a lean and mean algorithm. |
|
|
280 | |
|
|
281 | int p = MOD (term_start + nrow , prev_total_rows); // previous row |
276 | int p = MOD (term_start + prev_nrow, prev_total_rows); // previous row |
282 | int pend = MOD (term_start - nsaved, prev_total_rows); |
277 | int pend = MOD (term_start - nsaved , prev_total_rows); |
283 | int q = total_rows; // rewrapped row |
278 | int q = total_rows; // rewrapped row |
284 | |
279 | |
285 | while (p != pend && q > 0) |
280 | if (nsaved) |
|
|
281 | { |
|
|
282 | // re-wrap lines, this is rather ugly, possibly because I am too dumb |
|
|
283 | // to come up with a lean and mean algorithm. |
|
|
284 | |
|
|
285 | row_col_t ocur = screen.cur; |
|
|
286 | ocur.row = MOD (term_start + ocur.row, prev_total_rows); |
|
|
287 | |
286 | { |
288 | do |
287 | p = MOD (p - 1, prev_total_rows); |
|
|
288 | |
|
|
289 | assert (old_buf [MOD (p, prev_total_rows)].t); |
|
|
290 | assert (!old_buf [MOD (p, prev_total_rows)].is_longer ()); |
|
|
291 | |
|
|
292 | int llen = old_buf [MOD (p, prev_total_rows)].l; |
|
|
293 | |
|
|
294 | while (p != pend && old_buf [MOD (p - 1, prev_total_rows)].is_longer ()) |
|
|
295 | { |
289 | { |
296 | p = MOD (p - 1, prev_total_rows); |
290 | p = MOD (p - 1, prev_total_rows); |
|
|
291 | #ifdef DEBUG_STRICT |
|
|
292 | assert (old_buf [MOD (p, prev_total_rows)].t); |
|
|
293 | #endif |
297 | |
294 | |
298 | llen += prev_ncol; |
|
|
299 | } |
|
|
300 | |
|
|
301 | int qlines = llen / ncol + 1; |
|
|
302 | int lofs = 0; |
295 | int plines = 1; |
|
|
296 | int llen = old_buf [MOD (p, prev_total_rows)].l; |
303 | |
297 | |
304 | q -= qlines; |
298 | while (p != pend && old_buf [MOD (p - 1, prev_total_rows)].is_longer ()) |
305 | |
|
|
306 | int qrow = q; |
|
|
307 | |
|
|
308 | for (; qlines--; qrow++) |
|
|
309 | { |
|
|
310 | if (qrow >= 0) |
|
|
311 | { |
299 | { |
|
|
300 | p = MOD (p - 1, prev_total_rows); |
|
|
301 | |
|
|
302 | plines++; |
|
|
303 | llen += prev_ncol; |
|
|
304 | } |
|
|
305 | |
|
|
306 | int qlines = max (0, (llen - 1) / ncol) + 1; |
|
|
307 | |
|
|
308 | // drop partial lines completely |
|
|
309 | if (q < qlines) |
|
|
310 | break; |
|
|
311 | |
|
|
312 | q -= qlines; |
|
|
313 | |
|
|
314 | int lofs = 0; |
|
|
315 | line_t *qline; |
|
|
316 | |
|
|
317 | // re-assemble the full line by destination lines |
|
|
318 | for (int qrow = q; qlines--; qrow++) |
|
|
319 | { |
312 | line_t &qline = row_buf [qrow]; |
320 | qline = row_buf + qrow; |
313 | |
|
|
314 | lalloc (qline); |
321 | lalloc (*qline); |
315 | qline.set_is_longer (); |
322 | qline->set_is_longer (); |
316 | |
323 | |
317 | int qcol = 0; |
324 | int qcol = 0; |
318 | |
325 | |
319 | for (;;) |
326 | // fill a single destination line |
|
|
327 | while (lofs < llen && qcol < ncol) |
320 | { |
328 | { |
321 | int prow = lofs / prev_ncol + p; |
329 | int prow = lofs / prev_ncol; |
322 | int pcol = lofs % prev_ncol; |
330 | int pcol = lofs % prev_ncol; |
323 | |
331 | |
|
|
332 | prow = MOD (p + prow, prev_total_rows); |
|
|
333 | |
|
|
334 | // we only adjust the cursor _row_ and put it into |
|
|
335 | // the topmost line of "long line" it was in, as |
|
|
336 | // this seems to upset applications/shells/readline |
|
|
337 | // least. |
|
|
338 | if (prow == ocur.row) |
|
|
339 | screen.cur.row = q - (total_rows - nrow); |
|
|
340 | |
324 | line_t &pline = old_buf [p]; |
341 | line_t &pline = old_buf [prow]; |
325 | |
342 | |
326 | int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); |
343 | int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); |
327 | |
344 | |
328 | printf ("q %d lofs %d>%d len %d pq %d:%d p %d:%d q :%d\n", q, llen, lofs, len, prev_ncol, ncol, prow, pcol, qcol); |
|
|
329 | |
|
|
330 | if (len <= 0) |
|
|
331 | { |
|
|
332 | qline.l = qcol; |
|
|
333 | scr_blank_line (qline, qcol, ncol - qcol, DEFAULT_RSTYLE); |
|
|
334 | break; |
|
|
335 | } |
|
|
336 | |
|
|
337 | assert (lofs < 1000); |
345 | assert (len); |
|
|
346 | assert (pline.t); |
338 | |
347 | |
339 | memcpy (qline.t + qcol, pline.t + pcol, len * sizeof (text_t)); |
348 | memcpy (qline->t + qcol, pline.t + pcol, len * sizeof (text_t)); |
340 | memcpy (qline.r + qcol, pline.r + pcol, len * sizeof (rend_t)); |
349 | memcpy (qline->r + qcol, pline.r + pcol, len * sizeof (rend_t)); |
341 | |
350 | |
342 | lofs += len; |
351 | lofs += len; |
343 | qcol += len; |
352 | qcol += len; |
344 | |
|
|
345 | if (qcol == ncol) |
|
|
346 | break; |
|
|
347 | } |
353 | } |
348 | } |
354 | } |
|
|
355 | |
|
|
356 | qline->l = llen ? MOD (llen - 1, ncol) + 1 : 0; |
|
|
357 | #ifdef DEBUG_STRICT //TODO//FIXME//TEMPORARY |
|
|
358 | if (qline->l < 0) |
349 | else |
359 | { |
350 | lofs += ncol; |
360 | fprintf (stderr, "ERROR, PLEASE REPORT to rxvt-unicode@plan9.de: qline->l %d = llen %d < ncol %d ? %d : MOD %d\n", qline->l,llen,ncol,llen,MOD (llen - 1, ncol) + 1);//D |
|
|
361 | qline->l = 0; |
|
|
362 | } |
|
|
363 | #endif |
|
|
364 | scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); |
351 | } |
365 | } |
|
|
366 | while (p != pend && q > 0); |
|
|
367 | |
|
|
368 | term_start = total_rows - nrow; |
|
|
369 | nsaved = term_start - q; |
|
|
370 | |
|
|
371 | // make sure all terminal lines exist |
|
|
372 | while (nsaved < 0) |
|
|
373 | scr_blank_screen_mem (ROW (-++nsaved), DEFAULT_RSTYLE); |
|
|
374 | |
|
|
375 | } |
|
|
376 | else |
352 | } |
377 | { |
|
|
378 | // if no scrollback exists (yet), wing, instead of wrap |
|
|
379 | |
|
|
380 | for (int row = min (nrow, prev_nrow); row--; ) |
|
|
381 | { |
|
|
382 | line_t &pline = old_buf [MOD (term_start + row, prev_total_rows)]; |
|
|
383 | line_t &qline = row_buf [row]; |
|
|
384 | |
|
|
385 | qline = pline; |
|
|
386 | lresize (qline); |
|
|
387 | } |
|
|
388 | |
|
|
389 | for (int row = prev_nrow; row < nrow; row++) |
|
|
390 | { |
|
|
391 | row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
|
|
392 | } |
|
|
393 | |
|
|
394 | term_start = 0; |
|
|
395 | } |
|
|
396 | |
|
|
397 | #ifdef DEBUG_STRICT //TODO: remove |
|
|
398 | for (int i = -nsaved; i < nrow; i++) |
|
|
399 | assert (ROW (i).t); |
|
|
400 | #endif |
353 | |
401 | |
354 | free (old_buf); |
402 | free (old_buf); |
355 | delete old_ta; |
403 | delete old_ta; |
356 | delete old_ra; |
404 | delete old_ra; |
357 | |
405 | |
358 | min_it (screen.cur.row, nrow - 1); |
406 | clamp_it (screen.cur.row, 0, nrow - 1); |
359 | min_it (screen.cur.col, ncol - 1); |
407 | clamp_it (screen.cur.col, 0, ncol - 1); |
360 | |
408 | |
361 | if (tabs) |
409 | if (tabs) |
362 | free (tabs); |
410 | free (tabs); |
363 | } |
411 | } |
364 | |
412 | |
… | |
… | |
386 | free (row_buf); |
434 | free (row_buf); |
387 | free (swap_buf); |
435 | free (swap_buf); |
388 | free (drawn_buf); |
436 | free (drawn_buf); |
389 | free (temp_buf); |
437 | free (temp_buf); |
390 | free (tabs); |
438 | free (tabs); |
|
|
439 | |
|
|
440 | row_buf = 0; // signal that we freed all the arrays |
391 | } |
441 | } |
392 | |
442 | |
393 | /* ------------------------------------------------------------------------- */ |
443 | /* ------------------------------------------------------------------------- */ |
394 | /* |
444 | /* |
395 | * Hard reset |
445 | * Hard reset |
… | |
… | |
451 | min_it (s->cur.row, nrow - 1); |
501 | min_it (s->cur.row, nrow - 1); |
452 | min_it (s->cur.col, ncol - 1); |
502 | min_it (s->cur.col, ncol - 1); |
453 | #ifdef DEBUG_STRICT |
503 | #ifdef DEBUG_STRICT |
454 | assert (s->cur.row >= 0); |
504 | assert (s->cur.row >= 0); |
455 | assert (s->cur.col >= 0); |
505 | assert (s->cur.col >= 0); |
456 | #else /* drive with your eyes closed */ |
|
|
457 | max_it (s->cur.row, 0); |
|
|
458 | max_it (s->cur.col, 0); |
|
|
459 | #endif |
506 | #endif |
460 | } |
507 | } |
461 | |
508 | |
462 | /* ------------------------------------------------------------------------- */ |
509 | /* ------------------------------------------------------------------------- */ |
463 | /* |
510 | /* |
… | |
… | |
487 | #if NSCREENS |
534 | #if NSCREENS |
488 | if (options & Opt_secondaryScreen) |
535 | if (options & Opt_secondaryScreen) |
489 | { |
536 | { |
490 | num_scr = 0; |
537 | num_scr = 0; |
491 | |
538 | |
492 | for (int i = nrow; i--; ) |
539 | for (int i = prev_nrow; i--; ) |
493 | ::swap (ROW(i), swap_buf [i]); |
540 | ::swap (ROW(i), swap_buf [i]); |
494 | |
541 | |
495 | ::swap (screen.charset, swap.charset); |
542 | ::swap (screen.charset, swap.charset); |
496 | ::swap (screen.flags, swap.flags); |
543 | ::swap (screen.flags, swap.flags); |
497 | screen.flags |= Screen_VisibleCursor; |
544 | screen.flags |= Screen_VisibleCursor; |
… | |
… | |
580 | { |
627 | { |
581 | selection.beg.row -= count; |
628 | selection.beg.row -= count; |
582 | selection.end.row -= count; |
629 | selection.end.row -= count; |
583 | selection.mark.row -= count; |
630 | selection.mark.row -= count; |
584 | |
631 | |
585 | selection_check (0); |
632 | if (selection.beg.row < -nsaved |
|
|
633 | || selection.end.row < -nsaved |
|
|
634 | || selection.mark.row < -nsaved) |
|
|
635 | { |
|
|
636 | CLEAR_ALL_SELECTION (); |
|
|
637 | selection.op = SELECTION_CLEAR; |
|
|
638 | } |
586 | } |
639 | } |
587 | |
640 | |
588 | for (int i = count; i--; ) |
641 | for (int i = count; i--; ) |
|
|
642 | { |
|
|
643 | ROW(row2 - i).l = 0; |
589 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
644 | scr_blank_screen_mem (ROW(row2 - i), rstyle); |
|
|
645 | } |
590 | |
646 | |
591 | if ((options & Opt_scrollWithBuffer) |
647 | if ((options & Opt_scrollWithBuffer) |
592 | && view_start != 0 |
648 | && view_start != 0 |
593 | && view_start != saveLines) |
649 | && view_start != saveLines) |
594 | scr_page (UP, count); |
650 | scr_page (UP, count); |
595 | } |
651 | } |
596 | else |
652 | else |
597 | { |
653 | { |
598 | if (selection.op && current_screen == selection.screen) |
654 | if (selection.op && current_screen == selection.screen) |
599 | { |
655 | { |
600 | int i = selection.beg.row; |
656 | if ((selection.beg.row < row1 && selection.end.row > row1) |
601 | int j = selection.end.row; |
657 | || (selection.beg.row < row2 && selection.end.row > row2) |
602 | |
|
|
603 | if ((i < row1 && j > row1) |
|
|
604 | || (i < row2 && j > row2) |
|
|
605 | || (i - count < row1 && i >= row1) |
658 | || (selection.beg.row - count < row1 && selection.beg.row >= row1) |
606 | || (i - count > row2 && i <= row2) |
659 | || (selection.beg.row - count > row2 && selection.beg.row <= row2) |
607 | || (j - count < row1 && j >= row1) |
660 | || (selection.end.row - count < row1 && selection.end.row >= row1) |
608 | || (j - count > row2 && j <= row2)) |
661 | || (selection.end.row - count > row2 && selection.end.row <= row2)) |
609 | { |
662 | { |
610 | CLEAR_ALL_SELECTION (); |
663 | CLEAR_ALL_SELECTION (); |
611 | selection.op = SELECTION_CLEAR; /* XXX: too aggressive? */ |
664 | selection.op = SELECTION_CLEAR; |
612 | } |
665 | } |
613 | else if (j >= row1 && j <= row2) |
666 | else if (selection.end.row >= row1 && selection.end.row <= row2) |
614 | { |
667 | { |
615 | /* move selected region too */ |
668 | /* move selected region too */ |
616 | selection.beg.row -= count; |
669 | selection.beg.row -= count; |
617 | selection.end.row -= count; |
670 | selection.end.row -= count; |
618 | selection.mark.row -= count; |
671 | selection.mark.row -= count; |
… | |
… | |
653 | if (len <= 0) /* sanity */ |
706 | if (len <= 0) /* sanity */ |
654 | return; |
707 | return; |
655 | |
708 | |
656 | unsigned char checksel; |
709 | unsigned char checksel; |
657 | unicode_t c; |
710 | unicode_t c; |
658 | int row, last_col; |
711 | int last_col; |
659 | const unicode_t *strend = str + len; |
712 | const unicode_t *strend = str + len; |
660 | |
713 | |
661 | want_refresh = 1; |
714 | want_refresh = 1; |
662 | ZERO_SCROLLBACK (); |
715 | ZERO_SCROLLBACK (); |
663 | last_col = ncol; |
716 | last_col = ncol; |
… | |
… | |
677 | |
730 | |
678 | #ifdef DEBUG_STRICT |
731 | #ifdef DEBUG_STRICT |
679 | assert (screen.cur.col < last_col); |
732 | assert (screen.cur.col < last_col); |
680 | assert (screen.cur.row < nrow |
733 | assert (screen.cur.row < nrow |
681 | && screen.cur.row >= -nsaved); |
734 | && screen.cur.row >= -nsaved); |
682 | #else /* drive with your eyes closed */ |
|
|
683 | min_it (screen.cur.col, last_col - 1); |
|
|
684 | clamp_it (screen.cur.row, -nsaved, nrow - 1); |
|
|
685 | #endif |
735 | #endif |
686 | row = screen.cur.row; |
736 | int row = screen.cur.row; |
687 | |
737 | |
688 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
738 | checksel = selection.op && current_screen == selection.screen ? 1 : 0; |
689 | |
739 | |
690 | line_t *line = &ROW(row); |
740 | line_t *line = &ROW(row); |
691 | |
741 | |
… | |
… | |
693 | { |
743 | { |
694 | c = *str++; |
744 | c = *str++; |
695 | |
745 | |
696 | if (c < 0x20) |
746 | if (c < 0x20) |
697 | if (c == C0_LF) |
747 | if (c == C0_LF) |
698 | { |
748 | { |
699 | if (!line->is_longer ()) /* XXX: think about this */ |
749 | if (!line->is_longer ()) /* XXX: think about this */ |
700 | max_it (line->l, screen.cur.col); |
750 | max_it (line->l, screen.cur.col); |
701 | |
751 | |
702 | screen.flags &= ~Screen_WrapNext; |
752 | screen.flags &= ~Screen_WrapNext; |
703 | |
753 | |
… | |
… | |
900 | if (!line->is_longer ()) /* XXX: think about this */ |
950 | if (!line->is_longer ()) /* XXX: think about this */ |
901 | max_it (line->l, screen.cur.col); |
951 | max_it (line->l, screen.cur.col); |
902 | |
952 | |
903 | #ifdef DEBUG_STRICT |
953 | #ifdef DEBUG_STRICT |
904 | assert (screen.cur.row >= 0); |
954 | assert (screen.cur.row >= 0); |
905 | #else /* drive with your eyes closed */ |
|
|
906 | max_it (screen.cur.row, 0); |
|
|
907 | #endif |
955 | #endif |
908 | } |
956 | } |
909 | |
957 | |
910 | /* ------------------------------------------------------------------------- */ |
958 | /* ------------------------------------------------------------------------- */ |
911 | /* |
959 | /* |
… | |
… | |
950 | |
998 | |
951 | if (count == 0) |
999 | if (count == 0) |
952 | return; |
1000 | return; |
953 | else if (count > 0) |
1001 | else if (count > 0) |
954 | { |
1002 | { |
955 | int row = screen.cur.row; |
|
|
956 | |
|
|
957 | line_t &l = ROW(row); |
1003 | line_t &l = ROW(screen.cur.row); |
958 | rend_t base_rend = l.r[i]; |
1004 | rend_t base_rend = l.r[i]; |
959 | ht &= l.t[i] == ' '; |
1005 | ht &= l.t[i] == ' '; |
960 | |
1006 | |
961 | for (; ++i < ncol; ) |
1007 | for (; ++i < ncol; ) |
962 | if (tabs[i]) |
1008 | if (tabs[i]) |
… | |
… | |
1037 | */ |
1083 | */ |
1038 | #if ENABLE_FRILLS |
1084 | #if ENABLE_FRILLS |
1039 | void |
1085 | void |
1040 | rxvt_term::scr_forwardindex () |
1086 | rxvt_term::scr_forwardindex () |
1041 | { |
1087 | { |
1042 | int row; |
|
|
1043 | |
|
|
1044 | if (screen.cur.col < ncol - 1) |
1088 | if (screen.cur.col < ncol - 1) |
1045 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1089 | scr_gotorc (0, 1, R_RELATIVE | C_RELATIVE); |
1046 | else |
1090 | else |
1047 | { |
1091 | { |
1048 | row = screen.cur.row; |
|
|
1049 | |
|
|
1050 | if (ROW(row).is_longer ()) //TODO//FIXME//LEN |
1092 | if (ROW(screen.cur.row).is_longer ()) //TODO//FIXME//LEN |
1051 | ROW(row).l = ncol; |
1093 | ROW(screen.cur.row).l = ncol; |
1052 | |
1094 | |
1053 | scr_gotorc (0, 0, R_RELATIVE); |
1095 | scr_gotorc (0, 0, R_RELATIVE); |
1054 | scr_insdel_chars (1, DELETE); |
1096 | scr_insdel_chars (1, DELETE); |
1055 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1097 | scr_gotorc (0, ncol - 1, R_RELATIVE); |
1056 | } |
1098 | } |
… | |
… | |
1139 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1181 | * XTERM_SEQ: Clear whole line : ESC [ 2 K |
1140 | */ |
1182 | */ |
1141 | void |
1183 | void |
1142 | rxvt_term::scr_erase_line (int mode) |
1184 | rxvt_term::scr_erase_line (int mode) |
1143 | { |
1185 | { |
1144 | unsigned int row, col, num; |
1186 | unsigned int col, num; |
1145 | |
1187 | |
1146 | want_refresh = 1; |
1188 | want_refresh = 1; |
1147 | ZERO_SCROLLBACK (); |
1189 | ZERO_SCROLLBACK (); |
1148 | |
1190 | |
1149 | selection_check (1); |
1191 | selection_check (1); |
1150 | |
1192 | |
1151 | row = screen.cur.row; |
1193 | line_t &line = ROW(screen.cur.row); |
1152 | |
1194 | |
1153 | switch (mode) |
1195 | switch (mode) |
1154 | { |
1196 | { |
1155 | case 0: /* erase to end of line */ |
1197 | case 0: /* erase to end of line */ |
1156 | col = screen.cur.col; |
1198 | col = screen.cur.col; |
1157 | num = ncol - col; |
1199 | num = ncol - col; |
1158 | min_it (ROW(row).l, col); |
1200 | min_it (line.l, col); |
1159 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1201 | if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur) |
1160 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1202 | || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur)) |
1161 | CLEAR_SELECTION (); |
1203 | CLEAR_SELECTION (); |
1162 | break; |
1204 | break; |
1163 | case 1: /* erase to beginning of line */ |
1205 | case 1: /* erase to beginning of line */ |
… | |
… | |
1168 | CLEAR_SELECTION (); |
1210 | CLEAR_SELECTION (); |
1169 | break; |
1211 | break; |
1170 | case 2: /* erase whole line */ |
1212 | case 2: /* erase whole line */ |
1171 | col = 0; |
1213 | col = 0; |
1172 | num = ncol; |
1214 | num = ncol; |
1173 | ROW(row).l = 0; |
1215 | line.l = 0; |
1174 | if (selection.beg.row <= screen.cur.row |
1216 | if (selection.beg.row <= screen.cur.row |
1175 | && selection.end.row >= screen.cur.row) |
1217 | && selection.end.row >= screen.cur.row) |
1176 | CLEAR_SELECTION (); |
1218 | CLEAR_SELECTION (); |
1177 | break; |
1219 | break; |
1178 | default: |
1220 | default: |
1179 | return; |
1221 | return; |
1180 | } |
1222 | } |
1181 | |
1223 | |
1182 | scr_blank_line (ROW(row), col, num, rstyle); |
1224 | scr_blank_line (line, col, num, rstyle); |
1183 | } |
1225 | } |
1184 | |
1226 | |
1185 | /* ------------------------------------------------------------------------- */ |
1227 | /* ------------------------------------------------------------------------- */ |
1186 | /* |
1228 | /* |
1187 | * Erase part of whole of the screen |
1229 | * Erase part of whole of the screen |
… | |
… | |
1251 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1293 | XChangeGC (display->display, gc, GCForeground, &gcvalue); |
1252 | } |
1294 | } |
1253 | |
1295 | |
1254 | for (; num--; row++) |
1296 | for (; num--; row++) |
1255 | { |
1297 | { |
|
|
1298 | ROW (row).l = 0; |
1256 | scr_blank_screen_mem (ROW (row), rstyle); |
1299 | scr_blank_screen_mem (ROW (row), rstyle); |
1257 | ROW (row).l = 0; |
|
|
1258 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1300 | scr_blank_line (drawn_buf [row], 0, ncol, ren); |
1259 | } |
1301 | } |
1260 | } |
1302 | } |
1261 | |
1303 | |
1262 | #if ENABLE_FRILLS |
1304 | #if ENABLE_FRILLS |
… | |
… | |
1691 | y = 0; |
1733 | y = 0; |
1692 | eheight = height; |
1734 | eheight = height; |
1693 | } |
1735 | } |
1694 | #endif |
1736 | #endif |
1695 | |
1737 | |
1696 | #ifdef DEBUG_STRICT |
|
|
1697 | #if 0 |
|
|
1698 | // that's not debugging //TODO //FIXME |
|
|
1699 | clamp_it (x, 0, width); |
|
|
1700 | clamp_it (y, 0, height); |
|
|
1701 | #endif |
|
|
1702 | #endif |
|
|
1703 | |
|
|
1704 | /* round down */ |
1738 | /* round down */ |
1705 | rc[PART_BEG].col = Pixel2Col (x); |
1739 | rc[PART_BEG].col = Pixel2Col (x); |
1706 | rc[PART_BEG].row = Pixel2Row (y); |
1740 | rc[PART_BEG].row = Pixel2Row (y); |
1707 | /* round up */ |
1741 | /* round up */ |
1708 | rc[PART_END].col = Pixel2Width (x + ewidth + fwidth - 1); |
1742 | rc[PART_END].col = Pixel2Width (x + ewidth + fwidth - 1); |
… | |
… | |
2156 | * Determine the attributes for the string |
2190 | * Determine the attributes for the string |
2157 | */ |
2191 | */ |
2158 | int fore = GET_FGCOLOR (rend); // desired foreground |
2192 | int fore = GET_FGCOLOR (rend); // desired foreground |
2159 | int back = GET_BGCOLOR (rend); // desired background |
2193 | int back = GET_BGCOLOR (rend); // desired background |
2160 | |
2194 | |
2161 | // only do special processing if any attributes are set, which is rare |
2195 | // only do special processing if any attributes are set, which is unlikely |
2162 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2196 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2163 | { |
2197 | { |
2164 | #if ENABLE_STYLES |
2198 | #if ENABLE_STYLES |
2165 | // force redraw after "careful" characters to avoid pixel droppings |
2199 | // force redraw after "careful" characters to avoid pixel droppings |
2166 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
2200 | if (srp[col] & RS_Careful && col < ncol - 1 && 0) |
… | |
… | |
2428 | row = selection.beg.row; |
2462 | row = selection.beg.row; |
2429 | } |
2463 | } |
2430 | else |
2464 | else |
2431 | { |
2465 | { |
2432 | col = 0; |
2466 | col = 0; |
2433 | row = view_start; |
2467 | row = -view_start; |
2434 | } |
2468 | } |
2435 | |
2469 | |
2436 | for (; row < min (selection.end.row, view_end); row++, col = 0) |
2470 | for (; row < min (selection.end.row, view_end); row++, col = 0) |
2437 | for (rend_t *srp = ROW(row).r; col < ncol; col++) |
2471 | for (rend_t *srp = ROW(row).r; col < ncol; col++) |
2438 | srp[col] ^= RS_RVid; |
2472 | srp[col] ^= RS_RVid; |
… | |
… | |
3642 | for (int y = ov_h; y--; ) |
3676 | for (int y = ov_h; y--; ) |
3643 | { |
3677 | { |
3644 | text_t *t1 = ov_text[y]; |
3678 | text_t *t1 = ov_text[y]; |
3645 | rend_t *r1 = ov_rend[y]; |
3679 | rend_t *r1 = ov_rend[y]; |
3646 | |
3680 | |
3647 | text_t *t2 = ROW(y - view_start).t + ov_x; |
3681 | text_t *t2 = ROW(y + ov_y - view_start).t + ov_x; |
3648 | rend_t *r2 = ROW(y - view_start).r + ov_x; |
3682 | rend_t *r2 = ROW(y + ov_y - view_start).r + ov_x; |
3649 | |
3683 | |
3650 | for (int x = ov_w; x--; ) |
3684 | for (int x = ov_w; x--; ) |
3651 | { |
3685 | { |
3652 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3686 | text_t t = *t1; *t1++ = *t2; *t2++ = t; |
3653 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |
3687 | rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t)); |