… | |
… | |
83 | #define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ |
83 | #define ROWCOL_IN_ROW_AT_OR_AFTER(X, Y) \ |
84 | ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) |
84 | ROW_AND_COL_IN_ROW_AT_OR_AFTER ((X).row, (X).col, (Y).row, (Y).col) |
85 | #define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ |
85 | #define ROWCOL_IN_ROW_AT_OR_BEFORE(X, Y) \ |
86 | ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) |
86 | ROW_AND_COL_IN_ROW_AT_OR_BEFORE ((X).row, (X).col, (Y).row, (Y).col) |
87 | |
87 | |
88 | #define LINENO(n) (((n) + term_start + total_rows) % total_rows) |
|
|
89 | #define ROW(n) (save [LINENO (n)]) |
|
|
90 | |
|
|
91 | /* |
88 | /* |
92 | * CLEAR_ROWS : clear <num> rows starting from row <row> |
89 | * CLEAR_ROWS : clear <num> rows starting from row <row> |
93 | * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> |
90 | * CLEAR_CHARS: clear <num> chars starting from pixel position <x,y> |
94 | * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour |
91 | * ERASE_ROWS : set <num> rows starting from row <row> to the foreground colour |
95 | */ |
92 | */ |
… | |
… | |
546 | if (current_screen == scrn) |
543 | if (current_screen == scrn) |
547 | return scrn; |
544 | return scrn; |
548 | |
545 | |
549 | selection_check (2); /* check for boundary cross */ |
546 | selection_check (2); /* check for boundary cross */ |
550 | |
547 | |
551 | SWAP_IT (scrn, current_screen, int); |
548 | int i = current_screen; current_screen = scrn; scrn = i; |
552 | |
549 | |
553 | SWAP_IT (screen.cur.row, swap.cur.row, int16_t); |
550 | ::swap (screen.cur.row, swap.cur.row); |
554 | SWAP_IT (screen.cur.col, swap.cur.col, int16_t); |
551 | ::swap (screen.cur.col, swap.cur.col); |
555 | MAX_IT (screen.cur.row, 0); |
552 | |
556 | MIN_IT (screen.cur.row, (int32_t)prev_nrow - 1); |
553 | screen.cur.row = clamp (screen.cur.row, 0, prev_nrow - 1); |
557 | MAX_IT (screen.cur.col, 0); |
554 | screen.cur.col = clamp (screen.cur.col, 0, prev_ncol - 1); |
558 | MIN_IT (screen.cur.col, (int32_t)prev_ncol - 1); |
|
|
559 | |
555 | |
560 | #if NSCREENS |
556 | #if NSCREENS |
561 | if (options & Opt_secondaryScreen) |
557 | if (options & Opt_secondaryScreen) |
562 | { |
558 | { |
563 | num_scr = 0; |
559 | num_scr = 0; |
564 | |
560 | |
565 | for (int i = nrow; i--; ) |
561 | for (int i = nrow; i--; ) |
566 | SWAP_IT (ROW(i), swap_save[i], line_t); |
562 | ::swap (ROW(i), swap_save[i]); |
567 | |
563 | |
568 | SWAP_IT (screen.charset, swap.charset, int16_t); |
564 | ::swap (screen.charset, swap.charset); |
569 | SWAP_IT (screen.flags, swap.flags, int); |
565 | ::swap (screen.flags, swap.flags); |
570 | screen.flags |= Screen_VisibleCursor; |
566 | screen.flags |= Screen_VisibleCursor; |
571 | swap.flags |= Screen_VisibleCursor; |
567 | swap.flags |= Screen_VisibleCursor; |
572 | } |
568 | } |
573 | else |
569 | else |
574 | #endif |
570 | #endif |
… | |
… | |
1621 | XGCValues gcvalue; |
1617 | XGCValues gcvalue; |
1622 | |
1618 | |
1623 | if (rvideo != mode) |
1619 | if (rvideo != mode) |
1624 | { |
1620 | { |
1625 | rvideo = mode; |
1621 | rvideo = mode; |
1626 | SWAP_IT (pix_colors[Color_fg], pix_colors[Color_bg], rxvt_color); |
1622 | ::swap (pix_colors[Color_fg], pix_colors[Color_bg]); |
1627 | #if XPM_BACKGROUND |
1623 | #if XPM_BACKGROUND |
1628 | if (bgPixmap.pixmap == None) |
1624 | if (bgPixmap.pixmap == None) |
1629 | #endif |
1625 | #endif |
1630 | #if TRANSPARENT |
1626 | #if TRANSPARENT |
1631 | if (! (options & Opt_transparent) || am_transparent == 0) |
1627 | if (! (options & Opt_transparent) || am_transparent == 0) |
… | |
… | |
1961 | { |
1957 | { |
1962 | unsigned char must_clear, /* use draw_string not draw_image_string */ |
1958 | unsigned char must_clear, /* use draw_string not draw_image_string */ |
1963 | showcursor; /* show the cursor */ |
1959 | showcursor; /* show the cursor */ |
1964 | int16_t col, row, /* column/row we're processing */ |
1960 | int16_t col, row, /* column/row we're processing */ |
1965 | ocrow; /* old cursor row */ |
1961 | ocrow; /* old cursor row */ |
1966 | int i, /* tmp */ |
1962 | int i; /* tmp */ |
1967 | row_offset; /* basic offset in screen structure */ |
|
|
1968 | #ifndef NO_CURSORCOLOR |
1963 | #ifndef NO_CURSORCOLOR |
1969 | rend_t cc1; /* store colours at cursor position (s) */ |
1964 | rend_t cc1; /* store colours at cursor position (s) */ |
1970 | #endif |
1965 | #endif |
1971 | rend_t *crp; // cursor rendition pointer |
1966 | rend_t *crp; // cursor rendition pointer |
1972 | |
1967 | |
… | |
… | |
1978 | /* |
1973 | /* |
1979 | * A: set up vars |
1974 | * A: set up vars |
1980 | */ |
1975 | */ |
1981 | must_clear = 0; |
1976 | must_clear = 0; |
1982 | refresh_count = 0; |
1977 | refresh_count = 0; |
1983 | |
|
|
1984 | row_offset = term_start - view_start; |
|
|
1985 | |
1978 | |
1986 | #if XPM_BACKGROUND |
1979 | #if XPM_BACKGROUND |
1987 | must_clear |= bgPixmap.pixmap != None; |
1980 | must_clear |= bgPixmap.pixmap != None; |
1988 | #endif |
1981 | #endif |
1989 | #if TRANSPARENT |
1982 | #if TRANSPARENT |
… | |
… | |
2107 | row = i > 0 ? 0 : j - 1; |
2100 | row = i > 0 ? 0 : j - 1; |
2108 | for (; j-- >= 0; row += (i > 0 ? 1 : -1)) |
2101 | for (; j-- >= 0; row += (i > 0 ? 1 : -1)) |
2109 | { |
2102 | { |
2110 | if (row + i >= 0 && row + i < nrow && row + i != ocrow) |
2103 | if (row + i >= 0 && row + i < nrow && row + i != ocrow) |
2111 | { |
2104 | { |
2112 | line_t s = save[(row + row_offset) % total_rows]; |
2105 | line_t s = ROW(row - view_start); |
2113 | line_t d = drawn[row]; |
2106 | line_t d = drawn[row]; |
2114 | line_t d2 = drawn[row + i]; |
2107 | line_t d2 = drawn[row + i]; |
2115 | |
2108 | |
2116 | for (nits = 0, col = ncol; col--; ) |
2109 | for (nits = 0, col = ncol; col--; ) |
2117 | if (s.t[col] != d2.t[col] || s.r[col] != d2.r[col]) |
2110 | if (s.t[col] != d2.t[col] || s.r[col] != d2.r[col]) |
… | |
… | |
2137 | |
2130 | |
2138 | if (len != -1) |
2131 | if (len != -1) |
2139 | { |
2132 | { |
2140 | /* also comes here at end if needed because of >= above */ |
2133 | /* also comes here at end if needed because of >= above */ |
2141 | if (wlen < len) |
2134 | if (wlen < len) |
2142 | SWAP_IT (wlen, len, int); |
2135 | ::swap (wlen, len); |
2143 | |
2136 | |
2144 | XCopyArea (display->display, vt, vt, |
2137 | XCopyArea (display->display, vt, vt, |
2145 | gc, 0, Row2Pixel (len + i), |
2138 | gc, 0, Row2Pixel (len + i), |
2146 | (unsigned int)TermWin_TotalWidth (), |
2139 | (unsigned int)TermWin_TotalWidth (), |
2147 | (unsigned int)Height2Pixel (wlen - len + 1), |
2140 | (unsigned int)Height2Pixel (wlen - len + 1), |
… | |
… | |
2155 | /* |
2148 | /* |
2156 | * E: main pass across every character |
2149 | * E: main pass across every character |
2157 | */ |
2150 | */ |
2158 | for (row = 0; row < nrow; row++) |
2151 | for (row = 0; row < nrow; row++) |
2159 | { |
2152 | { |
2160 | text_t *stp = save[(row + row_offset) % total_rows].t; |
2153 | text_t *stp = ROW(row - view_start).t; |
2161 | rend_t *srp = save[(row + row_offset) % total_rows].r; |
2154 | rend_t *srp = ROW(row - view_start).r; |
2162 | text_t *dtp = drawn[row].t; |
2155 | text_t *dtp = drawn[row].t; |
2163 | rend_t *drp = drawn[row].r; |
2156 | rend_t *drp = drawn[row].r; |
2164 | |
2157 | |
2165 | /* |
2158 | /* |
2166 | * E2: OK, now the real pass |
2159 | * E2: OK, now the real pass |
… | |
… | |
2279 | fore = Color_UL; |
2272 | fore = Color_UL; |
2280 | #endif |
2273 | #endif |
2281 | |
2274 | |
2282 | if (invert) |
2275 | if (invert) |
2283 | { |
2276 | { |
2284 | SWAP_IT (fore, back, int); |
2277 | ::swap (fore, back); |
2285 | |
2278 | |
2286 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2279 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2287 | if (ISSET_PIXCOLOR (Color_RV)) |
2280 | if (ISSET_PIXCOLOR (Color_RV)) |
2288 | back = Color_RV; |
2281 | back = Color_RV; |
2289 | |
2282 | |
… | |
… | |
3031 | want_refresh = 1; |
3024 | want_refresh = 1; |
3032 | |
3025 | |
3033 | selection.mark.row = row - view_start; |
3026 | selection.mark.row = row - view_start; |
3034 | selection.mark.col = col; |
3027 | selection.mark.col = col; |
3035 | |
3028 | |
3036 | selection.mark.row = min (max (selection.mark.row, -nsaved), nrow - 1); |
3029 | selection.mark.row = clamp (selection.mark.row, -nsaved, nrow - 1); |
3037 | selection.mark.col = min (max (selection.mark.col, 0), ncol - 1); |
3030 | selection.mark.col = clamp (selection.mark.col, 0, ncol - 1); |
3038 | |
3031 | |
3039 | while (selection.mark.col > 0 |
3032 | while (selection.mark.col > 0 |
3040 | && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR) |
3033 | && ROW(selection.mark.row).t[selection.mark.col] == NOCHAR) |
3041 | --selection.mark.col; |
3034 | --selection.mark.col; |
3042 | |
3035 | |
… | |
… | |
3147 | * flag == 2 ==> button 3 motion |
3140 | * flag == 2 ==> button 3 motion |
3148 | */ |
3141 | */ |
3149 | void |
3142 | void |
3150 | rxvt_term::selection_extend (int x, int y, int flag) |
3143 | rxvt_term::selection_extend (int x, int y, int flag) |
3151 | { |
3144 | { |
3152 | int col = min (max (Pixel2Col (x), 0), nrow - 1); |
3145 | int col = clamp (Pixel2Col (x), 0, ncol); |
3153 | int row = min (max (Pixel2Row (y), 0), ncol); |
3146 | int row = clamp (Pixel2Row (y), 0, nrow - 1); |
3154 | |
3147 | |
3155 | /* |
3148 | /* |
3156 | * 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 |
3157 | * 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 |
3158 | * 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 |
… | |
… | |
3371 | } |
3364 | } |
3372 | } |
3365 | } |
3373 | |
3366 | |
3374 | #if ENABLE_FRILLS |
3367 | #if ENABLE_FRILLS |
3375 | if (selection.rect && selection.beg.col > selection.end.col) |
3368 | if (selection.rect && selection.beg.col > selection.end.col) |
3376 | SWAP_IT (selection.beg.col, selection.end.col, int); |
3369 | ::swap (selection.beg.col, selection.end.col); |
3377 | #endif |
3370 | #endif |
3378 | } |
3371 | } |
3379 | |
3372 | |
3380 | #if ENABLE_FRILLS |
3373 | #if ENABLE_FRILLS |
3381 | void |
3374 | void |