… | |
… | |
49 | if (option (Opt_scrollTtyOutput)) \ |
49 | if (option (Opt_scrollTtyOutput)) \ |
50 | view_start = 0 |
50 | view_start = 0 |
51 | #define CLEAR_SELECTION() \ |
51 | #define CLEAR_SELECTION() \ |
52 | selection.beg.row = selection.beg.col \ |
52 | selection.beg.row = selection.beg.col \ |
53 | = selection.end.row = selection.end.col = 0 |
53 | = selection.end.row = selection.end.col = 0 |
54 | #define CLEAR_SELECTION_MARK() \ |
54 | #define CLEAR_ALL_SELECTION() \ |
|
|
55 | selection.beg.row = selection.beg.col \ |
|
|
56 | = selection.mark.row = selection.mark.col \ |
55 | selection.mark.row = selection.mark.col = 0 |
57 | = selection.end.row = selection.end.col = 0 |
56 | |
58 | |
57 | #define ROW_AND_COL_IS_AFTER(A, B, C, D) \ |
59 | #define ROW_AND_COL_IS_AFTER(A, B, C, D) \ |
58 | (((A) > (C)) || (((A) == (C)) && ((B) > (D)))) |
60 | (((A) > (C)) || (((A) == (C)) && ((B) > (D)))) |
59 | #define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ |
61 | #define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ |
60 | (((A) < (C)) || (((A) == (C)) && ((B) < (D)))) |
62 | (((A) < (C)) || (((A) == (C)) && ((B) < (D)))) |
… | |
… | |
403 | tabs = (char *)rxvt_malloc (ncol); |
405 | tabs = (char *)rxvt_malloc (ncol); |
404 | |
406 | |
405 | for (int col = ncol; col--; ) |
407 | for (int col = ncol; col--; ) |
406 | tabs [col] = col % TABSIZE == 0; |
408 | tabs [col] = col % TABSIZE == 0; |
407 | |
409 | |
408 | CLEAR_SELECTION (); |
410 | CLEAR_ALL_SELECTION (); |
409 | CLEAR_SELECTION_MARK (); |
|
|
410 | |
411 | |
411 | prev_nrow = nrow; |
412 | prev_nrow = nrow; |
412 | prev_ncol = ncol; |
413 | prev_ncol = ncol; |
413 | |
414 | |
414 | tt_winch (); |
415 | tt_winch (); |
… | |
… | |
711 | || (selection.beg.row - count < row1 && selection.beg.row >= row1) |
712 | || (selection.beg.row - count < row1 && selection.beg.row >= row1) |
712 | || (selection.beg.row - count > row2 && selection.beg.row <= row2) |
713 | || (selection.beg.row - count > row2 && selection.beg.row <= row2) |
713 | || (selection.end.row - count < row1 && selection.end.row >= row1) |
714 | || (selection.end.row - count < row1 && selection.end.row >= row1) |
714 | || (selection.end.row - count > row2 && selection.end.row <= row2)) |
715 | || (selection.end.row - count > row2 && selection.end.row <= row2)) |
715 | { |
716 | { |
716 | CLEAR_SELECTION (); |
717 | CLEAR_ALL_SELECTION (); |
717 | if (!IN_RANGE_EXC (selection.mark.row, top_row, nrow)) |
718 | selection.op = SELECTION_CLEAR; |
718 | CLEAR_SELECTION_MARK (); |
|
|
719 | } |
719 | } |
720 | else if (selection.end.row >= row1 && selection.end.row <= row2) |
720 | else if (selection.end.row >= row1 && selection.end.row <= row2) |
721 | { |
721 | { |
722 | /* move selected region too */ |
722 | /* move selected region too */ |
723 | selection.beg.row -= count; |
723 | selection.beg.row -= count; |
… | |
… | |
1326 | ZERO_SCROLLBACK (); |
1326 | ZERO_SCROLLBACK (); |
1327 | |
1327 | |
1328 | switch (mode) |
1328 | switch (mode) |
1329 | { |
1329 | { |
1330 | case 0: /* erase to end of screen */ |
1330 | case 0: /* erase to end of screen */ |
1331 | selection_check (1); |
|
|
1332 | scr_erase_line (0); |
1331 | scr_erase_line (0); |
1333 | row = screen.cur.row + 1; /* possible OOB */ |
1332 | row = screen.cur.row + 1; /* possible OOB */ |
1334 | num = nrow - row; |
1333 | num = nrow - row; |
1335 | break; |
1334 | break; |
1336 | case 1: /* erase to beginning of screen */ |
1335 | case 1: /* erase to beginning of screen */ |
1337 | selection_check (3); |
|
|
1338 | scr_erase_line (1); |
1336 | scr_erase_line (1); |
1339 | row = 0; |
1337 | row = 0; |
1340 | num = screen.cur.row; |
1338 | num = screen.cur.row; |
1341 | break; |
1339 | break; |
1342 | case 2: /* erase whole screen */ |
1340 | case 2: /* erase whole screen */ |
1343 | selection_check (3); |
|
|
1344 | row = 0; |
1341 | row = 0; |
1345 | num = nrow; |
1342 | num = nrow; |
1346 | break; |
1343 | break; |
1347 | default: |
1344 | default: |
1348 | return; |
1345 | return; |
… | |
… | |
2698 | |
2695 | |
2699 | row_col_t pos; |
2696 | row_col_t pos; |
2700 | pos.row = pos.col = 0; |
2697 | pos.row = pos.col = 0; |
2701 | |
2698 | |
2702 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
2699 | if (!IN_RANGE_EXC (selection.beg.row, top_row, nrow) |
|
|
2700 | || !IN_RANGE_EXC (selection.mark.row, top_row, nrow) |
2703 | || !IN_RANGE_EXC (selection.end.row, top_row, nrow) |
2701 | || !IN_RANGE_EXC (selection.end.row, top_row, nrow) |
2704 | || (check_more == 1 |
2702 | || (check_more == 1 |
2705 | && current_screen == selection.screen |
2703 | && current_screen == selection.screen |
2706 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
2704 | && !ROWCOL_IS_BEFORE (screen.cur, selection.beg) |
2707 | && ROWCOL_IS_BEFORE (screen.cur, selection.end)) |
2705 | && ROWCOL_IS_BEFORE (screen.cur, selection.end)) |
2708 | || (check_more == 2 |
2706 | || (check_more == 2 |
2709 | && ROWCOL_IS_BEFORE (selection.beg, pos) |
2707 | && ROWCOL_IS_BEFORE (selection.beg, pos) |
2710 | && ROWCOL_IS_AFTER (selection.end, pos)) |
2708 | && ROWCOL_IS_AFTER (selection.end, pos)) |
2711 | || (check_more == 3 |
2709 | || (check_more == 3 |
2712 | && ROWCOL_IS_AFTER (selection.end, pos))) |
2710 | && ROWCOL_IS_AFTER (selection.end, pos))) |
2713 | CLEAR_SELECTION (); |
2711 | CLEAR_ALL_SELECTION (); |
2714 | |
|
|
2715 | if (!IN_RANGE_EXC (selection.mark.row, top_row, nrow)) |
|
|
2716 | CLEAR_SELECTION_MARK (); |
|
|
2717 | } |
2712 | } |
2718 | |
2713 | |
2719 | /* ------------------------------------------------------------------------- */ |
2714 | /* ------------------------------------------------------------------------- */ |
2720 | /* |
2715 | /* |
2721 | * Paste a selection direct to the command fd |
2716 | * Paste a selection direct to the command fd |