Mercurial > vim
comparison src/screen.c @ 819:23f82b5d2814 v7.0c10
updated for version 7.0c10
author | vimboss |
---|---|
date | Wed, 05 Apr 2006 20:41:53 +0000 |
parents | 1f929f3ca806 |
children | 57c7403f6599 |
comparison
equal
deleted
inserted
replaced
818:1f929f3ca806 | 819:23f82b5d2814 |
---|---|
3322 char_attr = 0; | 3322 char_attr = 0; |
3323 } | 3323 } |
3324 } | 3324 } |
3325 | 3325 |
3326 /* When still displaying '$' of change command, stop at cursor */ | 3326 /* When still displaying '$' of change command, stop at cursor */ |
3327 if (dollar_vcol != 0 && wp == curwin && vcol >= (long)wp->w_virtcol | 3327 if (dollar_vcol != 0 && wp == curwin |
3328 && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol | |
3328 #ifdef FEAT_DIFF | 3329 #ifdef FEAT_DIFF |
3329 && filler_todo <= 0 | 3330 && filler_todo <= 0 |
3330 #endif | 3331 #endif |
3331 ) | 3332 ) |
3332 { | 3333 { |
3333 SCREEN_LINE(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp), | 3334 SCREEN_LINE(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp), |
3334 wp->w_p_rl); | 3335 wp->w_p_rl); |
3335 /* Pretend we have finished updating the window. */ | 3336 /* Pretend we have finished updating the window. Except when |
3336 row = wp->w_height; | 3337 * 'cursorcolumn' is set. */ |
3338 #ifdef FEAT_SYN_HL | |
3339 if (wp->w_p_cuc) | |
3340 row = wp->w_cline_row + wp->w_cline_height; | |
3341 else | |
3342 #endif | |
3343 row = wp->w_height; | |
3337 break; | 3344 break; |
3338 } | 3345 } |
3339 | 3346 |
3340 if (draw_state == WL_LINE && area_highlighting) | 3347 if (draw_state == WL_LINE && area_highlighting) |
3341 { | 3348 { |
3483 mb_c = c; /* doesn't handle non-utf-8 multi-byte! */ | 3490 mb_c = c; /* doesn't handle non-utf-8 multi-byte! */ |
3484 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3491 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3485 { | 3492 { |
3486 mb_utf8 = TRUE; | 3493 mb_utf8 = TRUE; |
3487 u8cc[0] = 0; | 3494 u8cc[0] = 0; |
3495 c = 0xc0; | |
3488 } | 3496 } |
3489 else | 3497 else |
3490 mb_utf8 = FALSE; | 3498 mb_utf8 = FALSE; |
3491 #endif | 3499 #endif |
3492 } | 3500 } |
3507 mb_l = 1; | 3515 mb_l = 1; |
3508 else if (mb_l > 1) | 3516 else if (mb_l > 1) |
3509 { | 3517 { |
3510 mb_c = utfc_ptr2char(p_extra, u8cc); | 3518 mb_c = utfc_ptr2char(p_extra, u8cc); |
3511 mb_utf8 = TRUE; | 3519 mb_utf8 = TRUE; |
3520 c = 0xc0; | |
3512 } | 3521 } |
3513 } | 3522 } |
3514 else | 3523 else |
3515 { | 3524 { |
3516 /* if this is a DBCS character, put it in "mb_c" */ | 3525 /* if this is a DBCS character, put it in "mb_c" */ |
3742 } | 3751 } |
3743 #endif | 3752 #endif |
3744 ++ptr; | 3753 ++ptr; |
3745 | 3754 |
3746 /* 'list' : change char 160 to lcs_nbsp. */ | 3755 /* 'list' : change char 160 to lcs_nbsp. */ |
3747 if (wp->w_p_list && c == 160 && lcs_nbsp) | 3756 if (wp->w_p_list && (c == 160 |
3757 #ifdef FEAT_MBYTE | |
3758 || (mb_utf8 && mb_c == 160) | |
3759 #endif | |
3760 ) && lcs_nbsp) | |
3748 { | 3761 { |
3749 c = lcs_nbsp; | 3762 c = lcs_nbsp; |
3750 if (area_attr == 0 && search_attr == 0) | 3763 if (area_attr == 0 && search_attr == 0) |
3751 { | 3764 { |
3752 n_attr = 1; | 3765 n_attr = 1; |
3757 mb_c = c; | 3770 mb_c = c; |
3758 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3771 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3759 { | 3772 { |
3760 mb_utf8 = TRUE; | 3773 mb_utf8 = TRUE; |
3761 u8cc[0] = 0; | 3774 u8cc[0] = 0; |
3775 c = 0xc0; | |
3762 } | 3776 } |
3763 else | 3777 else |
3764 mb_utf8 = FALSE; | 3778 mb_utf8 = FALSE; |
3765 #endif | 3779 #endif |
3766 } | 3780 } |
3904 #ifdef FEAT_LINEBREAK | 3918 #ifdef FEAT_LINEBREAK |
3905 /* | 3919 /* |
3906 * Found last space before word: check for line break. | 3920 * Found last space before word: check for line break. |
3907 */ | 3921 */ |
3908 if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr) | 3922 if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr) |
3909 && !wp->w_p_list) | 3923 && !wp->w_p_list) |
3910 { | 3924 { |
3911 n_extra = win_lbr_chartabsize(wp, ptr - ( | 3925 n_extra = win_lbr_chartabsize(wp, ptr - ( |
3912 # ifdef FEAT_MBYTE | 3926 # ifdef FEAT_MBYTE |
3913 has_mbyte ? mb_l : | 3927 has_mbyte ? mb_l : |
3914 # endif | 3928 # endif |
3932 mb_c = c; | 3946 mb_c = c; |
3933 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3947 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3934 { | 3948 { |
3935 mb_utf8 = TRUE; | 3949 mb_utf8 = TRUE; |
3936 u8cc[0] = 0; | 3950 u8cc[0] = 0; |
3951 c = 0xc0; | |
3937 } | 3952 } |
3938 else | 3953 else |
3939 mb_utf8 = FALSE; | 3954 mb_utf8 = FALSE; |
3940 #endif | 3955 #endif |
3941 } | 3956 } |
3942 } | 3957 } |
3943 | 3958 |
3944 /* | 3959 /* |
3945 * Handling of non-printable characters. | 3960 * Handling of non-printable characters. |
3946 */ | 3961 */ |
3947 if (!(chartab[c] & CT_PRINT_CHAR)) | 3962 if (!(chartab[c & 0xff] & CT_PRINT_CHAR)) |
3948 { | 3963 { |
3949 /* | 3964 /* |
3950 * when getting a character from the file, we may have to | 3965 * when getting a character from the file, we may have to |
3951 * turn it into something else on the way to putting it | 3966 * turn it into something else on the way to putting it |
3952 * into "ScreenLines". | 3967 * into "ScreenLines". |
3970 mb_c = c; | 3985 mb_c = c; |
3971 if (enc_utf8 && (*mb_char2len)(c) > 1) | 3986 if (enc_utf8 && (*mb_char2len)(c) > 1) |
3972 { | 3987 { |
3973 mb_utf8 = TRUE; | 3988 mb_utf8 = TRUE; |
3974 u8cc[0] = 0; | 3989 u8cc[0] = 0; |
3990 c = 0xc0; | |
3975 } | 3991 } |
3976 #endif | 3992 #endif |
3977 } | 3993 } |
3978 else | 3994 else |
3979 { | 3995 { |
4044 mb_c = c; | 4060 mb_c = c; |
4045 if (enc_utf8 && (*mb_char2len)(c) > 1) | 4061 if (enc_utf8 && (*mb_char2len)(c) > 1) |
4046 { | 4062 { |
4047 mb_utf8 = TRUE; | 4063 mb_utf8 = TRUE; |
4048 u8cc[0] = 0; | 4064 u8cc[0] = 0; |
4065 c = 0xc0; | |
4049 } | 4066 } |
4050 else | 4067 else |
4051 mb_utf8 = FALSE; /* don't draw as UTF-8 */ | 4068 mb_utf8 = FALSE; /* don't draw as UTF-8 */ |
4052 #endif | 4069 #endif |
4053 } | 4070 } |
4183 mb_c = c; | 4200 mb_c = c; |
4184 if (enc_utf8 && (*mb_char2len)(c) > 1) | 4201 if (enc_utf8 && (*mb_char2len)(c) > 1) |
4185 { | 4202 { |
4186 mb_utf8 = TRUE; | 4203 mb_utf8 = TRUE; |
4187 u8cc[0] = 0; | 4204 u8cc[0] = 0; |
4205 c = 0xc0; | |
4188 } | 4206 } |
4189 else | 4207 else |
4190 mb_utf8 = FALSE; /* don't draw as UTF-8 */ | 4208 mb_utf8 = FALSE; /* don't draw as UTF-8 */ |
4191 #endif | 4209 #endif |
4192 if (!attr_pri) | 4210 if (!attr_pri) |
4276 /* Highlight 'cursorcolumn' past end of the line. */ | 4294 /* Highlight 'cursorcolumn' past end of the line. */ |
4277 if (wp->w_p_wrap) | 4295 if (wp->w_p_wrap) |
4278 v = wp->w_skipcol; | 4296 v = wp->w_skipcol; |
4279 else | 4297 else |
4280 v = wp->w_leftcol; | 4298 v = wp->w_leftcol; |
4281 if (vcol < v) /* line ends before left margin */ | 4299 if (vcol < v + col) /* line ends before left margin */ |
4282 vcol = v; | 4300 vcol = v + col; |
4283 if (wp->w_p_cuc | 4301 if (wp->w_p_cuc |
4284 && (int)wp->w_virtcol >= vcol | 4302 && (int)wp->w_virtcol >= vcol |
4285 && (int)wp->w_virtcol < W_WIDTH(wp) + v | 4303 && (int)wp->w_virtcol < W_WIDTH(wp) * (row - startrow + 1) |
4304 + v | |
4286 && lnum != wp->w_cursor.lnum | 4305 && lnum != wp->w_cursor.lnum |
4287 # ifdef FEAT_RIGHTLEFT | 4306 # ifdef FEAT_RIGHTLEFT |
4288 && !wp->w_p_rl | 4307 && !wp->w_p_rl |
4289 # endif | 4308 # endif |
4290 ) | 4309 ) |
4350 mb_c = c; | 4369 mb_c = c; |
4351 if (enc_utf8 && (*mb_char2len)(c) > 1) | 4370 if (enc_utf8 && (*mb_char2len)(c) > 1) |
4352 { | 4371 { |
4353 mb_utf8 = TRUE; | 4372 mb_utf8 = TRUE; |
4354 u8cc[0] = 0; | 4373 u8cc[0] = 0; |
4374 c = 0xc0; | |
4355 } | 4375 } |
4356 else | 4376 else |
4357 mb_utf8 = FALSE; | 4377 mb_utf8 = FALSE; |
4358 #endif | 4378 #endif |
4359 } | 4379 } |
4397 else if (enc_utf8) | 4417 else if (enc_utf8) |
4398 { | 4418 { |
4399 if (mb_utf8) | 4419 if (mb_utf8) |
4400 { | 4420 { |
4401 ScreenLinesUC[off] = mb_c; | 4421 ScreenLinesUC[off] = mb_c; |
4422 if ((c & 0xff) == 0) | |
4423 ScreenLines[off] = 0x80; /* avoid storing zero */ | |
4402 for (i = 0; i < Screen_mco; ++i) | 4424 for (i = 0; i < Screen_mco; ++i) |
4403 { | 4425 { |
4404 ScreenLinesC[i][off] = u8cc[i]; | 4426 ScreenLinesC[i][off] = u8cc[i]; |
4405 if (u8cc[i] == 0) | 4427 if (u8cc[i] == 0) |
4406 break; | 4428 break; |
4937 redraw_next = TRUE; | 4959 redraw_next = TRUE; |
4938 } | 4960 } |
4939 #endif | 4961 #endif |
4940 ScreenAttrs[off_to] = ScreenAttrs[off_from]; | 4962 ScreenAttrs[off_to] = ScreenAttrs[off_from]; |
4941 #ifdef FEAT_MBYTE | 4963 #ifdef FEAT_MBYTE |
4964 /* For simplicity set the attributes of second half of a | |
4965 * double-wide character equal to the first half. */ | |
4966 if (char_cells == 2) | |
4967 ScreenAttrs[off_to + 1] = ScreenAttrs[off_from]; | |
4968 | |
4942 if (enc_dbcs != 0 && char_cells == 2) | 4969 if (enc_dbcs != 0 && char_cells == 2) |
4943 { | |
4944 /* just a hack: It makes two bytes of DBCS have same attr */ | |
4945 ScreenAttrs[off_to + 1] = ScreenAttrs[off_from]; | |
4946 screen_char_2(off_to, row, col + coloff); | 4970 screen_char_2(off_to, row, col + coloff); |
4947 } | |
4948 else | 4971 else |
4949 #endif | 4972 #endif |
4950 screen_char(off_to, row, col + coloff); | 4973 screen_char(off_to, row, col + coloff); |
4951 } | 4974 } |
4952 else if ( p_wiv | 4975 else if ( p_wiv |
8891 room = scol - col + tabwidth - 1; | 8914 room = scol - col + tabwidth - 1; |
8892 if (room > 0) | 8915 if (room > 0) |
8893 { | 8916 { |
8894 /* Get buffer name in NameBuff[] */ | 8917 /* Get buffer name in NameBuff[] */ |
8895 get_trans_bufname(cwp->w_buffer); | 8918 get_trans_bufname(cwp->w_buffer); |
8919 shorten_dir(NameBuff); | |
8896 len = vim_strsize(NameBuff); | 8920 len = vim_strsize(NameBuff); |
8897 p = NameBuff; | 8921 p = NameBuff; |
8898 #ifdef FEAT_MBYTE | 8922 #ifdef FEAT_MBYTE |
8899 if (has_mbyte) | 8923 if (has_mbyte) |
8900 while (len > room) | 8924 while (len > room) |