… | |
… | |
234 | selection.text = NULL; |
234 | selection.text = NULL; |
235 | selection.len = 0; |
235 | selection.len = 0; |
236 | selection.op = SELECTION_CLEAR; |
236 | selection.op = SELECTION_CLEAR; |
237 | selection.screen = PRIMARY; |
237 | selection.screen = PRIMARY; |
238 | selection.clicks = 0; |
238 | selection.clicks = 0; |
239 | CLEAR_ALL_SELECTION (); |
|
|
240 | rvideo = 0; |
239 | rvideo = 0; |
241 | } |
240 | } |
242 | else |
241 | else |
243 | { |
242 | { |
244 | /* |
243 | /* |
… | |
… | |
325 | qline->l = ncol; |
324 | qline->l = ncol; |
326 | qline->is_longer (1); |
325 | qline->is_longer (1); |
327 | |
326 | |
328 | int qcol = 0; |
327 | int qcol = 0; |
329 | |
328 | |
|
|
329 | // see below for cursor adjustment rationale |
|
|
330 | if (p == ocur.row) |
|
|
331 | screen.cur.row = q - (total_rows - nrow); |
|
|
332 | |
330 | // fill a single destination line |
333 | // fill a single destination line |
331 | while (lofs < llen && qcol < ncol) |
334 | while (lofs < llen && qcol < ncol) |
332 | { |
335 | { |
333 | int prow = lofs / prev_ncol; |
336 | int prow = lofs / prev_ncol; |
334 | int pcol = lofs % prev_ncol; |
337 | int pcol = lofs % prev_ncol; |
… | |
… | |
344 | |
347 | |
345 | line_t &pline = old_buf [prow]; |
348 | line_t &pline = old_buf [prow]; |
346 | |
349 | |
347 | int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); |
350 | int len = min (min (prev_ncol - pcol, ncol - qcol), llen - lofs); |
348 | |
351 | |
|
|
352 | #if DEBUG_STRICT |
349 | assert (len); |
353 | assert (len); |
350 | assert (pline.t); |
354 | assert (pline.t); |
|
|
355 | #endif |
351 | |
356 | |
352 | memcpy (qline->t + qcol, pline.t + pcol, len * sizeof (text_t)); |
357 | memcpy (qline->t + qcol, pline.t + pcol, len * sizeof (text_t)); |
353 | memcpy (qline->r + qcol, pline.r + pcol, len * sizeof (rend_t)); |
358 | memcpy (qline->r + qcol, pline.r + pcol, len * sizeof (rend_t)); |
354 | |
359 | |
355 | lofs += len; |
360 | lofs += len; |
… | |
… | |
389 | } |
394 | } |
390 | |
395 | |
391 | term_start = 0; |
396 | term_start = 0; |
392 | } |
397 | } |
393 | |
398 | |
394 | #ifdef DEBUG_STRICT //TODO: remove |
|
|
395 | for (int i = top_row; i < nrow; i++) |
|
|
396 | assert (ROW (i).t); |
|
|
397 | #endif |
|
|
398 | |
|
|
399 | free (old_buf); |
399 | free (old_buf); |
400 | delete old_ta; |
400 | delete old_ta; |
401 | delete old_ra; |
401 | delete old_ra; |
402 | |
402 | |
403 | clamp_it (screen.cur.row, 0, nrow - 1); |
403 | clamp_it (screen.cur.row, 0, nrow - 1); |
404 | clamp_it (screen.cur.col, 0, ncol - 1); |
404 | clamp_it (screen.cur.col, 0, ncol - 1); |
405 | |
405 | |
406 | if (tabs) |
406 | if (tabs) |
407 | free (tabs); |
407 | free (tabs); |
408 | } |
408 | } |
|
|
409 | |
|
|
410 | CLEAR_ALL_SELECTION (); |
409 | |
411 | |
410 | prev_nrow = nrow; |
412 | prev_nrow = nrow; |
411 | prev_ncol = ncol; |
413 | prev_ncol = ncol; |
412 | |
414 | |
413 | tabs = (char *)rxvt_malloc (ncol * sizeof (char)); |
415 | tabs = (char *)rxvt_malloc (ncol * sizeof (char)); |
… | |
… | |
460 | * Save and Restore cursor |
462 | * Save and Restore cursor |
461 | * XTERM_SEQ: Save cursor : ESC 7 |
463 | * XTERM_SEQ: Save cursor : ESC 7 |
462 | * XTERM_SEQ: Restore cursor: ESC 8 |
464 | * XTERM_SEQ: Restore cursor: ESC 8 |
463 | */ |
465 | */ |
464 | void |
466 | void |
465 | rxvt_term::scr_cursor (int mode) |
467 | rxvt_term::scr_cursor (cursor_mode mode) |
466 | { |
468 | { |
467 | screen_t *s; |
469 | screen_t *s; |
468 | |
470 | |
469 | #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) |
471 | #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) |
470 | if (current_screen == SECONDARY) |
472 | if (current_screen == SECONDARY) |
… | |
… | |
2800 | * (+) if ownership is claimed but property is empty, rxvt_selection_paste () |
2802 | * (+) if ownership is claimed but property is empty, rxvt_selection_paste () |
2801 | * will auto fallback to CUT_BUFFER0 |
2803 | * will auto fallback to CUT_BUFFER0 |
2802 | * EXT: button 2 release |
2804 | * EXT: button 2 release |
2803 | */ |
2805 | */ |
2804 | void |
2806 | void |
2805 | rxvt_term::selection_request (Time tm, int x, int y) |
2807 | rxvt_term::selection_request (Time tm, int selnum) |
2806 | { |
2808 | { |
2807 | if (x < 0 || x >= width || y < 0 || y >= height) |
2809 | /* After making a selection with selection_make this function will always |
2808 | return; /* outside window */ |
2810 | * return the internal selection, which is not correct IMO, now much more since |
2809 | |
2811 | * I added the selnum parameter. |
|
|
2812 | */ |
|
|
2813 | #if 0 |
2810 | if (selection.text) |
2814 | if (selection.text) |
2811 | { /* internal selection */ |
2815 | { /* internal selection */ |
2812 | char *str = rxvt_wcstombs (selection.text, selection.len); |
2816 | char *str = rxvt_wcstombs (selection.text, selection.len); |
2813 | paste (str, strlen (str)); |
2817 | paste (str, strlen (str)); |
2814 | free (str); |
2818 | free (str); |
2815 | return; |
2819 | return; |
2816 | } |
2820 | } |
2817 | else |
2821 | else |
|
|
2822 | #endif |
2818 | { |
2823 | { |
2819 | int i; |
|
|
2820 | |
|
|
2821 | selection_request_time = tm; |
2824 | selection_request_time = tm; |
2822 | selection_wait = Sel_normal; |
2825 | selection_wait = Sel_normal; |
2823 | |
2826 | |
2824 | for (i = Sel_Primary; i <= Sel_Clipboard; i++) |
|
|
2825 | { |
|
|
2826 | #if X_HAVE_UTF8_STRING |
2827 | #if X_HAVE_UTF8_STRING |
2827 | selection_type = Sel_UTF8String; |
2828 | selection_type = Sel_UTF8String; |
2828 | if (selection_request_other (xa[XA_UTF8_STRING], i)) |
2829 | if (selection_request_other (xa[XA_UTF8_STRING], selnum)) |
2829 | return; |
2830 | return; |
2830 | #else |
2831 | #else |
2831 | selection_type = Sel_CompoundText; |
2832 | selection_type = Sel_CompoundText; |
2832 | if (selection_request_other (xa[XA_COMPOUND_TEXT], i)) |
2833 | if (selection_request_other (xa[XA_COMPOUND_TEXT], selnum)) |
2833 | return; |
2834 | return; |
2834 | #endif |
2835 | #endif |
2835 | } |
|
|
2836 | } |
2836 | } |
2837 | |
2837 | |
2838 | selection_wait = Sel_none; /* don't loop in selection_paste () */ |
2838 | selection_wait = Sel_none; /* don't loop in selection_paste () */ |
2839 | selection_paste (display->root, XA_CUT_BUFFER0, false); |
2839 | selection_paste (display->root, XA_CUT_BUFFER0, false); |
2840 | } |
2840 | } |