Mercurial > vim
comparison src/screen.c @ 714:0f9f4761ad9c v7.0216
updated for version 7.0216
author | vimboss |
---|---|
date | Mon, 06 Mar 2006 23:29:24 +0000 |
parents | 111b7dcc8a17 |
children | afac7b58ed46 |
comparison
equal
deleted
inserted
replaced
713:0c381fb7846c | 714:0f9f4761ad9c |
---|---|
25 * one character which occupies two display cells. | 25 * one character which occupies two display cells. |
26 * For UTF-8 a multi-byte character is converted to Unicode and stored in | 26 * For UTF-8 a multi-byte character is converted to Unicode and stored in |
27 * ScreenLinesUC[]. ScreenLines[] contains the first byte only. For an ASCII | 27 * ScreenLinesUC[]. ScreenLines[] contains the first byte only. For an ASCII |
28 * character without composing chars ScreenLinesUC[] will be 0. When the | 28 * character without composing chars ScreenLinesUC[] will be 0. When the |
29 * character occupies two display cells the next byte in ScreenLines[] is 0. | 29 * character occupies two display cells the next byte in ScreenLines[] is 0. |
30 * ScreenLinesC1[] and ScreenLinesC2[] contain up to two composing characters | 30 * ScreenLinesC[][] contain up to 'maxcombine' composing characters |
31 * (drawn on top of the first character). They are 0 when not used. | 31 * (drawn on top of the first character). They are 0 when not used. |
32 * ScreenLines2[] is only used for euc-jp to store the second byte if the | 32 * ScreenLines2[] is only used for euc-jp to store the second byte if the |
33 * first byte is 0x8e (single-width character). | 33 * first byte is 0x8e (single-width character). |
34 * | 34 * |
35 * The screen_*() functions write to the screen and handle updating | 35 * The screen_*() functions write to the screen and handle updating |
2185 */ | 2185 */ |
2186 #ifdef FEAT_MBYTE | 2186 #ifdef FEAT_MBYTE |
2187 if (has_mbyte) | 2187 if (has_mbyte) |
2188 { | 2188 { |
2189 int cells; | 2189 int cells; |
2190 int u8c, u8c_c1, u8c_c2; | 2190 int u8c, u8cc[MAX_MCO]; |
2191 int i; | |
2191 int idx; | 2192 int idx; |
2192 int c_len; | 2193 int c_len; |
2193 char_u *p; | 2194 char_u *p; |
2194 # ifdef FEAT_ARABIC | 2195 # ifdef FEAT_ARABIC |
2195 int prev_c = 0; /* previous Arabic character */ | 2196 int prev_c = 0; /* previous Arabic character */ |
2215 ) | 2216 ) |
2216 break; | 2217 break; |
2217 ScreenLines[idx] = *p; | 2218 ScreenLines[idx] = *p; |
2218 if (enc_utf8) | 2219 if (enc_utf8) |
2219 { | 2220 { |
2220 u8c = utfc_ptr2char(p, &u8c_c1, &u8c_c2); | 2221 u8c = utfc_ptr2char(p, u8cc); |
2221 if (*p < 0x80 && u8c_c1 == 0 && u8c_c2 == 0) | 2222 if (*p < 0x80 && u8cc[0] == 0) |
2222 { | 2223 { |
2223 ScreenLinesUC[idx] = 0; | 2224 ScreenLinesUC[idx] = 0; |
2224 #ifdef FEAT_ARABIC | 2225 #ifdef FEAT_ARABIC |
2225 prev_c = u8c; | 2226 prev_c = u8c; |
2226 #endif | 2227 #endif |
2229 { | 2230 { |
2230 #ifdef FEAT_ARABIC | 2231 #ifdef FEAT_ARABIC |
2231 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) | 2232 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) |
2232 { | 2233 { |
2233 /* Do Arabic shaping. */ | 2234 /* Do Arabic shaping. */ |
2234 int pc, pc1, nc, dummy; | 2235 int pc, pc1, nc; |
2236 int pcc[MAX_MCO]; | |
2235 int firstbyte = *p; | 2237 int firstbyte = *p; |
2236 | 2238 |
2237 /* The idea of what is the previous and next | 2239 /* The idea of what is the previous and next |
2238 * character depends on 'rightleft'. */ | 2240 * character depends on 'rightleft'. */ |
2239 if (wp->w_p_rl) | 2241 if (wp->w_p_rl) |
2240 { | 2242 { |
2241 pc = prev_c; | 2243 pc = prev_c; |
2242 pc1 = prev_c1; | 2244 pc1 = prev_c1; |
2243 nc = utf_ptr2char(p + c_len); | 2245 nc = utf_ptr2char(p + c_len); |
2244 prev_c1 = u8c_c1; | 2246 prev_c1 = u8cc[0]; |
2245 } | 2247 } |
2246 else | 2248 else |
2247 { | 2249 { |
2248 pc = utfc_ptr2char(p + c_len, &pc1, &dummy); | 2250 pc = utfc_ptr2char(p + c_len, pcc); |
2249 nc = prev_c; | 2251 nc = prev_c; |
2252 pc1 = pcc[0]; | |
2250 } | 2253 } |
2251 prev_c = u8c; | 2254 prev_c = u8c; |
2252 | 2255 |
2253 u8c = arabic_shape(u8c, &firstbyte, &u8c_c1, | 2256 u8c = arabic_shape(u8c, &firstbyte, &u8cc[0], |
2254 pc, pc1, nc); | 2257 pc, pc1, nc); |
2255 ScreenLines[idx] = firstbyte; | 2258 ScreenLines[idx] = firstbyte; |
2256 } | 2259 } |
2257 else | 2260 else |
2258 prev_c = u8c; | 2261 prev_c = u8c; |
2260 /* Non-BMP character: display as ? or fullwidth ?. */ | 2263 /* Non-BMP character: display as ? or fullwidth ?. */ |
2261 if (u8c >= 0x10000) | 2264 if (u8c >= 0x10000) |
2262 ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?'; | 2265 ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?'; |
2263 else | 2266 else |
2264 ScreenLinesUC[idx] = u8c; | 2267 ScreenLinesUC[idx] = u8c; |
2265 ScreenLinesC1[idx] = u8c_c1; | 2268 for (i = 0; i < Screen_mco; ++i) |
2266 ScreenLinesC2[idx] = u8c_c2; | 2269 { |
2270 ScreenLinesC[i][idx] = u8cc[i]; | |
2271 if (u8cc[i] == 0) | |
2272 break; | |
2273 } | |
2267 } | 2274 } |
2268 if (cells > 1) | 2275 if (cells > 1) |
2269 ScreenLines[idx + 1] = 0; | 2276 ScreenLines[idx + 1] = 0; |
2270 } | 2277 } |
2271 else if (cells > 1) /* double-byte character */ | 2278 else if (cells > 1) /* double-byte character */ |
2313 if (enc_utf8) | 2320 if (enc_utf8) |
2314 { | 2321 { |
2315 if (fill_fold >= 0x80) | 2322 if (fill_fold >= 0x80) |
2316 { | 2323 { |
2317 ScreenLinesUC[off + col] = fill_fold; | 2324 ScreenLinesUC[off + col] = fill_fold; |
2318 ScreenLinesC1[off + col] = 0; | 2325 ScreenLinesC[0][off + col] = 0; |
2319 ScreenLinesC2[off + col] = 0; | |
2320 } | 2326 } |
2321 else | 2327 else |
2322 ScreenLinesUC[off + col] = 0; | 2328 ScreenLinesUC[off + col] = 0; |
2323 } | 2329 } |
2324 #endif | 2330 #endif |
2559 #ifdef FEAT_MBYTE | 2565 #ifdef FEAT_MBYTE |
2560 int multi_attr = 0; /* attributes desired by multibyte */ | 2566 int multi_attr = 0; /* attributes desired by multibyte */ |
2561 int mb_l = 1; /* multi-byte byte length */ | 2567 int mb_l = 1; /* multi-byte byte length */ |
2562 int mb_c = 0; /* decoded multi-byte character */ | 2568 int mb_c = 0; /* decoded multi-byte character */ |
2563 int mb_utf8 = FALSE; /* screen char is UTF-8 char */ | 2569 int mb_utf8 = FALSE; /* screen char is UTF-8 char */ |
2564 int u8c_c1 = 0; /* first composing UTF-8 char */ | 2570 int u8cc[MAX_MCO]; /* composing UTF-8 chars */ |
2565 int u8c_c2 = 0; /* second composing UTF-8 char */ | |
2566 #endif | 2571 #endif |
2567 #ifdef FEAT_DIFF | 2572 #ifdef FEAT_DIFF |
2568 int filler_lines; /* nr of filler lines to be drawn */ | 2573 int filler_lines; /* nr of filler lines to be drawn */ |
2569 int filler_todo; /* nr of filler lines still to do + 1 */ | 2574 int filler_todo; /* nr of filler lines still to do + 1 */ |
2570 hlf_T diff_hlf = (hlf_T)0; /* type of diff highlighting */ | 2575 hlf_T diff_hlf = (hlf_T)0; /* type of diff highlighting */ |
2579 # define LINE_ATTR | 2584 # define LINE_ATTR |
2580 int line_attr = 0; /* atrribute for the whole line */ | 2585 int line_attr = 0; /* atrribute for the whole line */ |
2581 #endif | 2586 #endif |
2582 #ifdef FEAT_SEARCH_EXTRA | 2587 #ifdef FEAT_SEARCH_EXTRA |
2583 match_T *shl; /* points to search_hl or match_hl */ | 2588 match_T *shl; /* points to search_hl or match_hl */ |
2589 #endif | |
2590 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_MBYTE) | |
2584 int i; | 2591 int i; |
2585 #endif | 2592 #endif |
2586 #ifdef FEAT_ARABIC | 2593 #ifdef FEAT_ARABIC |
2587 int prev_c = 0; /* previous Arabic character */ | 2594 int prev_c = 0; /* previous Arabic character */ |
2588 int prev_c1 = 0; /* first composing char for prev_c */ | 2595 int prev_c1 = 0; /* first composing char for prev_c */ |
3431 #ifdef FEAT_MBYTE | 3438 #ifdef FEAT_MBYTE |
3432 mb_c = c; /* doesn't handle non-utf-8 multi-byte! */ | 3439 mb_c = c; /* doesn't handle non-utf-8 multi-byte! */ |
3433 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3440 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3434 { | 3441 { |
3435 mb_utf8 = TRUE; | 3442 mb_utf8 = TRUE; |
3436 u8c_c1 = u8c_c2 = 0; | 3443 u8cc[0] = 0; |
3437 } | 3444 } |
3438 else | 3445 else |
3439 mb_utf8 = FALSE; | 3446 mb_utf8 = FALSE; |
3440 #endif | 3447 #endif |
3441 } | 3448 } |
3454 mb_utf8 = FALSE; | 3461 mb_utf8 = FALSE; |
3455 if (mb_l > n_extra) | 3462 if (mb_l > n_extra) |
3456 mb_l = 1; | 3463 mb_l = 1; |
3457 else if (mb_l > 1) | 3464 else if (mb_l > 1) |
3458 { | 3465 { |
3459 mb_c = utfc_ptr2char(p_extra, &u8c_c1, &u8c_c2); | 3466 mb_c = utfc_ptr2char(p_extra, u8cc); |
3460 mb_utf8 = TRUE; | 3467 mb_utf8 = TRUE; |
3461 } | 3468 } |
3462 } | 3469 } |
3463 else | 3470 else |
3464 { | 3471 { |
3518 * into "mb_c". */ | 3525 * into "mb_c". */ |
3519 mb_l = (*mb_ptr2len)(ptr); | 3526 mb_l = (*mb_ptr2len)(ptr); |
3520 mb_utf8 = FALSE; | 3527 mb_utf8 = FALSE; |
3521 if (mb_l > 1) | 3528 if (mb_l > 1) |
3522 { | 3529 { |
3523 mb_c = utfc_ptr2char(ptr, &u8c_c1, &u8c_c2); | 3530 mb_c = utfc_ptr2char(ptr, u8cc); |
3524 /* Overlong encoded ASCII or ASCII with composing char | 3531 /* Overlong encoded ASCII or ASCII with composing char |
3525 * is displayed normally, except a NUL. */ | 3532 * is displayed normally, except a NUL. */ |
3526 if (mb_c < 0x80) | 3533 if (mb_c < 0x80) |
3527 c = mb_c; | 3534 c = mb_c; |
3528 mb_utf8 = TRUE; | 3535 mb_utf8 = TRUE; |
3529 | 3536 |
3530 /* At start of the line we can have a composing char. | 3537 /* At start of the line we can have a composing char. |
3531 * Draw it as a space with a composing char. */ | 3538 * Draw it as a space with a composing char. */ |
3532 if (utf_iscomposing(mb_c)) | 3539 if (utf_iscomposing(mb_c)) |
3533 { | 3540 { |
3534 u8c_c2 = u8c_c1; | 3541 for (i = Screen_mco - 1; i > 0; --i) |
3535 u8c_c1 = mb_c; | 3542 u8cc[i] = u8cc[i - 1]; |
3543 u8cc[0] = mb_c; | |
3536 mb_c = ' '; | 3544 mb_c = ' '; |
3537 } | 3545 } |
3538 } | 3546 } |
3539 | 3547 |
3540 if ((mb_l == 1 && c >= 0x80) | 3548 if ((mb_l == 1 && c >= 0x80) |
3547 * Non-BMP character : display as ? or fullwidth ?. | 3555 * Non-BMP character : display as ? or fullwidth ?. |
3548 */ | 3556 */ |
3549 if (mb_c < 0x10000) | 3557 if (mb_c < 0x10000) |
3550 { | 3558 { |
3551 transchar_hex(extra, mb_c); | 3559 transchar_hex(extra, mb_c); |
3552 #ifdef FEAT_RIGHTLEFT | 3560 # ifdef FEAT_RIGHTLEFT |
3553 if (wp->w_p_rl) /* reverse */ | 3561 if (wp->w_p_rl) /* reverse */ |
3554 rl_mirror(extra); | 3562 rl_mirror(extra); |
3555 #endif | 3563 # endif |
3556 } | 3564 } |
3557 else if (utf_char2cells(mb_c) != 2) | 3565 else if (utf_char2cells(mb_c) != 2) |
3558 STRCPY(extra, "?"); | 3566 STRCPY(extra, "?"); |
3559 else | 3567 else |
3560 /* 0xff1f in UTF-8: full-width '?' */ | 3568 /* 0xff1f in UTF-8: full-width '?' */ |
3577 mb_l = 1; | 3585 mb_l = 1; |
3578 #ifdef FEAT_ARABIC | 3586 #ifdef FEAT_ARABIC |
3579 else if (p_arshape && !p_tbidi && ARABIC_CHAR(mb_c)) | 3587 else if (p_arshape && !p_tbidi && ARABIC_CHAR(mb_c)) |
3580 { | 3588 { |
3581 /* Do Arabic shaping. */ | 3589 /* Do Arabic shaping. */ |
3582 int pc, pc1, nc, dummy; | 3590 int pc, pc1, nc; |
3591 int pcc[MAX_MCO]; | |
3583 | 3592 |
3584 /* The idea of what is the previous and next | 3593 /* The idea of what is the previous and next |
3585 * character depends on 'rightleft'. */ | 3594 * character depends on 'rightleft'. */ |
3586 if (wp->w_p_rl) | 3595 if (wp->w_p_rl) |
3587 { | 3596 { |
3588 pc = prev_c; | 3597 pc = prev_c; |
3589 pc1 = prev_c1; | 3598 pc1 = prev_c1; |
3590 nc = utf_ptr2char(ptr + mb_l); | 3599 nc = utf_ptr2char(ptr + mb_l); |
3591 prev_c1 = u8c_c1; | 3600 prev_c1 = u8cc[0]; |
3592 } | 3601 } |
3593 else | 3602 else |
3594 { | 3603 { |
3595 pc = utfc_ptr2char(ptr + mb_l, &pc1, &dummy); | 3604 pc = utfc_ptr2char(ptr + mb_l, pcc); |
3596 nc = prev_c; | 3605 nc = prev_c; |
3606 pc1 = pcc[0]; | |
3597 } | 3607 } |
3598 prev_c = mb_c; | 3608 prev_c = mb_c; |
3599 | 3609 |
3600 mb_c = arabic_shape(mb_c, &c, &u8c_c1, pc, pc1, nc); | 3610 mb_c = arabic_shape(mb_c, &c, &u8cc[0], pc, pc1, nc); |
3601 } | 3611 } |
3602 else | 3612 else |
3603 prev_c = mb_c; | 3613 prev_c = mb_c; |
3604 #endif | 3614 #endif |
3605 } | 3615 } |
3702 #ifdef FEAT_MBYTE | 3712 #ifdef FEAT_MBYTE |
3703 mb_c = c; | 3713 mb_c = c; |
3704 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3714 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3705 { | 3715 { |
3706 mb_utf8 = TRUE; | 3716 mb_utf8 = TRUE; |
3707 u8c_c1 = u8c_c2 = 0; | 3717 u8cc[0] = 0; |
3708 } | 3718 } |
3709 else | 3719 else |
3710 mb_utf8 = FALSE; | 3720 mb_utf8 = FALSE; |
3711 #endif | 3721 #endif |
3712 } | 3722 } |
3864 #ifdef FEAT_MBYTE | 3874 #ifdef FEAT_MBYTE |
3865 mb_c = c; | 3875 mb_c = c; |
3866 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3876 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3867 { | 3877 { |
3868 mb_utf8 = TRUE; | 3878 mb_utf8 = TRUE; |
3869 u8c_c1 = u8c_c2 = 0; | 3879 u8cc[0] = 0; |
3870 } | 3880 } |
3871 else | 3881 else |
3872 mb_utf8 = FALSE; | 3882 mb_utf8 = FALSE; |
3873 #endif | 3883 #endif |
3874 } | 3884 } |
3902 #ifdef FEAT_MBYTE | 3912 #ifdef FEAT_MBYTE |
3903 mb_c = c; | 3913 mb_c = c; |
3904 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3914 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3905 { | 3915 { |
3906 mb_utf8 = TRUE; | 3916 mb_utf8 = TRUE; |
3907 u8c_c1 = u8c_c2 = 0; | 3917 u8cc[0] = 0; |
3908 } | 3918 } |
3909 #endif | 3919 #endif |
3910 } | 3920 } |
3911 else | 3921 else |
3912 { | 3922 { |
3976 #ifdef FEAT_MBYTE | 3986 #ifdef FEAT_MBYTE |
3977 mb_c = c; | 3987 mb_c = c; |
3978 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3988 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3979 { | 3989 { |
3980 mb_utf8 = TRUE; | 3990 mb_utf8 = TRUE; |
3981 u8c_c1 = u8c_c2 = 0; | 3991 u8cc[0] = 0; |
3982 } | 3992 } |
3983 else | 3993 else |
3984 mb_utf8 = FALSE; /* don't draw as UTF-8 */ | 3994 mb_utf8 = FALSE; /* don't draw as UTF-8 */ |
3985 #endif | 3995 #endif |
3986 } | 3996 } |
4115 #ifdef FEAT_MBYTE | 4125 #ifdef FEAT_MBYTE |
4116 mb_c = c; | 4126 mb_c = c; |
4117 if (enc_utf8 && (*mb_char2len)(c) > 1) | 4127 if (enc_utf8 && (*mb_char2len)(c) > 1) |
4118 { | 4128 { |
4119 mb_utf8 = TRUE; | 4129 mb_utf8 = TRUE; |
4120 u8c_c1 = u8c_c2 = 0; | 4130 u8cc[0] = 0; |
4121 } | 4131 } |
4122 else | 4132 else |
4123 mb_utf8 = FALSE; /* don't draw as UTF-8 */ | 4133 mb_utf8 = FALSE; /* don't draw as UTF-8 */ |
4124 #endif | 4134 #endif |
4125 if (!attr_pri) | 4135 if (!attr_pri) |
4245 #ifdef FEAT_MBYTE | 4255 #ifdef FEAT_MBYTE |
4246 mb_c = c; | 4256 mb_c = c; |
4247 if (enc_utf8 && (*mb_char2len)(c) > 1) | 4257 if (enc_utf8 && (*mb_char2len)(c) > 1) |
4248 { | 4258 { |
4249 mb_utf8 = TRUE; | 4259 mb_utf8 = TRUE; |
4250 u8c_c1 = u8c_c2 = 0; | 4260 u8cc[0] = 0; |
4251 } | 4261 } |
4252 else | 4262 else |
4253 mb_utf8 = FALSE; | 4263 mb_utf8 = FALSE; |
4254 #endif | 4264 #endif |
4255 } | 4265 } |
4279 else if (enc_utf8) | 4289 else if (enc_utf8) |
4280 { | 4290 { |
4281 if (mb_utf8) | 4291 if (mb_utf8) |
4282 { | 4292 { |
4283 ScreenLinesUC[off] = mb_c; | 4293 ScreenLinesUC[off] = mb_c; |
4284 ScreenLinesC1[off] = u8c_c1; | 4294 for (i = 0; i < Screen_mco; ++i) |
4285 ScreenLinesC2[off] = u8c_c2; | 4295 { |
4296 ScreenLinesC[i][off] = u8cc[i]; | |
4297 if (u8cc[i] == 0) | |
4298 break; | |
4299 } | |
4286 } | 4300 } |
4287 else | 4301 else |
4288 ScreenLinesUC[off] = 0; | 4302 ScreenLinesUC[off] = 0; |
4289 } | 4303 } |
4290 if (multi_attr) | 4304 if (multi_attr) |
4510 #endif | 4524 #endif |
4511 | 4525 |
4512 return row; | 4526 return row; |
4513 } | 4527 } |
4514 | 4528 |
4529 #ifdef FEAT_MBYTE | |
4530 static int comp_char_differs __ARGS((int, int)); | |
4531 | |
4532 /* | |
4533 * Return if the composing characters at "off_from" and "off_to" differ. | |
4534 */ | |
4535 static int | |
4536 comp_char_differs(off_from, off_to) | |
4537 int off_from; | |
4538 int off_to; | |
4539 { | |
4540 int i; | |
4541 | |
4542 for (i = 0; i < Screen_mco; ++i) | |
4543 { | |
4544 if (ScreenLinesC[i][off_from] != ScreenLinesC[i][off_to]) | |
4545 return TRUE; | |
4546 if (ScreenLinesC[i][off_from] == 0) | |
4547 break; | |
4548 } | |
4549 return FALSE; | |
4550 } | |
4551 #endif | |
4552 | |
4515 /* | 4553 /* |
4516 * Check whether the given character needs redrawing: | 4554 * Check whether the given character needs redrawing: |
4517 * - the (first byte of the) character is different | 4555 * - the (first byte of the) character is different |
4518 * - the attributes are different | 4556 * - the attributes are different |
4519 * - the character is multi-byte and the next byte is different | 4557 * - the character is multi-byte and the next byte is different |
4536 : (cols > 1 && ScreenLines[off_from + 1] | 4574 : (cols > 1 && ScreenLines[off_from + 1] |
4537 != ScreenLines[off_to + 1]))) | 4575 != ScreenLines[off_to + 1]))) |
4538 || (enc_utf8 | 4576 || (enc_utf8 |
4539 && (ScreenLinesUC[off_from] != ScreenLinesUC[off_to] | 4577 && (ScreenLinesUC[off_from] != ScreenLinesUC[off_to] |
4540 || (ScreenLinesUC[off_from] != 0 | 4578 || (ScreenLinesUC[off_from] != 0 |
4541 && (ScreenLinesC1[off_from] | 4579 && comp_char_differs(off_from, off_to)))) |
4542 != ScreenLinesC1[off_to] | |
4543 || ScreenLinesC2[off_from] | |
4544 != ScreenLinesC2[off_to])))) | |
4545 #endif | 4580 #endif |
4546 )) | 4581 )) |
4547 return TRUE; | 4582 return TRUE; |
4548 return FALSE; | 4583 return FALSE; |
4549 } | 4584 } |
4751 if (enc_utf8) | 4786 if (enc_utf8) |
4752 { | 4787 { |
4753 ScreenLinesUC[off_to] = ScreenLinesUC[off_from]; | 4788 ScreenLinesUC[off_to] = ScreenLinesUC[off_from]; |
4754 if (ScreenLinesUC[off_from] != 0) | 4789 if (ScreenLinesUC[off_from] != 0) |
4755 { | 4790 { |
4756 ScreenLinesC1[off_to] = ScreenLinesC1[off_from]; | 4791 int i; |
4757 ScreenLinesC2[off_to] = ScreenLinesC2[off_from]; | 4792 |
4793 for (i = 0; i < Screen_mco; ++i) | |
4794 ScreenLinesC[i][off_to] = ScreenLinesC[i][off_from]; | |
4758 } | 4795 } |
4759 } | 4796 } |
4760 if (char_cells == 2) | 4797 if (char_cells == 2) |
4761 ScreenLines[off_to + 1] = ScreenLines[off_from + 1]; | 4798 ScreenLines[off_to + 1] = ScreenLines[off_from + 1]; |
4762 #endif | 4799 #endif |
4890 int c; | 4927 int c; |
4891 | 4928 |
4892 c = fillchar_vsep(&hl); | 4929 c = fillchar_vsep(&hl); |
4893 if (ScreenLines[off_to] != c | 4930 if (ScreenLines[off_to] != c |
4894 # ifdef FEAT_MBYTE | 4931 # ifdef FEAT_MBYTE |
4895 || (enc_utf8 | 4932 || (enc_utf8 && (int)ScreenLinesUC[off_to] |
4896 && ScreenLinesUC[off_to] != (c >= 0x80 ? c : 0)) | 4933 != (c >= 0x80 ? c : 0)) |
4897 # endif | 4934 # endif |
4898 || ScreenAttrs[off_to] != hl) | 4935 || ScreenAttrs[off_to] != hl) |
4899 { | 4936 { |
4900 ScreenLines[off_to] = c; | 4937 ScreenLines[off_to] = c; |
4901 ScreenAttrs[off_to] = hl; | 4938 ScreenAttrs[off_to] = hl; |
4903 if (enc_utf8) | 4940 if (enc_utf8) |
4904 { | 4941 { |
4905 if (c >= 0x80) | 4942 if (c >= 0x80) |
4906 { | 4943 { |
4907 ScreenLinesUC[off_to] = c; | 4944 ScreenLinesUC[off_to] = c; |
4908 ScreenLinesC1[off_to] = 0; | 4945 ScreenLinesC[0][off_to] = 0; |
4909 ScreenLinesC2[off_to] = 0; | |
4910 } | 4946 } |
4911 else | 4947 else |
4912 ScreenLinesUC[off_to] = 0; | 4948 ScreenLinesUC[off_to] = 0; |
4913 } | 4949 } |
4914 # endif | 4950 # endif |
5551 | 5587 |
5552 curbuf = wp->w_buffer; | 5588 curbuf = wp->w_buffer; |
5553 curwin = wp; | 5589 curwin = wp; |
5554 STRCPY(buf, "b:keymap_name"); /* must be writable */ | 5590 STRCPY(buf, "b:keymap_name"); /* must be writable */ |
5555 ++emsg_skip; | 5591 ++emsg_skip; |
5556 s = p = eval_to_string(buf, NULL); | 5592 s = p = eval_to_string(buf, NULL, FALSE); |
5557 --emsg_skip; | 5593 --emsg_skip; |
5558 curbuf = old_curbuf; | 5594 curbuf = old_curbuf; |
5559 curwin = old_curwin; | 5595 curwin = old_curwin; |
5560 if (p == NULL || *p == NUL) | 5596 if (p == NULL || *p == NUL) |
5561 #endif | 5597 #endif |
5803 } | 5839 } |
5804 #endif | 5840 #endif |
5805 } | 5841 } |
5806 } | 5842 } |
5807 | 5843 |
5844 #ifdef FEAT_MBYTE | |
5845 static int screen_comp_differs __ARGS((int, int*)); | |
5846 | |
5847 /* | |
5848 * Return TRUE if composing characters for screen posn "off" differs from | |
5849 * composing characters in "u8cc". | |
5850 */ | |
5851 static int | |
5852 screen_comp_differs(off, u8cc) | |
5853 int off; | |
5854 int *u8cc; | |
5855 { | |
5856 int i; | |
5857 | |
5858 for (i = 0; i < Screen_mco; ++i) | |
5859 { | |
5860 if (ScreenLinesC[i][off] != (u8char_T)u8cc[i]) | |
5861 return TRUE; | |
5862 if (u8cc[i] == 0) | |
5863 break; | |
5864 } | |
5865 return FALSE; | |
5866 } | |
5867 #endif | |
5868 | |
5808 /* | 5869 /* |
5809 * Put string '*text' on the screen at position 'row' and 'col', with | 5870 * Put string '*text' on the screen at position 'row' and 'col', with |
5810 * attributes 'attr', and update ScreenLines[] and ScreenAttrs[]. | 5871 * attributes 'attr', and update ScreenLines[] and ScreenAttrs[]. |
5811 * Note: only outputs within one row, message is truncated at screen boundary! | 5872 * Note: only outputs within one row, message is truncated at screen boundary! |
5812 * Note: if ScreenLines[], row and/or col is invalid, nothing is done. | 5873 * Note: if ScreenLines[], row and/or col is invalid, nothing is done. |
5838 int c; | 5899 int c; |
5839 #ifdef FEAT_MBYTE | 5900 #ifdef FEAT_MBYTE |
5840 int mbyte_blen = 1; | 5901 int mbyte_blen = 1; |
5841 int mbyte_cells = 1; | 5902 int mbyte_cells = 1; |
5842 int u8c = 0; | 5903 int u8c = 0; |
5843 int u8c_c1 = 0; | 5904 int u8cc[MAX_MCO]; |
5844 int u8c_c2 = 0; | |
5845 int clear_next_cell = FALSE; | 5905 int clear_next_cell = FALSE; |
5846 # ifdef FEAT_ARABIC | 5906 # ifdef FEAT_ARABIC |
5847 int prev_c = 0; /* previous Arabic character */ | 5907 int prev_c = 0; /* previous Arabic character */ |
5848 int pc, nc, nc1, dummy; | 5908 int pc, nc, nc1; |
5909 int pcc[MAX_MCO]; | |
5849 # endif | 5910 # endif |
5850 #endif | 5911 #endif |
5851 | 5912 |
5852 if (ScreenLines == NULL || row >= screen_Rows) /* safety check */ | 5913 if (ScreenLines == NULL || row >= screen_Rows) /* safety check */ |
5853 return; | 5914 return; |
5870 else if (enc_dbcs != 0) | 5931 else if (enc_dbcs != 0) |
5871 mbyte_cells = mbyte_blen; | 5932 mbyte_cells = mbyte_blen; |
5872 else /* enc_utf8 */ | 5933 else /* enc_utf8 */ |
5873 { | 5934 { |
5874 if (len >= 0) | 5935 if (len >= 0) |
5875 u8c = utfc_ptr2char_len(ptr, &u8c_c1, &u8c_c2, | 5936 u8c = utfc_ptr2char_len(ptr, u8cc, |
5876 (int)((text + len) - ptr)); | 5937 (int)((text + len) - ptr)); |
5877 else | 5938 else |
5878 u8c = utfc_ptr2char(ptr, &u8c_c1, &u8c_c2); | 5939 u8c = utfc_ptr2char(ptr, u8cc); |
5879 mbyte_cells = utf_char2cells(u8c); | 5940 mbyte_cells = utf_char2cells(u8c); |
5880 /* Non-BMP character: display as ? or fullwidth ?. */ | 5941 /* Non-BMP character: display as ? or fullwidth ?. */ |
5881 if (u8c >= 0x10000) | 5942 if (u8c >= 0x10000) |
5882 { | 5943 { |
5883 u8c = (mbyte_cells == 2) ? 0xff1f : (int)'?'; | 5944 u8c = (mbyte_cells == 2) ? 0xff1f : (int)'?'; |
5893 /* Past end of string to be displayed. */ | 5954 /* Past end of string to be displayed. */ |
5894 nc = NUL; | 5955 nc = NUL; |
5895 nc1 = NUL; | 5956 nc1 = NUL; |
5896 } | 5957 } |
5897 else | 5958 else |
5898 nc = utfc_ptr2char(ptr + mbyte_blen, &nc1, &dummy); | 5959 { |
5960 nc = utfc_ptr2char(ptr + mbyte_blen, pcc); | |
5961 nc1 = pcc[0]; | |
5962 } | |
5899 pc = prev_c; | 5963 pc = prev_c; |
5900 prev_c = u8c; | 5964 prev_c = u8c; |
5901 u8c = arabic_shape(u8c, &c, &u8c_c1, nc, nc1, pc); | 5965 u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc); |
5902 } | 5966 } |
5903 else | 5967 else |
5904 prev_c = u8c; | 5968 prev_c = u8c; |
5905 # endif | 5969 # endif |
5906 } | 5970 } |
5913 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0)) | 5977 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0)) |
5914 || (enc_dbcs == DBCS_JPNU | 5978 || (enc_dbcs == DBCS_JPNU |
5915 && c == 0x8e | 5979 && c == 0x8e |
5916 && ScreenLines2[off] != ptr[1]) | 5980 && ScreenLines2[off] != ptr[1]) |
5917 || (enc_utf8 | 5981 || (enc_utf8 |
5918 && mbyte_blen > 1 | 5982 && (ScreenLinesUC[off] != (u8char_T)u8c |
5919 && (ScreenLinesUC[off] != u8c | 5983 || screen_comp_differs(off, u8cc))) |
5920 || ScreenLinesC1[off] != u8c_c1 | |
5921 || ScreenLinesC2[off] != u8c_c2)) | |
5922 #endif | 5984 #endif |
5923 || ScreenAttrs[off] != attr | 5985 || ScreenAttrs[off] != attr |
5924 || exmode_active | 5986 || exmode_active |
5925 ) | 5987 ) |
5926 { | 5988 { |
5992 ScreenLines[off] = c; | 6054 ScreenLines[off] = c; |
5993 ScreenAttrs[off] = attr; | 6055 ScreenAttrs[off] = attr; |
5994 #ifdef FEAT_MBYTE | 6056 #ifdef FEAT_MBYTE |
5995 if (enc_utf8) | 6057 if (enc_utf8) |
5996 { | 6058 { |
5997 if (c < 0x80 && u8c_c1 == 0 && u8c_c2 == 0) | 6059 if (c < 0x80 && u8cc[0] == 0) |
5998 ScreenLinesUC[off] = 0; | 6060 ScreenLinesUC[off] = 0; |
5999 else | 6061 else |
6000 { | 6062 { |
6063 int i; | |
6064 | |
6001 ScreenLinesUC[off] = u8c; | 6065 ScreenLinesUC[off] = u8c; |
6002 ScreenLinesC1[off] = u8c_c1; | 6066 for (i = 0; i < Screen_mco; ++i) |
6003 ScreenLinesC2[off] = u8c_c2; | 6067 { |
6068 ScreenLinesC[i][off] = u8cc[i]; | |
6069 if (u8cc[i] == 0) | |
6070 break; | |
6071 } | |
6004 } | 6072 } |
6005 if (mbyte_cells == 2) | 6073 if (mbyte_cells == 2) |
6006 { | 6074 { |
6007 ScreenLines[off + 1] = 0; | 6075 ScreenLines[off + 1] = 0; |
6008 ScreenAttrs[off + 1] = attr; | 6076 ScreenAttrs[off + 1] = attr; |
6713 c = c1; | 6781 c = c1; |
6714 for (col = start_col; col < end_col; ++col) | 6782 for (col = start_col; col < end_col; ++col) |
6715 { | 6783 { |
6716 if (ScreenLines[off] != c | 6784 if (ScreenLines[off] != c |
6717 #ifdef FEAT_MBYTE | 6785 #ifdef FEAT_MBYTE |
6718 || (enc_utf8 && ScreenLinesUC[off] != (c >= 0x80 ? c : 0)) | 6786 || (enc_utf8 && (int)ScreenLinesUC[off] |
6787 != (c >= 0x80 ? c : 0)) | |
6719 #endif | 6788 #endif |
6720 || ScreenAttrs[off] != attr | 6789 || ScreenAttrs[off] != attr |
6721 #if defined(FEAT_GUI) || defined(UNIX) | 6790 #if defined(FEAT_GUI) || defined(UNIX) |
6722 || force_next | 6791 || force_next |
6723 #endif | 6792 #endif |
6753 if (enc_utf8) | 6822 if (enc_utf8) |
6754 { | 6823 { |
6755 if (c >= 0x80) | 6824 if (c >= 0x80) |
6756 { | 6825 { |
6757 ScreenLinesUC[off] = c; | 6826 ScreenLinesUC[off] = c; |
6758 ScreenLinesC1[off] = 0; | 6827 ScreenLinesC[0][off] = 0; |
6759 ScreenLinesC2[off] = 0; | |
6760 } | 6828 } |
6761 else | 6829 else |
6762 ScreenLinesUC[off] = 0; | 6830 ScreenLinesUC[off] = 0; |
6763 } | 6831 } |
6764 #endif | 6832 #endif |
6843 int outofmem = FALSE; | 6911 int outofmem = FALSE; |
6844 int len; | 6912 int len; |
6845 schar_T *new_ScreenLines; | 6913 schar_T *new_ScreenLines; |
6846 #ifdef FEAT_MBYTE | 6914 #ifdef FEAT_MBYTE |
6847 u8char_T *new_ScreenLinesUC = NULL; | 6915 u8char_T *new_ScreenLinesUC = NULL; |
6848 u8char_T *new_ScreenLinesC1 = NULL; | 6916 u8char_T *new_ScreenLinesC[MAX_MCO]; |
6849 u8char_T *new_ScreenLinesC2 = NULL; | |
6850 schar_T *new_ScreenLines2 = NULL; | 6917 schar_T *new_ScreenLines2 = NULL; |
6918 int i; | |
6851 #endif | 6919 #endif |
6852 sattr_T *new_ScreenAttrs; | 6920 sattr_T *new_ScreenAttrs; |
6853 unsigned *new_LineOffset; | 6921 unsigned *new_LineOffset; |
6854 char_u *new_LineWraps; | 6922 char_u *new_LineWraps; |
6855 #ifdef FEAT_WINDOWS | 6923 #ifdef FEAT_WINDOWS |
6868 && Rows == screen_Rows | 6936 && Rows == screen_Rows |
6869 && Columns == screen_Columns | 6937 && Columns == screen_Columns |
6870 #ifdef FEAT_MBYTE | 6938 #ifdef FEAT_MBYTE |
6871 && enc_utf8 == (ScreenLinesUC != NULL) | 6939 && enc_utf8 == (ScreenLinesUC != NULL) |
6872 && (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL) | 6940 && (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL) |
6941 && p_mco == Screen_mco | |
6873 #endif | 6942 #endif |
6874 ) | 6943 ) |
6875 || Rows == 0 | 6944 || Rows == 0 |
6876 || Columns == 0 | 6945 || Columns == 0 |
6877 || (!full_screen && ScreenLines == NULL)) | 6946 || (!full_screen && ScreenLines == NULL)) |
6905 win_free_lsize(wp); | 6974 win_free_lsize(wp); |
6906 | 6975 |
6907 new_ScreenLines = (schar_T *)lalloc((long_u)( | 6976 new_ScreenLines = (schar_T *)lalloc((long_u)( |
6908 (Rows + 1) * Columns * sizeof(schar_T)), FALSE); | 6977 (Rows + 1) * Columns * sizeof(schar_T)), FALSE); |
6909 #ifdef FEAT_MBYTE | 6978 #ifdef FEAT_MBYTE |
6979 vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T) * MAX_MCO); | |
6910 if (enc_utf8) | 6980 if (enc_utf8) |
6911 { | 6981 { |
6912 new_ScreenLinesUC = (u8char_T *)lalloc((long_u)( | 6982 new_ScreenLinesUC = (u8char_T *)lalloc((long_u)( |
6913 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE); | 6983 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE); |
6914 new_ScreenLinesC1 = (u8char_T *)lalloc((long_u)( | 6984 for (i = 0; i < p_mco; ++i) |
6915 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE); | 6985 new_ScreenLinesC[i] = (u8char_T *)lalloc((long_u)( |
6916 new_ScreenLinesC2 = (u8char_T *)lalloc((long_u)( | |
6917 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE); | 6986 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE); |
6918 } | 6987 } |
6919 if (enc_dbcs == DBCS_JPNU) | 6988 if (enc_dbcs == DBCS_JPNU) |
6920 new_ScreenLines2 = (schar_T *)lalloc((long_u)( | 6989 new_ScreenLines2 = (schar_T *)lalloc((long_u)( |
6921 (Rows + 1) * Columns * sizeof(schar_T)), FALSE); | 6990 (Rows + 1) * Columns * sizeof(schar_T)), FALSE); |
6938 break; | 7007 break; |
6939 #endif | 7008 #endif |
6940 } | 7009 } |
6941 } | 7010 } |
6942 | 7011 |
7012 #ifdef FEAT_MBYTE | |
7013 for (i = 0; i < p_mco; ++i) | |
7014 if (new_ScreenLinesC[i] == NULL) | |
7015 break; | |
7016 #endif | |
6943 if (new_ScreenLines == NULL | 7017 if (new_ScreenLines == NULL |
6944 #ifdef FEAT_MBYTE | 7018 #ifdef FEAT_MBYTE |
6945 || (enc_utf8 && (new_ScreenLinesUC == NULL | 7019 || (enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco)) |
6946 || new_ScreenLinesC1 == NULL || new_ScreenLinesC2 == NULL)) | |
6947 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) | 7020 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) |
6948 #endif | 7021 #endif |
6949 || new_ScreenAttrs == NULL | 7022 || new_ScreenAttrs == NULL |
6950 || new_LineOffset == NULL | 7023 || new_LineOffset == NULL |
6951 || new_LineWraps == NULL | 7024 || new_LineWraps == NULL |
6966 vim_free(new_ScreenLines); | 7039 vim_free(new_ScreenLines); |
6967 new_ScreenLines = NULL; | 7040 new_ScreenLines = NULL; |
6968 #ifdef FEAT_MBYTE | 7041 #ifdef FEAT_MBYTE |
6969 vim_free(new_ScreenLinesUC); | 7042 vim_free(new_ScreenLinesUC); |
6970 new_ScreenLinesUC = NULL; | 7043 new_ScreenLinesUC = NULL; |
6971 vim_free(new_ScreenLinesC1); | 7044 for (i = 0; i < p_mco; ++i) |
6972 new_ScreenLinesC1 = NULL; | 7045 { |
6973 vim_free(new_ScreenLinesC2); | 7046 vim_free(new_ScreenLinesC[i]); |
6974 new_ScreenLinesC2 = NULL; | 7047 new_ScreenLinesC[i] = NULL; |
7048 } | |
6975 vim_free(new_ScreenLines2); | 7049 vim_free(new_ScreenLines2); |
6976 new_ScreenLines2 = NULL; | 7050 new_ScreenLines2 = NULL; |
6977 #endif | 7051 #endif |
6978 vim_free(new_ScreenAttrs); | 7052 vim_free(new_ScreenAttrs); |
6979 new_ScreenAttrs = NULL; | 7053 new_ScreenAttrs = NULL; |
7008 #ifdef FEAT_MBYTE | 7082 #ifdef FEAT_MBYTE |
7009 if (enc_utf8) | 7083 if (enc_utf8) |
7010 { | 7084 { |
7011 (void)vim_memset(new_ScreenLinesUC + new_row * Columns, | 7085 (void)vim_memset(new_ScreenLinesUC + new_row * Columns, |
7012 0, (size_t)Columns * sizeof(u8char_T)); | 7086 0, (size_t)Columns * sizeof(u8char_T)); |
7013 (void)vim_memset(new_ScreenLinesC1 + new_row * Columns, | 7087 for (i = 0; i < p_mco; ++i) |
7014 0, (size_t)Columns * sizeof(u8char_T)); | 7088 (void)vim_memset(new_ScreenLinesC[i] |
7015 (void)vim_memset(new_ScreenLinesC2 + new_row * Columns, | 7089 + new_row * Columns, |
7016 0, (size_t)Columns * sizeof(u8char_T)); | 7090 0, (size_t)Columns * sizeof(u8char_T)); |
7017 } | 7091 } |
7018 if (enc_dbcs == DBCS_JPNU) | 7092 if (enc_dbcs == DBCS_JPNU) |
7019 (void)vim_memset(new_ScreenLines2 + new_row * Columns, | 7093 (void)vim_memset(new_ScreenLines2 + new_row * Columns, |
7020 0, (size_t)Columns * sizeof(schar_T)); | 7094 0, (size_t)Columns * sizeof(schar_T)); |
7028 len = screen_Columns; | 7102 len = screen_Columns; |
7029 else | 7103 else |
7030 len = Columns; | 7104 len = Columns; |
7031 #ifdef FEAT_MBYTE | 7105 #ifdef FEAT_MBYTE |
7032 /* When switching to utf-8 don't copy characters, they | 7106 /* When switching to utf-8 don't copy characters, they |
7033 * may be invalid now. */ | 7107 * may be invalid now. Also when p_mco changes. */ |
7034 if (!(enc_utf8 && ScreenLinesUC == NULL)) | 7108 if (!(enc_utf8 && ScreenLinesUC == NULL) |
7109 && p_mco == Screen_mco) | |
7035 #endif | 7110 #endif |
7036 mch_memmove(new_ScreenLines + new_LineOffset[new_row], | 7111 mch_memmove(new_ScreenLines + new_LineOffset[new_row], |
7037 ScreenLines + LineOffset[old_row], | 7112 ScreenLines + LineOffset[old_row], |
7038 (size_t)len * sizeof(schar_T)); | 7113 (size_t)len * sizeof(schar_T)); |
7039 #ifdef FEAT_MBYTE | 7114 #ifdef FEAT_MBYTE |
7040 if (enc_utf8 && ScreenLinesUC != NULL) | 7115 if (enc_utf8 && ScreenLinesUC != NULL |
7116 && p_mco == Screen_mco) | |
7041 { | 7117 { |
7042 mch_memmove(new_ScreenLinesUC + new_LineOffset[new_row], | 7118 mch_memmove(new_ScreenLinesUC + new_LineOffset[new_row], |
7043 ScreenLinesUC + LineOffset[old_row], | 7119 ScreenLinesUC + LineOffset[old_row], |
7044 (size_t)len * sizeof(u8char_T)); | 7120 (size_t)len * sizeof(u8char_T)); |
7045 mch_memmove(new_ScreenLinesC1 + new_LineOffset[new_row], | 7121 for (i = 0; i < p_mco; ++i) |
7046 ScreenLinesC1 + LineOffset[old_row], | 7122 mch_memmove(new_ScreenLinesC[i] |
7047 (size_t)len * sizeof(u8char_T)); | 7123 + new_LineOffset[new_row], |
7048 mch_memmove(new_ScreenLinesC2 + new_LineOffset[new_row], | 7124 ScreenLinesC[i] + LineOffset[old_row], |
7049 ScreenLinesC2 + LineOffset[old_row], | |
7050 (size_t)len * sizeof(u8char_T)); | 7125 (size_t)len * sizeof(u8char_T)); |
7051 } | 7126 } |
7052 if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL) | 7127 if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL) |
7053 mch_memmove(new_ScreenLines2 + new_LineOffset[new_row], | 7128 mch_memmove(new_ScreenLines2 + new_LineOffset[new_row], |
7054 ScreenLines2 + LineOffset[old_row], | 7129 ScreenLines2 + LineOffset[old_row], |
7067 free_screenlines(); | 7142 free_screenlines(); |
7068 | 7143 |
7069 ScreenLines = new_ScreenLines; | 7144 ScreenLines = new_ScreenLines; |
7070 #ifdef FEAT_MBYTE | 7145 #ifdef FEAT_MBYTE |
7071 ScreenLinesUC = new_ScreenLinesUC; | 7146 ScreenLinesUC = new_ScreenLinesUC; |
7072 ScreenLinesC1 = new_ScreenLinesC1; | 7147 for (i = 0; i < p_mco; ++i) |
7073 ScreenLinesC2 = new_ScreenLinesC2; | 7148 ScreenLinesC[i] = new_ScreenLinesC[i]; |
7149 Screen_mco = p_mco; | |
7074 ScreenLines2 = new_ScreenLines2; | 7150 ScreenLines2 = new_ScreenLines2; |
7075 #endif | 7151 #endif |
7076 ScreenAttrs = new_ScreenAttrs; | 7152 ScreenAttrs = new_ScreenAttrs; |
7077 LineOffset = new_LineOffset; | 7153 LineOffset = new_LineOffset; |
7078 LineWraps = new_LineWraps; | 7154 LineWraps = new_LineWraps; |
7116 } | 7192 } |
7117 | 7193 |
7118 void | 7194 void |
7119 free_screenlines() | 7195 free_screenlines() |
7120 { | 7196 { |
7197 #ifdef FEAT_MBYTE | |
7198 int i; | |
7199 | |
7200 vim_free(ScreenLinesUC); | |
7201 for (i = 0; i < Screen_mco; ++i) | |
7202 vim_free(ScreenLinesC[i]); | |
7203 vim_free(ScreenLines2); | |
7204 #endif | |
7121 vim_free(ScreenLines); | 7205 vim_free(ScreenLines); |
7122 #ifdef FEAT_MBYTE | |
7123 vim_free(ScreenLinesUC); | |
7124 vim_free(ScreenLinesC1); | |
7125 vim_free(ScreenLinesC2); | |
7126 vim_free(ScreenLines2); | |
7127 #endif | |
7128 vim_free(ScreenAttrs); | 7206 vim_free(ScreenAttrs); |
7129 vim_free(LineOffset); | 7207 vim_free(LineOffset); |
7130 vim_free(LineWraps); | 7208 vim_free(LineWraps); |
7131 #ifdef FEAT_WINDOWS | 7209 #ifdef FEAT_WINDOWS |
7132 vim_free(TabPageIdxs); | 7210 vim_free(TabPageIdxs); |
7248 mch_memmove(ScreenLines + off_to, ScreenLines + off_from, | 7326 mch_memmove(ScreenLines + off_to, ScreenLines + off_from, |
7249 wp->w_width * sizeof(schar_T)); | 7327 wp->w_width * sizeof(schar_T)); |
7250 # ifdef FEAT_MBYTE | 7328 # ifdef FEAT_MBYTE |
7251 if (enc_utf8) | 7329 if (enc_utf8) |
7252 { | 7330 { |
7331 int i; | |
7332 | |
7253 mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from, | 7333 mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from, |
7254 wp->w_width * sizeof(u8char_T)); | 7334 wp->w_width * sizeof(u8char_T)); |
7255 mch_memmove(ScreenLinesC1 + off_to, ScreenLinesC1 + off_from, | 7335 for (i = 0; i < p_mco; ++i) |
7256 wp->w_width * sizeof(u8char_T)); | 7336 mch_memmove(ScreenLinesC[i] + off_to, ScreenLinesC[i] + off_from, |
7257 mch_memmove(ScreenLinesC2 + off_to, ScreenLinesC2 + off_from, | 7337 wp->w_width * sizeof(u8char_T)); |
7258 wp->w_width * sizeof(u8char_T)); | |
7259 } | 7338 } |
7260 if (enc_dbcs == DBCS_JPNU) | 7339 if (enc_dbcs == DBCS_JPNU) |
7261 mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from, | 7340 mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from, |
7262 wp->w_width * sizeof(schar_T)); | 7341 wp->w_width * sizeof(schar_T)); |
7263 # endif | 7342 # endif |