… | |
… | |
543 | if (current_screen == scrn) |
543 | if (current_screen == scrn) |
544 | return scrn; |
544 | return scrn; |
545 | |
545 | |
546 | selection_check (2); /* check for boundary cross */ |
546 | selection_check (2); /* check for boundary cross */ |
547 | |
547 | |
548 | SWAP_IT (scrn, current_screen, int); |
548 | int i = current_screen; current_screen = scrn; scrn = i; |
549 | |
549 | |
550 | SWAP_IT (screen.cur.row, swap.cur.row, int16_t); |
550 | ::swap (screen.cur.row, swap.cur.row); |
551 | SWAP_IT (screen.cur.col, swap.cur.col, int16_t); |
551 | ::swap (screen.cur.col, swap.cur.col); |
552 | MAX_IT (screen.cur.row, 0); |
552 | |
553 | MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); |
553 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
554 | MAX_IT (screen.cur.col, 0); |
554 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
555 | MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1); |
|
|
556 | |
555 | |
557 | #if NSCREENS |
556 | #if NSCREENS |
558 | if (options & Opt_secondaryScreen) |
557 | if (options & Opt_secondaryScreen) |
559 | { |
558 | { |
560 | num_scr = 0; |
559 | num_scr = 0; |
561 | |
560 | |
562 | for (int i = nrow; i--; ) |
561 | for (int i = nrow; i--; ) |
563 | SWAP_IT (ROW(i), swap_save[i], line_t); |
562 | ::swap (ROW(i), swap_save[i]); |
564 | |
563 | |
565 | SWAP_IT (screen.charset, swap.charset, int16_t); |
564 | ::swap (screen.charset, swap.charset); |
566 | SWAP_IT (screen.flags, swap.flags, int); |
565 | ::swap (screen.flags, swap.flags); |
567 | screen.flags |= Screen_VisibleCursor; |
566 | screen.flags |= Screen_VisibleCursor; |
568 | swap.flags |= Screen_VisibleCursor; |
567 | swap.flags |= Screen_VisibleCursor; |
569 | } |
568 | } |
570 | else |
569 | else |
571 | #endif |
570 | #endif |
… | |
… | |
3025 | want_refresh = 1; |
3024 | want_refresh = 1; |
3026 | |
3025 | |
3027 | selection.mark.row = row - view_start; |
3026 | selection.mark.row = row - view_start; |
3028 | selection.mark.col = col; |
3027 | selection.mark.col = col; |
3029 | |
3028 | |
3030 | selection.mark.row = min (max (selection.mark.row, -nsaved), nrow - 1); |
3029 | selection.mark.row = clamp (selection.mark.row, -nsaved, nrow - 1); |
3031 | selection.mark.col = min (max (selection.mark.col, 0), ncol - 1); |
3030 | selection.mark.col = clamp (selection.mark.col, 0, ncol - 1); |
3032 | |
3031 | |
3033 | while (selection.mark.col > 0 |
3032 | while (selection.mark.col > 0 |
3034 | && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR) |
3033 | && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR) |
3035 | --selection.mark.col; |
3034 | --selection.mark.col; |
3036 | |
3035 | |
… | |
… | |
3141 | * flag == 2 ==> button 3 motion |
3140 | * flag == 2 ==> button 3 motion |
3142 | */ |
3141 | */ |
3143 | void |
3142 | void |
3144 | rxvt_term::selection_extend (int x, int y, int flag) |
3143 | rxvt_term::selection_extend (int x, int y, int flag) |
3145 | { |
3144 | { |
3146 | int col = min (max (Pixel2Col (x), 0), ncol); |
3145 | int col = clamp (Pixel2Col (x), 0, ncol); |
3147 | int row = min (max (Pixel2Row (y), 0), nrow - 1); |
3146 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3148 | |
3147 | |
3149 | /* |
3148 | /* |
3150 | * If we're selecting characters (single click) then we must check first |
3149 | * If we're selecting characters (single click) then we must check first |
3151 | * if we are at the same place as the original mark. If we are then |
3150 | * if we are at the same place as the original mark. If we are then |
3152 | * select nothing. Otherwise, if we're to the right of the mark, you have to |
3151 | * select nothing. Otherwise, if we're to the right of the mark, you have to |