comparison src/screen.c @ 6947:1efa7c2b9368 v7.4.792

patch 7.4.792 Problem: Can only conceal text by defining syntax items. Solution: Use matchadd() to define concealing. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Tue, 21 Jul 2015 15:48:27 +0200
parents e55929fca0cf
children 87cb71d54e8a
comparison
equal deleted inserted replaced
6946:c56ef0540cd5 6947:1efa7c2b9368
3045 int is_concealing = FALSE; 3045 int is_concealing = FALSE;
3046 int boguscols = 0; /* nonexistent columns added to force 3046 int boguscols = 0; /* nonexistent columns added to force
3047 wrapping */ 3047 wrapping */
3048 int vcol_off = 0; /* offset for concealed characters */ 3048 int vcol_off = 0; /* offset for concealed characters */
3049 int did_wcol = FALSE; 3049 int did_wcol = FALSE;
3050 int match_conc = FALSE; /* cchar for match functions */
3051 int has_match_conc = FALSE; /* match wants to conceal */
3050 int old_boguscols = 0; 3052 int old_boguscols = 0;
3051 # define VCOL_HLC (vcol - vcol_off) 3053 # define VCOL_HLC (vcol - vcol_off)
3052 # define FIX_FOR_BOGUSCOLS \ 3054 # define FIX_FOR_BOGUSCOLS \
3053 { \ 3055 { \
3054 n_extra += vcol_off; \ 3056 n_extra += vcol_off; \
3578 /* 3580 /*
3579 * Repeat for the whole displayed line. 3581 * Repeat for the whole displayed line.
3580 */ 3582 */
3581 for (;;) 3583 for (;;)
3582 { 3584 {
3585 #ifdef FEAT_CONCEAL
3586 has_match_conc = FALSE;
3587 #endif
3583 /* Skip this quickly when working on the text. */ 3588 /* Skip this quickly when working on the text. */
3584 if (draw_state != WL_LINE) 3589 if (draw_state != WL_LINE)
3585 { 3590 {
3586 #ifdef FEAT_CMDWIN 3591 #ifdef FEAT_CMDWIN
3587 if (draw_state == WL_CMDLINE - 1 && n_extra == 0) 3592 if (draw_state == WL_CMDLINE - 1 && n_extra == 0)
3921 3926
3922 if (shl->endcol < tmp_col) 3927 if (shl->endcol < tmp_col)
3923 shl->endcol = tmp_col; 3928 shl->endcol = tmp_col;
3924 #endif 3929 #endif
3925 shl->attr_cur = shl->attr; 3930 shl->attr_cur = shl->attr;
3931 #ifdef FEAT_CONCEAL
3932 if (cur != NULL && syn_name2id((char_u *)"Conceal")
3933 == cur->hlg_id)
3934 {
3935 has_match_conc = TRUE;
3936 match_conc = cur->conceal_char;
3937 }
3938 else
3939 has_match_conc = match_conc = FALSE;
3940 #endif
3926 } 3941 }
3927 else if (v == (long)shl->endcol) 3942 else if (v == (long)shl->endcol)
3928 { 3943 {
3929 shl->attr_cur = 0; 3944 shl->attr_cur = 0;
3945 #ifdef FEAT_CONCEAL
3946 prev_syntax_id = 0;
3947 #endif
3930 next_search_hl(wp, shl, lnum, (colnr_T)v, cur); 3948 next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
3931 pos_inprogress = cur == NULL || cur->pos.cur == 0 3949 pos_inprogress = cur == NULL || cur->pos.cur == 0
3932 ? FALSE : TRUE; 3950 ? FALSE : TRUE;
3933 3951
3934 /* Need to get the line again, a multi-line regexp 3952 /* Need to get the line again, a multi-line regexp
3935 * may have made it invalid. */ 3953 * may have made it invalid. */
3936 line = ml_get_buf(wp->w_buffer, lnum, FALSE); 3954 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3937 ptr = line + v; 3955 ptr = line + v;
4871 } 4889 }
4872 4890
4873 #ifdef FEAT_CONCEAL 4891 #ifdef FEAT_CONCEAL
4874 if ( wp->w_p_cole > 0 4892 if ( wp->w_p_cole > 0
4875 && (wp != curwin || lnum != wp->w_cursor.lnum || 4893 && (wp != curwin || lnum != wp->w_cursor.lnum ||
4876 conceal_cursor_line(wp)) 4894 conceal_cursor_line(wp) )
4877 && (syntax_flags & HL_CONCEAL) != 0 4895 && ( (syntax_flags & HL_CONCEAL) != 0 || has_match_conc)
4878 && !(lnum_in_visual_area 4896 && !(lnum_in_visual_area
4879 && vim_strchr(wp->w_p_cocu, 'v') == NULL)) 4897 && vim_strchr(wp->w_p_cocu, 'v') == NULL))
4880 { 4898 {
4881 char_attr = conceal_attr; 4899 char_attr = conceal_attr;
4882 if (prev_syntax_id != syntax_seqnr 4900 if (prev_syntax_id != syntax_seqnr
4883 && (syn_get_sub_char() != NUL || wp->w_p_cole == 1) 4901 && (syn_get_sub_char() != NUL || match_conc
4902 || wp->w_p_cole == 1)
4884 && wp->w_p_cole != 3) 4903 && wp->w_p_cole != 3)
4885 { 4904 {
4886 /* First time at this concealed item: display one 4905 /* First time at this concealed item: display one
4887 * character. */ 4906 * character. */
4888 if (syn_get_sub_char() != NUL) 4907 if (match_conc)
4908 c = match_conc;
4909 else if (syn_get_sub_char() != NUL)
4889 c = syn_get_sub_char(); 4910 c = syn_get_sub_char();
4890 else if (lcs_conceal != NUL) 4911 else if (lcs_conceal != NUL)
4891 c = lcs_conceal; 4912 c = lcs_conceal;
4892 else 4913 else
4893 c = ' '; 4914 c = ' ';