1 | /*--------------------------------*-C-*--------------------------------------* |
1 | /*---------------------------------------------------------------------------* |
2 | * File: screen.C |
2 | * File: screen.C |
3 | *---------------------------------------------------------------------------* |
3 | *---------------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
5 | * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> |
6 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
6 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
… | |
… | |
2106 | if (!display->is_local |
2106 | if (!display->is_local |
2107 | && refresh_type == FAST_REFRESH && num_scr_allow && num_scr |
2107 | && refresh_type == FAST_REFRESH && num_scr_allow && num_scr |
2108 | && abs (num_scr) < nrow && !have_bg) |
2108 | && abs (num_scr) < nrow && !have_bg) |
2109 | { |
2109 | { |
2110 | int16_t nits; |
2110 | int16_t nits; |
|
|
2111 | int i = num_scr; |
2111 | int j; |
2112 | int j; |
2112 | int len, wlen; |
2113 | int len, wlen; |
2113 | dLocal (int, num_scr); |
2114 | dLocal (int, num_scr); |
2114 | |
2115 | |
2115 | j = nrow; |
2116 | j = nrow; |
2116 | wlen = len = -1; |
2117 | wlen = len = -1; |
2117 | row = i > 0 ? 0 : j - 1; |
2118 | row = i > 0 ? 0 : j - 1; |
|
|
2119 | |
2118 | for (; j-- >= 0; row += (i > 0 ? 1 : -1)) |
2120 | for (; j-- >= 0; row += (i > 0 ? 1 : -1)) |
2119 | { |
2121 | { |
2120 | if (row + i >= 0 && row + i < nrow && row + i != ocrow) |
2122 | if (row + i >= 0 && row + i < nrow && row + i != ocrow) |
2121 | { |
2123 | { |
2122 | line_t s = ROW(view_start + row); |
2124 | line_t s = ROW(view_start + row); |
… | |
… | |
2143 | wlen = row; |
2145 | wlen = row; |
2144 | continue; |
2146 | continue; |
2145 | } |
2147 | } |
2146 | } |
2148 | } |
2147 | |
2149 | |
2148 | if (len != -1) |
2150 | if (len >= 0) |
2149 | { |
2151 | { |
2150 | /* also comes here at end if needed because of >= above */ |
2152 | /* also comes here at end if needed because of >= above */ |
2151 | if (wlen < len) |
2153 | if (wlen < len) |
2152 | ::swap (wlen, len); |
2154 | ::swap (wlen, len); |
2153 | |
2155 | |
… | |
… | |
2251 | int back = bgcolor_of (rend); // desired background |
2253 | int back = bgcolor_of (rend); // desired background |
2252 | |
2254 | |
2253 | // only do special processing if any attributes are set, which is unlikely |
2255 | // only do special processing if any attributes are set, which is unlikely |
2254 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2256 | if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink | RS_Careful)) |
2255 | { |
2257 | { |
2256 | #if ENABLE_STYLES |
|
|
2257 | // "careful" (too wide) character handling |
|
|
2258 | |
|
|
2259 | // include previous careful character(s) if possible, looks nicer (best effort...) |
|
|
2260 | while (text > stp |
|
|
2261 | && srp[text - stp - 1] & RS_Careful |
|
|
2262 | && RS_SAME (rend, srp[text - stp - 1])) |
|
|
2263 | text--, count++, xpixel -= fwidth; |
|
|
2264 | |
|
|
2265 | // force redraw after "careful" characters to avoid pixel droppings |
|
|
2266 | for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1; i++) |
|
|
2267 | drp[col + i + 1] = srp[col + i + 1] ^ RS_redraw; |
|
|
2268 | |
|
|
2269 | // force redraw before "careful" characters to avoid pixel droppings |
|
|
2270 | for (int i = 0; srp[text - stp - i] & RS_Careful && text - i > stp; i++) |
|
|
2271 | drp[text - stp - i - 1] = srp[text - stp - i - 1] ^ RS_redraw; |
|
|
2272 | #endif |
|
|
2273 | |
|
|
2274 | bool invert = rend & RS_RVid; |
2258 | bool invert = rend & RS_RVid; |
2275 | |
2259 | |
2276 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2260 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2277 | if (rend & RS_Bold |
2261 | if (rend & RS_Bold |
2278 | && fore == Color_fg) |
2262 | && fore == Color_fg) |
… | |
… | |
2294 | else |
2278 | else |
2295 | invert = !invert; |
2279 | invert = !invert; |
2296 | # endif |
2280 | # endif |
2297 | } |
2281 | } |
2298 | |
2282 | |
2299 | if (rend & RS_Uline && ISSET_PIXCOLOR (Color_UL)) |
2283 | if (rend & RS_Uline && fore == Color_fg && ISSET_PIXCOLOR (Color_UL)) |
2300 | fore = Color_UL; |
2284 | fore = Color_UL; |
2301 | #endif |
2285 | #endif |
2302 | |
2286 | |
2303 | if (invert) |
2287 | if (invert) |
2304 | { |
2288 | { |
|
|
2289 | #ifdef OPTION_HC |
|
|
2290 | if ((showcursor && row == screen.cur.row && text - stp == screen.cur.col) |
|
|
2291 | || !ISSET_PIXCOLOR (Color_HC)) |
|
|
2292 | #endif |
|
|
2293 | /* invert the column if no highlightColor is set or it is the |
|
|
2294 | * current cursor column */ |
2305 | ::swap (fore, back); |
2295 | ::swap (fore, back); |
|
|
2296 | #ifdef OPTION_HC |
|
|
2297 | else if (ISSET_PIXCOLOR (Color_HC)) |
|
|
2298 | back = Color_HC; |
|
|
2299 | #endif |
2306 | |
2300 | |
2307 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
2301 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
|
|
2302 | # ifndef OPTION_HC |
2308 | if (ISSET_PIXCOLOR (Color_RV)) |
2303 | if (ISSET_PIXCOLOR (Color_RV)) |
2309 | back = Color_RV; |
2304 | back = Color_RV; |
2310 | |
2305 | # endif |
2311 | if (fore == back) |
2306 | if (fore == back) |
2312 | { |
2307 | { |
2313 | fore = Color_bg; |
2308 | fore = Color_bg; |
2314 | back = Color_fg; |
2309 | back = Color_fg; |
2315 | } |
2310 | } |
… | |
… | |
2325 | hidden_text = 0; |
2320 | hidden_text = 0; |
2326 | } |
2321 | } |
2327 | else if (hidden_text) |
2322 | else if (hidden_text) |
2328 | fore = back; |
2323 | fore = back; |
2329 | } |
2324 | } |
|
|
2325 | #endif |
|
|
2326 | |
|
|
2327 | #if ENABLE_STYLES |
|
|
2328 | // "careful" (too wide) character handling |
|
|
2329 | |
|
|
2330 | // include previous careful character(s) if possible, looks nicer (best effort...) |
|
|
2331 | while (text > stp |
|
|
2332 | && srp[text - stp - 1] & RS_Careful |
|
|
2333 | && RS_SAME (rend, srp[text - stp - 1])) |
|
|
2334 | text--, count++, xpixel -= fwidth; |
|
|
2335 | |
|
|
2336 | // force redraw after "careful" characters to avoid pixel droppings |
|
|
2337 | for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1; i++) |
|
|
2338 | drp[col + i + 1] = srp[col + i + 1] ^ RS_redraw; |
|
|
2339 | |
|
|
2340 | // force redraw before "careful" characters to avoid pixel droppings |
|
|
2341 | for (int i = 0; srp[text - stp - i] & RS_Careful && text - i > stp; i++) |
|
|
2342 | drp[text - stp - i - 1] = srp[text - stp - i - 1] ^ RS_redraw; |
2330 | #endif |
2343 | #endif |
2331 | } |
2344 | } |
2332 | |
2345 | |
2333 | /* |
2346 | /* |
2334 | * Actually do the drawing of the string here |
2347 | * Actually do the drawing of the string here |