comparison src/screen.c @ 674:4b8583e82cb8 v7.0201

updated for version 7.0201
author vimboss
date Sat, 18 Feb 2006 22:14:51 +0000
parents 513866ffe6af
children e649c78407e6
comparison
equal deleted inserted replaced
673:513866ffe6af 674:4b8583e82cb8
2514 #endif 2514 #endif
2515 pos_T pos; 2515 pos_T pos;
2516 long v; 2516 long v;
2517 2517
2518 int char_attr = 0; /* attributes for next character */ 2518 int char_attr = 0; /* attributes for next character */
2519 int attr_pri = FALSE; /* char_attr has priority */
2519 int area_highlighting = FALSE; /* Visual or incsearch highlighting 2520 int area_highlighting = FALSE; /* Visual or incsearch highlighting
2520 in this line */ 2521 in this line */
2521 int attr = 0; /* attributes for area highlighting */ 2522 int attr = 0; /* attributes for area highlighting */
2522 int area_attr = 0; /* attributes desired by highlighting */ 2523 int area_attr = 0; /* attributes desired by highlighting */
2523 int search_attr = 0; /* attributes desired by 'hlsearch' */ 2524 int search_attr = 0; /* attributes desired by 'hlsearch' */
2762 #endif 2763 #endif
2763 } 2764 }
2764 } 2765 }
2765 2766
2766 /* 2767 /*
2767 * handle 'insearch' and ":s///c" highlighting 2768 * handle 'incsearch' and ":s///c" highlighting
2768 */ 2769 */
2769 else 2770 else
2770 #endif /* FEAT_VISUAL */ 2771 #endif /* FEAT_VISUAL */
2771 if (highlight_match 2772 if (highlight_match
2772 && wp == curwin 2773 && wp == curwin
3285 && vcol < tocol)) 3286 && vcol < tocol))
3286 area_attr = attr; /* start highlighting */ 3287 area_attr = attr; /* start highlighting */
3287 else if (area_attr != 0 3288 else if (area_attr != 0
3288 && (vcol == tocol 3289 && (vcol == tocol
3289 || (noinvcur && (colnr_T)vcol == wp->w_virtcol))) 3290 || (noinvcur && (colnr_T)vcol == wp->w_virtcol)))
3290 #ifdef LINE_ATTR
3291 area_attr = line_attr; /* stop highlighting */
3292 else if (line_attr && ((fromcol == -10 && tocol == MAXCOL)
3293 || (vcol < fromcol || vcol > tocol)))
3294 area_attr = line_attr;
3295 #else
3296 area_attr = 0; /* stop highlighting */ 3291 area_attr = 0; /* stop highlighting */
3297 #endif
3298 3292
3299 #ifdef FEAT_SEARCH_EXTRA 3293 #ifdef FEAT_SEARCH_EXTRA
3300 if (!n_extra) 3294 if (!n_extra)
3301 { 3295 {
3302 /* 3296 /*
3368 else 3362 else
3369 search_attr = search_hl.attr_cur; 3363 search_attr = search_hl.attr_cur;
3370 } 3364 }
3371 #endif 3365 #endif
3372 3366
3373 if (area_attr != 0)
3374 char_attr = area_attr;
3375 #ifdef FEAT_SYN_HL
3376 else if (search_attr == 0 && has_syntax)
3377 char_attr = syntax_attr;
3378 #endif
3379 else
3380 char_attr = search_attr;
3381
3382 #ifdef FEAT_DIFF 3367 #ifdef FEAT_DIFF
3383 if (diff_hlf != (hlf_T)0 && n_extra == 0) 3368 if (diff_hlf != (hlf_T)0)
3384 { 3369 {
3385 if (diff_hlf == HLF_CHD && ptr - line >= change_start) 3370 if (diff_hlf == HLF_CHD && ptr - line >= change_start)
3386 diff_hlf = HLF_TXD; /* changed text */ 3371 diff_hlf = HLF_TXD; /* changed text */
3387 if (diff_hlf == HLF_TXD && ptr - line > change_end) 3372 if (diff_hlf == HLF_TXD && ptr - line > change_end)
3388 diff_hlf = HLF_CHD; /* changed line */ 3373 diff_hlf = HLF_CHD; /* changed line */
3389 if (attr == 0 || area_attr != attr) 3374 line_attr = hl_attr(diff_hlf);
3390 area_attr = hl_attr(diff_hlf); 3375 }
3391 if (attr == 0 || char_attr != attr) 3376 #endif
3392 { 3377
3393 if (search_attr != 0) 3378 /* Decide which of the highlight attributes to use. */
3394 char_attr = search_attr; 3379 attr_pri = TRUE;
3395 else 3380 if (area_attr != 0)
3396 char_attr = hl_attr(diff_hlf); 3381 char_attr = area_attr;
3397 } 3382 else if (search_attr != 0)
3398 } 3383 char_attr = search_attr;
3399 #endif 3384 #ifdef LINE_ATTR
3385 /* Use line_attr when not in the Visual or 'incsearch' area
3386 * (area_attr may be 0 when "noinvcur" is set). */
3387 else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
3388 || (vcol < fromcol || vcol >= tocol)))
3389 char_attr = line_attr;
3390 #endif
3391 else
3392 {
3393 attr_pri = FALSE;
3394 #ifdef FEAT_SYN_HL
3395 if (has_syntax)
3396 char_attr = syntax_attr;
3397 else
3398 #endif
3399 char_attr = 0;
3400 }
3400 } 3401 }
3401 3402
3402 /* 3403 /*
3403 * Get the next character to put on the screen. 3404 * Get the next character to put on the screen.
3404 */ 3405 */
3725 /* Need to get the line again, a multi-line regexp may 3726 /* Need to get the line again, a multi-line regexp may
3726 * have made it invalid. */ 3727 * have made it invalid. */
3727 line = ml_get_buf(wp->w_buffer, lnum, FALSE); 3728 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3728 ptr = line + v; 3729 ptr = line + v;
3729 3730
3730 if (area_attr == 0 && search_attr == 0) 3731 if (!attr_pri)
3731 char_attr = syntax_attr; 3732 char_attr = syntax_attr;
3732 else 3733 else
3733 char_attr = hl_combine_attr(syntax_attr, char_attr); 3734 char_attr = hl_combine_attr(syntax_attr, char_attr);
3734 } 3735 }
3735 3736
3738 * @Spell cluster is not used or the current syntax item 3739 * @Spell cluster is not used or the current syntax item
3739 * contains the @Spell cluster. */ 3740 * contains the @Spell cluster. */
3740 if (has_spell && v >= word_end && v > cur_checked_col) 3741 if (has_spell && v >= word_end && v > cur_checked_col)
3741 { 3742 {
3742 spell_attr = 0; 3743 spell_attr = 0;
3743 if (area_attr == 0 && search_attr == 0) 3744 if (!attr_pri)
3744 char_attr = syntax_attr; 3745 char_attr = syntax_attr;
3745 if (c != 0 && (!has_syntax || can_spell)) 3746 if (c != 0 && (!has_syntax || can_spell))
3746 { 3747 {
3747 char_u *prev_ptr, *p; 3748 char_u *prev_ptr, *p;
3748 int len; 3749 int len;
3811 } 3812 }
3812 } 3813 }
3813 } 3814 }
3814 if (spell_attr != 0) 3815 if (spell_attr != 0)
3815 { 3816 {
3816 if (area_attr == 0 && search_attr == 0) 3817 if (!attr_pri)
3817 char_attr = hl_combine_attr(char_attr, spell_attr); 3818 char_attr = hl_combine_attr(char_attr, spell_attr);
3818 else 3819 else
3819 char_attr = hl_combine_attr(spell_attr, char_attr); 3820 char_attr = hl_combine_attr(spell_attr, char_attr);
3820 } 3821 }
3821 #endif 3822 #endif
3838 #endif 3839 #endif
3839 3840
3840 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') 3841 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
3841 { 3842 {
3842 c = lcs_trail; 3843 c = lcs_trail;
3843 if (area_attr == 0 && search_attr == 0) 3844 if (!attr_pri)
3844 { 3845 {
3845 n_attr = 1; 3846 n_attr = 1;
3846 extra_attr = hl_attr(HLF_8); 3847 extra_attr = hl_attr(HLF_8);
3847 saved_attr2 = char_attr; /* save current attr */ 3848 saved_attr2 = char_attr; /* save current attr */
3848 } 3849 }
3951 c = lcs_eol; 3952 c = lcs_eol;
3952 else 3953 else
3953 c = ' '; 3954 c = ' ';
3954 lcs_eol_one = -1; 3955 lcs_eol_one = -1;
3955 --ptr; /* put it back at the NUL */ 3956 --ptr; /* put it back at the NUL */
3956 if (area_attr == 0 && search_attr == 0) 3957 if (!attr_pri)
3957 { 3958 {
3958 extra_attr = hl_attr(HLF_AT); 3959 extra_attr = hl_attr(HLF_AT);
3959 n_attr = 1; 3960 n_attr = 1;
3960 } 3961 }
3961 #ifdef FEAT_MBYTE 3962 #ifdef FEAT_MBYTE
3977 rl_mirror(p_extra); /* reverse "<12>" */ 3978 rl_mirror(p_extra); /* reverse "<12>" */
3978 #endif 3979 #endif
3979 n_extra = byte2cells(c) - 1; 3980 n_extra = byte2cells(c) - 1;
3980 c_extra = NUL; 3981 c_extra = NUL;
3981 c = *p_extra++; 3982 c = *p_extra++;
3982 if (area_attr == 0 && search_attr == 0) 3983 if (!attr_pri)
3983 { 3984 {
3984 n_attr = n_extra + 1; 3985 n_attr = n_extra + 1;
3985 extra_attr = hl_attr(HLF_8); 3986 extra_attr = hl_attr(HLF_8);
3986 saved_attr2 = char_attr; /* save current attr */ 3987 saved_attr2 = char_attr; /* save current attr */
3987 } 3988 }
4040 } 4041 }
4041 4042
4042 /* Don't override visual selection highlighting. */ 4043 /* Don't override visual selection highlighting. */
4043 if (n_attr > 0 4044 if (n_attr > 0
4044 && draw_state == WL_LINE 4045 && draw_state == WL_LINE
4045 && (area_attr == 0 || char_attr != area_attr) 4046 && !attr_pri)
4046 && (search_attr == 0 || char_attr != search_attr))
4047 char_attr = extra_attr; 4047 char_attr = extra_attr;
4048 4048
4049 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) 4049 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
4050 /* XIM don't send preedit_start and preedit_end, but they send 4050 /* XIM don't send preedit_start and preedit_end, but they send
4051 * preedit_changed and commit. Thus Vim can't set "im_is_active", use 4051 * preedit_changed and commit. Thus Vim can't set "im_is_active", use
4106 u8c_c1 = u8c_c2 = 0; 4106 u8c_c1 = u8c_c2 = 0;
4107 } 4107 }
4108 else 4108 else
4109 mb_utf8 = FALSE; /* don't draw as UTF-8 */ 4109 mb_utf8 = FALSE; /* don't draw as UTF-8 */
4110 #endif 4110 #endif
4111 if ((area_attr == 0 || char_attr != area_attr) 4111 if (!attr_pri)
4112 && (search_attr == 0 || char_attr != search_attr))
4113 { 4112 {
4114 saved_attr3 = char_attr; /* save current attr */ 4113 saved_attr3 = char_attr; /* save current attr */
4115 char_attr = hl_attr(HLF_AT); /* later copied to char_attr */ 4114 char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
4116 n_attr3 = 1; 4115 n_attr3 = 1;
4117 } 4116 }