… | |
… | |
239 | CLEAR_ALL_SELECTION (); |
239 | CLEAR_ALL_SELECTION (); |
240 | rvideo = 0; |
240 | rvideo = 0; |
241 | } |
241 | } |
242 | else |
242 | else |
243 | { |
243 | { |
|
|
244 | CLEAR_ALL_SELECTION (); |
|
|
245 | |
244 | /* |
246 | /* |
245 | * add or delete rows as appropriate |
247 | * add or delete rows as appropriate |
246 | */ |
248 | */ |
247 | |
249 | |
248 | rxvt_salloc *old_ta = talloc; talloc = new rxvt_salloc (ncol * sizeof (text_t)); |
250 | rxvt_salloc *old_ta = talloc; talloc = new rxvt_salloc (ncol * sizeof (text_t)); |
… | |
… | |
325 | qline->l = ncol; |
327 | qline->l = ncol; |
326 | qline->is_longer (1); |
328 | qline->is_longer (1); |
327 | |
329 | |
328 | int qcol = 0; |
330 | int qcol = 0; |
329 | |
331 | |
|
|
332 | // see below for cursor adjustment rationale |
|
|
333 | if (p == ocur.row) |
|
|
334 | screen.cur.row = q - (total_rows - nrow); |
|
|
335 | |
330 | // fill a single destination line |
336 | // fill a single destination line |
331 | while (lofs < llen && qcol < ncol) |
337 | while (lofs < llen && qcol < ncol) |
332 | { |
338 | { |
333 | int prow = lofs / prev_ncol; |
339 | int prow = lofs / prev_ncol; |
334 | int pcol = lofs % prev_ncol; |
340 | int pcol = lofs % prev_ncol; |
… | |
… | |
388 | row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
394 | row_buf [row].clear (); scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE); |
389 | } |
395 | } |
390 | |
396 | |
391 | term_start = 0; |
397 | term_start = 0; |
392 | } |
398 | } |
393 | |
|
|
394 | #ifdef DEBUG_STRICT //TODO: remove |
|
|
395 | for (int i = top_row; i < nrow; i++) |
|
|
396 | assert (ROW (i).t); |
|
|
397 | #endif |
|
|
398 | |
399 | |
399 | free (old_buf); |
400 | free (old_buf); |
400 | delete old_ta; |
401 | delete old_ta; |
401 | delete old_ra; |
402 | delete old_ra; |
402 | |
403 | |
… | |
… | |
620 | top_row = max (top_row - count, -saveLines); |
621 | top_row = max (top_row - count, -saveLines); |
621 | |
622 | |
622 | // scroll everything up 'count' lines |
623 | // scroll everything up 'count' lines |
623 | term_start = (term_start + count) % total_rows; |
624 | term_start = (term_start + count) % total_rows; |
624 | |
625 | |
|
|
626 | // sever bottommost line |
625 | { |
627 | { |
626 | // severe bottommost scrolled line |
|
|
627 | line_t &l = ROW(row2 - count); |
628 | line_t &l = ROW(row2 - count); |
|
|
629 | l.is_longer (0); |
628 | l.touch (); |
630 | l.touch (); |
629 | l.is_longer (0); |
|
|
630 | } |
631 | } |
631 | |
632 | |
632 | // erase newly scorlled-in lines |
633 | // erase newly scrolled-in lines |
633 | for (int i = count; i; --i ) |
634 | for (int i = count; i--; ) |
634 | { |
635 | { |
635 | // basically this is a slightly optimized scr_blank_screen_mem |
636 | // basically this is a slightly optimized scr_blank_screen_mem |
636 | // it is worth the effort on slower machines |
637 | // it is worth the effort on slower machines |
637 | line_t &l = ROW(nrow - i); |
638 | line_t &l = ROW(nrow - 1 - i); |
638 | |
639 | |
639 | scr_blank_line (l, 0, l.l, rstyle); |
640 | scr_blank_line (l, 0, l.l, rstyle); |
640 | |
641 | |
641 | l.l = 0; |
642 | l.l = 0; |
642 | l.f = 0; |
643 | l.f = 0; |
… | |
… | |
817 | CLEAR_SELECTION (); |
818 | CLEAR_SELECTION (); |
818 | } |
819 | } |
819 | |
820 | |
820 | if (screen.flags & Screen_WrapNext) |
821 | if (screen.flags & Screen_WrapNext) |
821 | { |
822 | { |
822 | max_it (line->l, ncol); |
|
|
823 | line->is_longer (1); |
|
|
824 | |
|
|
825 | scr_do_wrap (); |
823 | scr_do_wrap (); |
826 | |
824 | |
|
|
825 | line->l = ncol; |
|
|
826 | line->is_longer (1); |
|
|
827 | |
827 | row = screen.cur.row; |
828 | row = screen.cur.row; |
828 | line = &ROW(row); /* _must_ refresh */ |
829 | line = &ROW(row); /* _must_ refresh */ |
829 | } |
830 | } |
830 | |
831 | |
831 | // some utf-8 decoders "decode" surrogate characters: let's fix this. |
832 | // some utf-8 decoders "decode" surrogate characters: let's fix this. |
… | |
… | |
2800 | * (+) if ownership is claimed but property is empty, rxvt_selection_paste () |
2801 | * (+) if ownership is claimed but property is empty, rxvt_selection_paste () |
2801 | * will auto fallback to CUT_BUFFER0 |
2802 | * will auto fallback to CUT_BUFFER0 |
2802 | * EXT: button 2 release |
2803 | * EXT: button 2 release |
2803 | */ |
2804 | */ |
2804 | void |
2805 | void |
2805 | rxvt_term::selection_request (Time tm, int x, int y) |
2806 | rxvt_term::selection_request (Time tm) |
2806 | { |
2807 | { |
2807 | if (x < 0 || x >= width || y < 0 || y >= height) |
|
|
2808 | return; /* outside window */ |
|
|
2809 | |
|
|
2810 | if (selection.text) |
2808 | if (selection.text) |
2811 | { /* internal selection */ |
2809 | { /* internal selection */ |
2812 | char *str = rxvt_wcstombs (selection.text, selection.len); |
2810 | char *str = rxvt_wcstombs (selection.text, selection.len); |
2813 | paste (str, strlen (str)); |
2811 | paste (str, strlen (str)); |
2814 | free (str); |
2812 | free (str); |