Karsten Hopp cd3dcf
To: vim_dev@googlegroups.com
Karsten Hopp cd3dcf
Subject: Patch 7.4.792
Karsten Hopp cd3dcf
Fcc: outbox
Karsten Hopp cd3dcf
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp cd3dcf
Mime-Version: 1.0
Karsten Hopp cd3dcf
Content-Type: text/plain; charset=UTF-8
Karsten Hopp cd3dcf
Content-Transfer-Encoding: 8bit
Karsten Hopp cd3dcf
------------
Karsten Hopp cd3dcf
Karsten Hopp cd3dcf
Patch 7.4.792
Karsten Hopp cd3dcf
Problem:    Can only conceal text by defining syntax items.
Karsten Hopp cd3dcf
Solution:   Use matchadd() to define concealing. (Christian Brabandt)
Karsten Hopp cd3dcf
Files:      runtime/doc/eval.txt, src/eval.c, src/ex_docmd.c,
Karsten Hopp cd3dcf
            src/proto/window.pro, src/screen.c, src/structs.h,
Karsten Hopp cd3dcf
            src/testdir/Make_amiga.mak,
Karsten Hopp cd3dcf
            src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
Karsten Hopp cd3dcf
            src/testdir/Make_os2.mak, src/testdir/Make_vms.mms,
Karsten Hopp cd3dcf
            src/testdir/Makefile, src/testdir/test_match_conceal.in,
Karsten Hopp cd3dcf
            src/testdir/test_match_conceal.ok, src/window.c
Karsten Hopp cd3dcf
Karsten Hopp cd3dcf
Karsten Hopp cd3dcf
*** ../vim-7.4.791/runtime/doc/eval.txt	2015-07-17 17:38:00.559399699 +0200
Karsten Hopp cd3dcf
--- runtime/doc/eval.txt	2015-07-21 15:41:47.501228965 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 4337,4347 ****
Karsten Hopp cd3dcf
  		done like 'magic' is set and 'cpoptions' is empty.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  					*matchadd()* *E798* *E799* *E801*
Karsten Hopp cd3dcf
! matchadd({group}, {pattern}[, {priority}[, {id}]])
Karsten Hopp cd3dcf
  		Defines a pattern to be highlighted in the current window (a
Karsten Hopp cd3dcf
  		"match").  It will be highlighted with {group}.  Returns an
Karsten Hopp cd3dcf
  		identification number (ID), which can be used to delete the
Karsten Hopp cd3dcf
  		match using |matchdelete()|.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  		The optional {priority} argument assigns a priority to the
Karsten Hopp cd3dcf
  		match.	A match with a high priority will have its
Karsten Hopp cd3dcf
--- 4405,4420 ----
Karsten Hopp cd3dcf
  		done like 'magic' is set and 'cpoptions' is empty.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  					*matchadd()* *E798* *E799* *E801*
Karsten Hopp cd3dcf
! matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]])
Karsten Hopp cd3dcf
  		Defines a pattern to be highlighted in the current window (a
Karsten Hopp cd3dcf
  		"match").  It will be highlighted with {group}.  Returns an
Karsten Hopp cd3dcf
  		identification number (ID), which can be used to delete the
Karsten Hopp cd3dcf
  		match using |matchdelete()|.
Karsten Hopp cd3dcf
+ 		Matching is case sensitive and magic, unless case sensitivity
Karsten Hopp cd3dcf
+ 		or magicness are explicitly overridden in {pattern}.  The
Karsten Hopp cd3dcf
+ 		'magic', 'smartcase' and 'ignorecase' options are not used.
Karsten Hopp cd3dcf
+ 		The "Conceal" value is special, it causes the match to be
Karsten Hopp cd3dcf
+ 		concealed.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  		The optional {priority} argument assigns a priority to the
Karsten Hopp cd3dcf
  		match.	A match with a high priority will have its
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 4359,4367 ****
Karsten Hopp cd3dcf
  		message will appear and the match will not be added.  An ID
Karsten Hopp cd3dcf
  		is specified as a positive integer (zero excluded).  IDs 1, 2
Karsten Hopp cd3dcf
  		and 3 are reserved for |:match|, |:2match| and |:3match|,
Karsten Hopp cd3dcf
! 		respectively.  If the {id} argument is not specified,
Karsten Hopp cd3dcf
  		|matchadd()| automatically chooses a free ID.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  		The number of matches is not limited, as it is the case with
Karsten Hopp cd3dcf
  		the |:match| commands.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
--- 4432,4449 ----
Karsten Hopp cd3dcf
  		message will appear and the match will not be added.  An ID
Karsten Hopp cd3dcf
  		is specified as a positive integer (zero excluded).  IDs 1, 2
Karsten Hopp cd3dcf
  		and 3 are reserved for |:match|, |:2match| and |:3match|,
Karsten Hopp cd3dcf
! 		respectively.  If the {id} argument is not specified or -1,
Karsten Hopp cd3dcf
  		|matchadd()| automatically chooses a free ID.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
+ 		The optional {dict} argmument allows for further custom
Karsten Hopp cd3dcf
+ 		values. Currently this is used to specify a match specifc
Karsten Hopp cd3dcf
+ 		conceal character that will be shown for |hl-Conceal|
Karsten Hopp cd3dcf
+ 		highlighted matches. The dict can have the following members:
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ 			conceal	    Special character to show instead of the
Karsten Hopp cd3dcf
+ 				    match (only for |hl-Conceal| highlighed
Karsten Hopp cd3dcf
+ 				    matches, see |:syn-cchar|)
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
  		The number of matches is not limited, as it is the case with
Karsten Hopp cd3dcf
  		the |:match| commands.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 4375,4381 ****
Karsten Hopp cd3dcf
  		available from |getmatches()|.	All matches can be deleted in
Karsten Hopp cd3dcf
  		one operation by |clearmatches()|.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
! matchaddpos({group}, {pos}[, {priority}[, {id}]])		*matchaddpos()*
Karsten Hopp cd3dcf
  		Same as |matchadd()|, but requires a list of positions {pos}
Karsten Hopp cd3dcf
  		instead of a pattern. This command is faster than |matchadd()|
Karsten Hopp cd3dcf
  		because it does not require to handle regular expressions and
Karsten Hopp cd3dcf
--- 4457,4463 ----
Karsten Hopp cd3dcf
  		available from |getmatches()|.	All matches can be deleted in
Karsten Hopp cd3dcf
  		one operation by |clearmatches()|.
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
! matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]])		*matchaddpos()*
Karsten Hopp cd3dcf
  		Same as |matchadd()|, but requires a list of positions {pos}
Karsten Hopp cd3dcf
  		instead of a pattern. This command is faster than |matchadd()|
Karsten Hopp cd3dcf
  		because it does not require to handle regular expressions and
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/eval.c	2015-07-17 17:38:00.563399661 +0200
Karsten Hopp cd3dcf
--- src/eval.c	2015-07-21 15:36:00.616543334 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 8224,8231 ****
Karsten Hopp cd3dcf
      {"maparg",		1, 4, f_maparg},
Karsten Hopp cd3dcf
      {"mapcheck",	1, 3, f_mapcheck},
Karsten Hopp cd3dcf
      {"match",		2, 4, f_match},
Karsten Hopp cd3dcf
!     {"matchadd",	2, 4, f_matchadd},
Karsten Hopp cd3dcf
!     {"matchaddpos",	2, 4, f_matchaddpos},
Karsten Hopp cd3dcf
      {"matcharg",	1, 1, f_matcharg},
Karsten Hopp cd3dcf
      {"matchdelete",	1, 1, f_matchdelete},
Karsten Hopp cd3dcf
      {"matchend",	2, 4, f_matchend},
Karsten Hopp cd3dcf
--- 8224,8231 ----
Karsten Hopp cd3dcf
      {"maparg",		1, 4, f_maparg},
Karsten Hopp cd3dcf
      {"mapcheck",	1, 3, f_mapcheck},
Karsten Hopp cd3dcf
      {"match",		2, 4, f_match},
Karsten Hopp cd3dcf
!     {"matchadd",	2, 5, f_matchadd},
Karsten Hopp cd3dcf
!     {"matchaddpos",	2, 5, f_matchaddpos},
Karsten Hopp cd3dcf
      {"matcharg",	1, 1, f_matcharg},
Karsten Hopp cd3dcf
      {"matchdelete",	1, 1, f_matchdelete},
Karsten Hopp cd3dcf
      {"matchend",	2, 4, f_matchend},
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 12031,12036 ****
Karsten Hopp cd3dcf
--- 12031,12045 ----
Karsten Hopp cd3dcf
  	    dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id));
Karsten Hopp cd3dcf
  	    dict_add_nr_str(dict, "priority", (long)cur->priority, NULL);
Karsten Hopp cd3dcf
  	    dict_add_nr_str(dict, "id", (long)cur->id, NULL);
Karsten Hopp cd3dcf
+ # ifdef FEAT_CONCEAL
Karsten Hopp cd3dcf
+ 	    if (cur->conceal_char)
Karsten Hopp cd3dcf
+ 	    {
Karsten Hopp cd3dcf
+ 		char_u buf[MB_MAXBYTES + 1];
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ 		buf[(*mb_char2bytes)((int)cur->conceal_char, buf)] = NUL;
Karsten Hopp cd3dcf
+ 		dict_add_nr_str(dict, "conceal", 0L, (char_u *)&buf;;
Karsten Hopp cd3dcf
+ 	    }
Karsten Hopp cd3dcf
+ # endif
Karsten Hopp cd3dcf
  	    list_append_dict(rettv->vval.v_list, dict);
Karsten Hopp cd3dcf
  	    cur = cur->next;
Karsten Hopp cd3dcf
  	}
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 14589,14594 ****
Karsten Hopp cd3dcf
--- 14598,14604 ----
Karsten Hopp cd3dcf
      int		prio = 10;	/* default priority */
Karsten Hopp cd3dcf
      int		id = -1;
Karsten Hopp cd3dcf
      int		error = FALSE;
Karsten Hopp cd3dcf
+     char_u	*conceal_char = NULL;
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
      rettv->vval.v_number = -1;
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 14598,14604 ****
Karsten Hopp cd3dcf
--- 14608,14628 ----
Karsten Hopp cd3dcf
      {
Karsten Hopp cd3dcf
  	prio = get_tv_number_chk(&argvars[2], &error);
Karsten Hopp cd3dcf
  	if (argvars[3].v_type != VAR_UNKNOWN)
Karsten Hopp cd3dcf
+ 	{
Karsten Hopp cd3dcf
  	    id = get_tv_number_chk(&argvars[3], &error);
Karsten Hopp cd3dcf
+ 	    if (argvars[4].v_type != VAR_UNKNOWN)
Karsten Hopp cd3dcf
+ 	    {
Karsten Hopp cd3dcf
+ 		if (argvars[4].v_type != VAR_DICT)
Karsten Hopp cd3dcf
+ 		{
Karsten Hopp cd3dcf
+ 		    EMSG(_(e_dictreq));
Karsten Hopp cd3dcf
+ 		    return;
Karsten Hopp cd3dcf
+ 		}
Karsten Hopp cd3dcf
+ 		if (dict_find(argvars[4].vval.v_dict,
Karsten Hopp cd3dcf
+ 					     (char_u *)"conceal", -1) != NULL)
Karsten Hopp cd3dcf
+ 		    conceal_char = get_dict_string(argvars[4].vval.v_dict,
Karsten Hopp cd3dcf
+ 						  (char_u *)"conceal", FALSE);
Karsten Hopp cd3dcf
+ 	    }
Karsten Hopp cd3dcf
+ 	}
Karsten Hopp cd3dcf
      }
Karsten Hopp cd3dcf
      if (error == TRUE)
Karsten Hopp cd3dcf
  	return;
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 14608,14614 ****
Karsten Hopp cd3dcf
  	return;
Karsten Hopp cd3dcf
      }
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
!     rettv->vval.v_number = match_add(curwin, grp, pat, prio, id, NULL);
Karsten Hopp cd3dcf
  #endif
Karsten Hopp cd3dcf
  }
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
--- 14632,14639 ----
Karsten Hopp cd3dcf
  	return;
Karsten Hopp cd3dcf
      }
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
!     rettv->vval.v_number = match_add(curwin, grp, pat, prio, id, NULL,
Karsten Hopp cd3dcf
! 								conceal_char);
Karsten Hopp cd3dcf
  #endif
Karsten Hopp cd3dcf
  }
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 14627,14632 ****
Karsten Hopp cd3dcf
--- 14652,14658 ----
Karsten Hopp cd3dcf
      int		id = -1;
Karsten Hopp cd3dcf
      int		error = FALSE;
Karsten Hopp cd3dcf
      list_T	*l;
Karsten Hopp cd3dcf
+     char_u	*conceal_char = NULL;
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
      rettv->vval.v_number = -1;
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 14647,14653 ****
Karsten Hopp cd3dcf
--- 14673,14693 ----
Karsten Hopp cd3dcf
      {
Karsten Hopp cd3dcf
  	prio = get_tv_number_chk(&argvars[2], &error);
Karsten Hopp cd3dcf
  	if (argvars[3].v_type != VAR_UNKNOWN)
Karsten Hopp cd3dcf
+ 	{
Karsten Hopp cd3dcf
  	    id = get_tv_number_chk(&argvars[3], &error);
Karsten Hopp cd3dcf
+ 	    if (argvars[4].v_type != VAR_UNKNOWN)
Karsten Hopp cd3dcf
+ 	    {
Karsten Hopp cd3dcf
+ 		if (argvars[4].v_type != VAR_DICT)
Karsten Hopp cd3dcf
+ 		{
Karsten Hopp cd3dcf
+ 		    EMSG(_(e_dictreq));
Karsten Hopp cd3dcf
+ 		    return;
Karsten Hopp cd3dcf
+ 		}
Karsten Hopp cd3dcf
+ 		if (dict_find(argvars[4].vval.v_dict,
Karsten Hopp cd3dcf
+ 					     (char_u *)"conceal", -1) != NULL)
Karsten Hopp cd3dcf
+ 		    conceal_char = get_dict_string(argvars[4].vval.v_dict,
Karsten Hopp cd3dcf
+ 						  (char_u *)"conceal", FALSE);
Karsten Hopp cd3dcf
+ 	    }
Karsten Hopp cd3dcf
+ 	}
Karsten Hopp cd3dcf
      }
Karsten Hopp cd3dcf
      if (error == TRUE)
Karsten Hopp cd3dcf
  	return;
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 14659,14665 ****
Karsten Hopp cd3dcf
  	return;
Karsten Hopp cd3dcf
      }
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
!     rettv->vval.v_number = match_add(curwin, group, NULL, prio, id, l);
Karsten Hopp cd3dcf
  #endif
Karsten Hopp cd3dcf
  }
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
--- 14699,14706 ----
Karsten Hopp cd3dcf
  	return;
Karsten Hopp cd3dcf
      }
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
!     rettv->vval.v_number = match_add(curwin, group, NULL, prio, id, l,
Karsten Hopp cd3dcf
! 								conceal_char);
Karsten Hopp cd3dcf
  #endif
Karsten Hopp cd3dcf
  }
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 17165,17173 ****
Karsten Hopp cd3dcf
  	    int		i = 0;
Karsten Hopp cd3dcf
  	    char_u	buf[5];
Karsten Hopp cd3dcf
  	    dictitem_T  *di;
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  	    d = li->li_tv.vval.v_dict;
Karsten Hopp cd3dcf
- 
Karsten Hopp cd3dcf
  	    if (dict_find(d, (char_u *)"pattern", -1) == NULL)
Karsten Hopp cd3dcf
  	    {
Karsten Hopp cd3dcf
  		if (s == NULL)
Karsten Hopp cd3dcf
--- 17206,17217 ----
Karsten Hopp cd3dcf
  	    int		i = 0;
Karsten Hopp cd3dcf
  	    char_u	buf[5];
Karsten Hopp cd3dcf
  	    dictitem_T  *di;
Karsten Hopp cd3dcf
+ 	    char_u	*group;
Karsten Hopp cd3dcf
+ 	    int		priority;
Karsten Hopp cd3dcf
+ 	    int		id;
Karsten Hopp cd3dcf
+ 	    char_u	*conceal;
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  	    d = li->li_tv.vval.v_dict;
Karsten Hopp cd3dcf
  	    if (dict_find(d, (char_u *)"pattern", -1) == NULL)
Karsten Hopp cd3dcf
  	    {
Karsten Hopp cd3dcf
  		if (s == NULL)
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 17193,17210 ****
Karsten Hopp cd3dcf
  			break;
Karsten Hopp cd3dcf
  		}
Karsten Hopp cd3dcf
  	    }
Karsten Hopp cd3dcf
  	    if (i == 0)
Karsten Hopp cd3dcf
  	    {
Karsten Hopp cd3dcf
! 		match_add(curwin, get_dict_string(d, (char_u *)"group", FALSE),
Karsten Hopp cd3dcf
  		    get_dict_string(d, (char_u *)"pattern", FALSE),
Karsten Hopp cd3dcf
! 		    (int)get_dict_number(d, (char_u *)"priority"),
Karsten Hopp cd3dcf
! 		    (int)get_dict_number(d, (char_u *)"id"), NULL);
Karsten Hopp cd3dcf
  	    }
Karsten Hopp cd3dcf
  	    else
Karsten Hopp cd3dcf
  	    {
Karsten Hopp cd3dcf
! 		match_add(curwin, get_dict_string(d, (char_u *)"group", FALSE),
Karsten Hopp cd3dcf
! 		    NULL, (int)get_dict_number(d, (char_u *)"priority"),
Karsten Hopp cd3dcf
! 		    (int)get_dict_number(d, (char_u *)"id"), s);
Karsten Hopp cd3dcf
  		list_unref(s);
Karsten Hopp cd3dcf
  		s = NULL;
Karsten Hopp cd3dcf
  	    }
Karsten Hopp cd3dcf
--- 17237,17258 ----
Karsten Hopp cd3dcf
  			break;
Karsten Hopp cd3dcf
  		}
Karsten Hopp cd3dcf
  	    }
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ 	    group = get_dict_string(d, (char_u *)"group", FALSE);
Karsten Hopp cd3dcf
+ 	    priority = (int)get_dict_number(d, (char_u *)"priority");
Karsten Hopp cd3dcf
+ 	    id = (int)get_dict_number(d, (char_u *)"id");
Karsten Hopp cd3dcf
+ 	    conceal = dict_find(d, (char_u *)"conceal", -1) != NULL
Karsten Hopp cd3dcf
+ 			      ? get_dict_string(d, (char_u *)"conceal", FALSE)
Karsten Hopp cd3dcf
+ 			      : NULL;
Karsten Hopp cd3dcf
  	    if (i == 0)
Karsten Hopp cd3dcf
  	    {
Karsten Hopp cd3dcf
! 		match_add(curwin, group,
Karsten Hopp cd3dcf
  		    get_dict_string(d, (char_u *)"pattern", FALSE),
Karsten Hopp cd3dcf
! 		    priority, id, NULL, conceal);
Karsten Hopp cd3dcf
  	    }
Karsten Hopp cd3dcf
  	    else
Karsten Hopp cd3dcf
  	    {
Karsten Hopp cd3dcf
! 		match_add(curwin, group, NULL, priority, id, s, conceal);
Karsten Hopp cd3dcf
  		list_unref(s);
Karsten Hopp cd3dcf
  		s = NULL;
Karsten Hopp cd3dcf
  	    }
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/ex_docmd.c	2015-06-19 12:43:02.380196210 +0200
Karsten Hopp cd3dcf
--- src/ex_docmd.c	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 12079,12085 ****
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  	    c = *end;
Karsten Hopp cd3dcf
  	    *end = NUL;
Karsten Hopp cd3dcf
! 	    match_add(curwin, g, p + 1, 10, id, NULL);
Karsten Hopp cd3dcf
  	    vim_free(g);
Karsten Hopp cd3dcf
  	    *end = c;
Karsten Hopp cd3dcf
  	}
Karsten Hopp cd3dcf
--- 12079,12085 ----
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  	    c = *end;
Karsten Hopp cd3dcf
  	    *end = NUL;
Karsten Hopp cd3dcf
! 	    match_add(curwin, g, p + 1, 10, id, NULL, NULL);
Karsten Hopp cd3dcf
  	    vim_free(g);
Karsten Hopp cd3dcf
  	    *end = c;
Karsten Hopp cd3dcf
  	}
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/proto/window.pro	2015-01-14 15:47:33.076036876 +0100
Karsten Hopp cd3dcf
--- src/proto/window.pro	2015-07-21 15:31:37.891052904 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 76,82 ****
Karsten Hopp cd3dcf
  void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
Karsten Hopp cd3dcf
  void restore_buffer __ARGS((buf_T *save_curbuf));
Karsten Hopp cd3dcf
  int win_hasvertsplit __ARGS((void));
Karsten Hopp cd3dcf
! int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos_list));
Karsten Hopp cd3dcf
  int match_delete __ARGS((win_T *wp, int id, int perr));
Karsten Hopp cd3dcf
  void clear_matches __ARGS((win_T *wp));
Karsten Hopp cd3dcf
  matchitem_T *get_match __ARGS((win_T *wp, int id));
Karsten Hopp cd3dcf
--- 76,82 ----
Karsten Hopp cd3dcf
  void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
Karsten Hopp cd3dcf
  void restore_buffer __ARGS((buf_T *save_curbuf));
Karsten Hopp cd3dcf
  int win_hasvertsplit __ARGS((void));
Karsten Hopp cd3dcf
! int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos_list, char_u *conceal_char));
Karsten Hopp cd3dcf
  int match_delete __ARGS((win_T *wp, int id, int perr));
Karsten Hopp cd3dcf
  void clear_matches __ARGS((win_T *wp));
Karsten Hopp cd3dcf
  matchitem_T *get_match __ARGS((win_T *wp, int id));
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/screen.c	2015-07-17 13:22:43.161523633 +0200
Karsten Hopp cd3dcf
--- src/screen.c	2015-07-21 15:36:35.956205830 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 3047,3052 ****
Karsten Hopp cd3dcf
--- 3047,3054 ----
Karsten Hopp cd3dcf
  					   wrapping */
Karsten Hopp cd3dcf
      int		vcol_off	= 0;	/* offset for concealed characters */
Karsten Hopp cd3dcf
      int		did_wcol	= FALSE;
Karsten Hopp cd3dcf
+     int		match_conc	= FALSE; /* cchar for match functions */
Karsten Hopp cd3dcf
+     int		has_match_conc  = FALSE; /* match wants to conceal */
Karsten Hopp cd3dcf
      int		old_boguscols   = 0;
Karsten Hopp cd3dcf
  # define VCOL_HLC (vcol - vcol_off)
Karsten Hopp cd3dcf
  # define FIX_FOR_BOGUSCOLS \
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 3580,3585 ****
Karsten Hopp cd3dcf
--- 3582,3590 ----
Karsten Hopp cd3dcf
       */
Karsten Hopp cd3dcf
      for (;;)
Karsten Hopp cd3dcf
      {
Karsten Hopp cd3dcf
+ #ifdef FEAT_CONCEAL
Karsten Hopp cd3dcf
+ 	has_match_conc = FALSE;
Karsten Hopp cd3dcf
+ #endif
Karsten Hopp cd3dcf
  	/* Skip this quickly when working on the text. */
Karsten Hopp cd3dcf
  	if (draw_state != WL_LINE)
Karsten Hopp cd3dcf
  	{
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 3923,3935 ****
Karsten Hopp cd3dcf
  				shl->endcol = tmp_col;
Karsten Hopp cd3dcf
  #endif
Karsten Hopp cd3dcf
  			    shl->attr_cur = shl->attr;
Karsten Hopp cd3dcf
  			}
Karsten Hopp cd3dcf
  			else if (v == (long)shl->endcol)
Karsten Hopp cd3dcf
  			{
Karsten Hopp cd3dcf
  			    shl->attr_cur = 0;
Karsten Hopp cd3dcf
  			    next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
Karsten Hopp cd3dcf
  			    pos_inprogress = cur == NULL || cur->pos.cur == 0
Karsten Hopp cd3dcf
! 							      ? FALSE : TRUE;
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  			    /* Need to get the line again, a multi-line regexp
Karsten Hopp cd3dcf
  			     * may have made it invalid. */
Karsten Hopp cd3dcf
--- 3928,3953 ----
Karsten Hopp cd3dcf
  				shl->endcol = tmp_col;
Karsten Hopp cd3dcf
  #endif
Karsten Hopp cd3dcf
  			    shl->attr_cur = shl->attr;
Karsten Hopp cd3dcf
+ #ifdef FEAT_CONCEAL
Karsten Hopp cd3dcf
+ 			    if (cur != NULL && syn_name2id((char_u *)"Conceal")
Karsten Hopp cd3dcf
+ 							       == cur->hlg_id)
Karsten Hopp cd3dcf
+ 			    {
Karsten Hopp cd3dcf
+ 				has_match_conc = TRUE;
Karsten Hopp cd3dcf
+ 				match_conc = cur->conceal_char;
Karsten Hopp cd3dcf
+ 			    }
Karsten Hopp cd3dcf
+ 			    else
Karsten Hopp cd3dcf
+ 				has_match_conc = match_conc = FALSE;
Karsten Hopp cd3dcf
+ #endif
Karsten Hopp cd3dcf
  			}
Karsten Hopp cd3dcf
  			else if (v == (long)shl->endcol)
Karsten Hopp cd3dcf
  			{
Karsten Hopp cd3dcf
  			    shl->attr_cur = 0;
Karsten Hopp cd3dcf
+ #ifdef FEAT_CONCEAL
Karsten Hopp cd3dcf
+ 			    prev_syntax_id = 0;
Karsten Hopp cd3dcf
+ #endif
Karsten Hopp cd3dcf
  			    next_search_hl(wp, shl, lnum, (colnr_T)v, cur);
Karsten Hopp cd3dcf
  			    pos_inprogress = cur == NULL || cur->pos.cur == 0
Karsten Hopp cd3dcf
! 							       ? FALSE : TRUE;
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  			    /* Need to get the line again, a multi-line regexp
Karsten Hopp cd3dcf
  			     * may have made it invalid. */
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 4873,4891 ****
Karsten Hopp cd3dcf
  #ifdef FEAT_CONCEAL
Karsten Hopp cd3dcf
  	    if (   wp->w_p_cole > 0
Karsten Hopp cd3dcf
  		&& (wp != curwin || lnum != wp->w_cursor.lnum ||
Karsten Hopp cd3dcf
! 						      conceal_cursor_line(wp))
Karsten Hopp cd3dcf
! 		&& (syntax_flags & HL_CONCEAL) != 0
Karsten Hopp cd3dcf
  		&& !(lnum_in_visual_area
Karsten Hopp cd3dcf
  				    && vim_strchr(wp->w_p_cocu, 'v') == NULL))
Karsten Hopp cd3dcf
  	    {
Karsten Hopp cd3dcf
  		char_attr = conceal_attr;
Karsten Hopp cd3dcf
  		if (prev_syntax_id != syntax_seqnr
Karsten Hopp cd3dcf
! 			&& (syn_get_sub_char() != NUL || wp->w_p_cole == 1)
Karsten Hopp cd3dcf
  			&& wp->w_p_cole != 3)
Karsten Hopp cd3dcf
  		{
Karsten Hopp cd3dcf
  		    /* First time at this concealed item: display one
Karsten Hopp cd3dcf
  		     * character. */
Karsten Hopp cd3dcf
! 		    if (syn_get_sub_char() != NUL)
Karsten Hopp cd3dcf
  			c = syn_get_sub_char();
Karsten Hopp cd3dcf
  		    else if (lcs_conceal != NUL)
Karsten Hopp cd3dcf
  			c = lcs_conceal;
Karsten Hopp cd3dcf
--- 4891,4912 ----
Karsten Hopp cd3dcf
  #ifdef FEAT_CONCEAL
Karsten Hopp cd3dcf
  	    if (   wp->w_p_cole > 0
Karsten Hopp cd3dcf
  		&& (wp != curwin || lnum != wp->w_cursor.lnum ||
Karsten Hopp cd3dcf
! 							conceal_cursor_line(wp) )
Karsten Hopp cd3dcf
! 		&& ( (syntax_flags & HL_CONCEAL) != 0 || has_match_conc)
Karsten Hopp cd3dcf
  		&& !(lnum_in_visual_area
Karsten Hopp cd3dcf
  				    && vim_strchr(wp->w_p_cocu, 'v') == NULL))
Karsten Hopp cd3dcf
  	    {
Karsten Hopp cd3dcf
  		char_attr = conceal_attr;
Karsten Hopp cd3dcf
  		if (prev_syntax_id != syntax_seqnr
Karsten Hopp cd3dcf
! 			&& (syn_get_sub_char() != NUL || match_conc
Karsten Hopp cd3dcf
! 							 || wp->w_p_cole == 1)
Karsten Hopp cd3dcf
  			&& wp->w_p_cole != 3)
Karsten Hopp cd3dcf
  		{
Karsten Hopp cd3dcf
  		    /* First time at this concealed item: display one
Karsten Hopp cd3dcf
  		     * character. */
Karsten Hopp cd3dcf
! 		    if (match_conc)
Karsten Hopp cd3dcf
! 			c = match_conc;
Karsten Hopp cd3dcf
! 		    else if (syn_get_sub_char() != NUL)
Karsten Hopp cd3dcf
  			c = syn_get_sub_char();
Karsten Hopp cd3dcf
  		    else if (lcs_conceal != NUL)
Karsten Hopp cd3dcf
  			c = lcs_conceal;
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/structs.h	2015-07-17 14:16:49.854596682 +0200
Karsten Hopp cd3dcf
--- src/structs.h	2015-07-21 15:34:41.237301482 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 2021,2026 ****
Karsten Hopp cd3dcf
--- 2021,2029 ----
Karsten Hopp cd3dcf
      regmmatch_T	match;	    /* regexp program for pattern */
Karsten Hopp cd3dcf
      posmatch_T	pos;	    /* position matches */
Karsten Hopp cd3dcf
      match_T	hl;	    /* struct for doing the actual highlighting */
Karsten Hopp cd3dcf
+ #ifdef FEAT_CONCEAL
Karsten Hopp cd3dcf
+     int		conceal_char; /* cchar for Conceal highlighting */
Karsten Hopp cd3dcf
+ #endif
Karsten Hopp cd3dcf
  };
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
  /*
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/testdir/Make_amiga.mak	2015-07-17 17:38:00.567399623 +0200
Karsten Hopp cd3dcf
--- src/testdir/Make_amiga.mak	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 54,59 ****
Karsten Hopp cd3dcf
--- 54,60 ----
Karsten Hopp cd3dcf
  		test_listlbr_utf8.out \
Karsten Hopp cd3dcf
  		test_mapping.out \
Karsten Hopp cd3dcf
  		test_marks.out \
Karsten Hopp cd3dcf
+ 		test_match_conceal.out \
Karsten Hopp cd3dcf
  		test_nested_function.out \
Karsten Hopp cd3dcf
  		test_options.out \
Karsten Hopp cd3dcf
  		test_perl.out \
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 205,210 ****
Karsten Hopp cd3dcf
--- 206,212 ----
Karsten Hopp cd3dcf
  test_listlbr_utf8.out: test_listlbr_utf8.in
Karsten Hopp cd3dcf
  test_mapping.out: test_mapping.in
Karsten Hopp cd3dcf
  test_marks.out: test_marks.in
Karsten Hopp cd3dcf
+ test_match_conceal.out: test_match_conceal.in
Karsten Hopp cd3dcf
  test_nested_function.out: test_nested_function.in
Karsten Hopp cd3dcf
  test_options.out: test_options.in
Karsten Hopp cd3dcf
  test_perl.out: test_perl.in
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/testdir/Make_dos.mak	2015-07-17 17:38:00.567399623 +0200
Karsten Hopp cd3dcf
--- src/testdir/Make_dos.mak	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 53,58 ****
Karsten Hopp cd3dcf
--- 53,59 ----
Karsten Hopp cd3dcf
  		test_listlbr_utf8.out \
Karsten Hopp cd3dcf
  		test_mapping.out \
Karsten Hopp cd3dcf
  		test_marks.out \
Karsten Hopp cd3dcf
+ 		test_match_conceal.out \
Karsten Hopp cd3dcf
  		test_nested_function.out \
Karsten Hopp cd3dcf
  		test_options.out \
Karsten Hopp cd3dcf
  		test_perl.out \
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/testdir/Make_ming.mak	2015-07-17 17:38:00.567399623 +0200
Karsten Hopp cd3dcf
--- src/testdir/Make_ming.mak	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 75,80 ****
Karsten Hopp cd3dcf
--- 75,81 ----
Karsten Hopp cd3dcf
  		test_listlbr_utf8.out \
Karsten Hopp cd3dcf
  		test_mapping.out \
Karsten Hopp cd3dcf
  		test_marks.out \
Karsten Hopp cd3dcf
+ 		test_match_conceal.out \
Karsten Hopp cd3dcf
  		test_nested_function.out \
Karsten Hopp cd3dcf
  		test_options.out \
Karsten Hopp cd3dcf
  		test_perl.out \
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/testdir/Make_os2.mak	2015-07-17 17:38:00.567399623 +0200
Karsten Hopp cd3dcf
--- src/testdir/Make_os2.mak	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 55,60 ****
Karsten Hopp cd3dcf
--- 55,61 ----
Karsten Hopp cd3dcf
  		test_listlbr_utf8.out \
Karsten Hopp cd3dcf
  		test_mapping.out \
Karsten Hopp cd3dcf
  		test_marks.out \
Karsten Hopp cd3dcf
+ 		test_match_conceal.out \
Karsten Hopp cd3dcf
  		test_nested_function.out \
Karsten Hopp cd3dcf
  		test_options.out \
Karsten Hopp cd3dcf
  		test_perl.out \
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/testdir/Make_vms.mms	2015-07-17 17:38:00.567399623 +0200
Karsten Hopp cd3dcf
--- src/testdir/Make_vms.mms	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 114,119 ****
Karsten Hopp cd3dcf
--- 114,120 ----
Karsten Hopp cd3dcf
  	 test_listlbr_utf8.out \
Karsten Hopp cd3dcf
  	 test_mapping.out \
Karsten Hopp cd3dcf
  	 test_marks.out \
Karsten Hopp cd3dcf
+ 	 test_match_conceal.out \
Karsten Hopp cd3dcf
  	 test_nested_function.out \
Karsten Hopp cd3dcf
  	 test_options.out \
Karsten Hopp cd3dcf
  	 test_perl.out \
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/testdir/Makefile	2015-07-17 17:38:00.567399623 +0200
Karsten Hopp cd3dcf
--- src/testdir/Makefile	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 51,56 ****
Karsten Hopp cd3dcf
--- 51,57 ----
Karsten Hopp cd3dcf
  		test_listlbr_utf8.out \
Karsten Hopp cd3dcf
  		test_mapping.out \
Karsten Hopp cd3dcf
  		test_marks.out \
Karsten Hopp cd3dcf
+ 		test_match_conceal.out \
Karsten Hopp cd3dcf
  		test_nested_function.out \
Karsten Hopp cd3dcf
  		test_options.out \
Karsten Hopp cd3dcf
  		test_perl.out \
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/testdir/test_match_conceal.in	2015-07-21 15:45:35.379038332 +0200
Karsten Hopp cd3dcf
--- src/testdir/test_match_conceal.in	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 0 ****
Karsten Hopp cd3dcf
--- 1,159 ----
Karsten Hopp cd3dcf
+ Test for matchadd() and conceal feature
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ STARTTEST
Karsten Hopp cd3dcf
+ :so small.vim
Karsten Hopp cd3dcf
+ :if !has("conceal") | e! test.ok | w! test.out | qa! | endif
Karsten Hopp cd3dcf
+ :set term=ansi
Karsten Hopp cd3dcf
+ :so mbyte.vim
Karsten Hopp cd3dcf
+ :if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif
Karsten Hopp cd3dcf
+ :10new|:vsp|:vert resize 20
Karsten Hopp cd3dcf
+ :put =\"\#\ This\ is\ a\ Test\"
Karsten Hopp cd3dcf
+ :norm! mazt
Karsten Hopp cd3dcf
+ :fu! ScreenChar(width, lines)
Karsten Hopp cd3dcf
+ :	let c=''
Karsten Hopp cd3dcf
+ :	for j in range(1,a:lines)
Karsten Hopp cd3dcf
+ :	    for i in range(1,a:width)
Karsten Hopp cd3dcf
+ :	    	let c.=nr2char(screenchar(j, i))
Karsten Hopp cd3dcf
+ :	    endfor
Karsten Hopp cd3dcf
+ :           let c.="\n"
Karsten Hopp cd3dcf
+ :	endfor
Karsten Hopp cd3dcf
+ :	return c
Karsten Hopp cd3dcf
+ :endfu
Karsten Hopp cd3dcf
+ :fu! ScreenAttr(line, pos, eval)
Karsten Hopp cd3dcf
+ :       let g:attr=[]
Karsten Hopp cd3dcf
+ :       for col in a:pos
Karsten Hopp cd3dcf
+ :	    call add(g:attr, screenattr(a:line,col))
Karsten Hopp cd3dcf
+ :	endfor
Karsten Hopp cd3dcf
+ :	" In case all values are zero, probably the terminal
Karsten Hopp cd3dcf
+ :       " isn't set correctly, so catch that case
Karsten Hopp cd3dcf
+ :	let null = (eval(join(g:attr, '+')) == 0)
Karsten Hopp cd3dcf
+ :       let str=substitute(a:eval, '\d\+', 'g:attr[&]', 'g')
Karsten Hopp cd3dcf
+ :	if null || eval(str)
Karsten Hopp cd3dcf
+ :	    :let g:attr_test="OK: ". str
Karsten Hopp cd3dcf
+ :	else
Karsten Hopp cd3dcf
+ :	    :let g:attr_test="FAILED: ".str
Karsten Hopp cd3dcf
+ :	    :let g:attr_test.="\n". join(g:attr, ' ')
Karsten Hopp cd3dcf
+ :	    :let g:attr_test.="\n TERM: ". &term
Karsten Hopp cd3dcf
+ :	endif
Karsten Hopp cd3dcf
+ :endfu
Karsten Hopp cd3dcf
+ :fu! DoRecordScreen()
Karsten Hopp cd3dcf
+ :	wincmd l
Karsten Hopp cd3dcf
+ :	$put =printf(\"\n%s\", g:test)
Karsten Hopp cd3dcf
+ :	$put =g:line
Karsten Hopp cd3dcf
+ :       $put =g:attr_test
Karsten Hopp cd3dcf
+ :	wincmd p
Karsten Hopp cd3dcf
+ :endfu
Karsten Hopp cd3dcf
+ :let g:test ="Test 1: simple addmatch()"
Karsten Hopp cd3dcf
+ :call matchadd('Conceal', '\%2l ')
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :let g:test ="Test 2: simple addmatch() and conceal (should be: #XThisXisXaXTest)"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :call clearmatches()
Karsten Hopp cd3dcf
+ :syntax on
Karsten Hopp cd3dcf
+ :set concealcursor=n conceallevel=1
Karsten Hopp cd3dcf
+ :call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :let g:test ="Test 3: addmatch() and conceallevel=3 (should be: #ThisisaTest)"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :set conceallevel=3
Karsten Hopp cd3dcf
+ :call clearmatches()
Karsten Hopp cd3dcf
+ :call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 1==2 && 1==3 && 1==4 && 0!=5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :let g:test ="Test 4: more match() (should be: #Thisisa Test)"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :call matchadd('ErrorMsg', '\%2l Test', 20, -1, {'conceal': 'X'})
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 1==2 && 0!=3 && 3==4 && 0!=5 && 3!=5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :let g:test ="Test 5/1: default conceal char (should be: # This is a Test)"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :call clearmatches()
Karsten Hopp cd3dcf
+ :set conceallevel=1
Karsten Hopp cd3dcf
+ :call matchadd('Conceal', '\%2l ', 10, -1, {})
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :let g:test ="Test 5/2: default conceal char (should be: #+This+is+a+Test)"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :set listchars=conceal:+
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :set listchars&vim
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :let g:test ="Test 6/1: syn and match conceal (should be: #ZThisZisZaZTest)"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :call clearmatches()
Karsten Hopp cd3dcf
+ :set conceallevel=1
Karsten Hopp cd3dcf
+ :call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
Karsten Hopp cd3dcf
+ :syn match MyConceal /\%2l / conceal containedin=ALL cchar=*
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :let g:test ="Test 6/2: syn and match conceal (should be: #*This*is*a*Test)"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :call clearmatches()
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :let g:test ="Test 7/1: clear matches"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :syn on
Karsten Hopp cd3dcf
+ :call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
Karsten Hopp cd3dcf
+ :let a=getmatches()
Karsten Hopp cd3dcf
+ :call clearmatches()
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 0==2 && 0==3 && 0==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :$put =a
Karsten Hopp cd3dcf
+ :call setmatches(a)
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :let g:test ="Test 7/2: reset match using setmatches()"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :let g:test ="Test 8: using matchaddpos() (should be #Pis a Test"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :call clearmatches()
Karsten Hopp cd3dcf
+ :call matchaddpos('Conceal', [[2,2,6]], 10, -1, {'conceal': 'P'})
Karsten Hopp cd3dcf
+ :let a=getmatches()
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1!=2 && 0==2 && 0==3 && 0!=4 && 0!=5 && 4==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :$put =a
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :let g:test ="Test 9: match using multibyte conceal char (should be: #ˑThisˑisˑaˑTest)"
Karsten Hopp cd3dcf
+ :norm! 'azt
Karsten Hopp cd3dcf
+ :call clearmatches()
Karsten Hopp cd3dcf
+ :call matchadd('Conceal', '\%2l ', 20, -1, {'conceal': "\u02d1"})
Karsten Hopp cd3dcf
+ :redraw!
Karsten Hopp cd3dcf
+ :let line=ScreenChar(winwidth(0),1)
Karsten Hopp cd3dcf
+ :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
Karsten Hopp cd3dcf
+ :call DoRecordScreen()
Karsten Hopp cd3dcf
+ :
Karsten Hopp cd3dcf
+ :"sleep 10
Karsten Hopp cd3dcf
+ :%w! test.out
Karsten Hopp cd3dcf
+ :qa!
Karsten Hopp cd3dcf
+ ENDTEST
Karsten Hopp cd3dcf
+ dummy text
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/testdir/test_match_conceal.ok	2015-07-21 15:45:35.391038216 +0200
Karsten Hopp cd3dcf
--- src/testdir/test_match_conceal.ok	2015-07-21 15:13:48.185280280 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 0 ****
Karsten Hopp cd3dcf
--- 1,52 ----
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ # This is a Test
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 1: simple addmatch()
Karsten Hopp cd3dcf
+ # This is a Test    
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 2: simple addmatch() and conceal (should be: #XThisXisXaXTest)
Karsten Hopp cd3dcf
+ #XThisXisXaXTest    
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 3: addmatch() and conceallevel=3 (should be: #ThisisaTest)
Karsten Hopp cd3dcf
+ #ThisisaTest        
Karsten Hopp cd3dcf
+ OK: g:attr[0]==g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]!=g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 4: more match() (should be: #Thisisa Test)
Karsten Hopp cd3dcf
+ #Thisisa Test       
Karsten Hopp cd3dcf
+ OK: g:attr[0]==g:attr[1] && g:attr[1]==g:attr[2] && g:attr[0]!=g:attr[3] && g:attr[3]==g:attr[4] && g:attr[0]!=g:attr[5] && g:attr[3]!=g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 5/1: default conceal char (should be: # This is a Test)
Karsten Hopp cd3dcf
+ # This is a Test    
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 5/2: default conceal char (should be: #+This+is+a+Test)
Karsten Hopp cd3dcf
+ #+This+is+a+Test    
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 6/1: syn and match conceal (should be: #ZThisZisZaZTest)
Karsten Hopp cd3dcf
+ #ZThisZisZaZTest    
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 6/2: syn and match conceal (should be: #*This*is*a*Test)
Karsten Hopp cd3dcf
+ #*This*is*a*Test    
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 7/1: clear matches
Karsten Hopp cd3dcf
+ # This is a Test    
Karsten Hopp cd3dcf
+ OK: g:attr[0]==g:attr[1] && g:attr[0]==g:attr[2] && g:attr[0]==g:attr[3] && g:attr[0]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
+ {'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': 10, 'conceal': 'Z'}
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 7/2: reset match using setmatches()
Karsten Hopp cd3dcf
+ #ZThisZisZaZTest    
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 8: using matchaddpos() (should be #Pis a Test
Karsten Hopp cd3dcf
+ #Pis a Test         
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]!=g:attr[2] && g:attr[0]==g:attr[2] && g:attr[0]==g:attr[3] && g:attr[0]!=g:attr[4] && g:attr[0]!=g:attr[5] && g:attr[4]==g:attr[5]
Karsten Hopp cd3dcf
+ {'group': 'Conceal', 'id': 11, 'priority': 10, 'pos1': [2, 2, 6], 'conceal': 'P'}
Karsten Hopp cd3dcf
+ 
Karsten Hopp cd3dcf
+ Test 9: match using multibyte conceal char (should be: #ˑThisˑisˑaˑTest)
Karsten Hopp cd3dcf
+ #ˑThisˑisˑaˑTest    
Karsten Hopp cd3dcf
+ OK: g:attr[0]!=g:attr[1] && g:attr[1]==g:attr[2] && g:attr[1]==g:attr[3] && g:attr[1]==g:attr[4] && g:attr[0]==g:attr[5]
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/window.c	2015-04-21 18:08:21.834719140 +0200
Karsten Hopp cd3dcf
--- src/window.c	2015-07-21 15:35:45.852684337 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 6943,6955 ****
Karsten Hopp cd3dcf
   * Return ID of added match, -1 on failure.
Karsten Hopp cd3dcf
   */
Karsten Hopp cd3dcf
      int
Karsten Hopp cd3dcf
! match_add(wp, grp, pat, prio, id, pos_list)
Karsten Hopp cd3dcf
      win_T	*wp;
Karsten Hopp cd3dcf
      char_u	*grp;
Karsten Hopp cd3dcf
      char_u	*pat;
Karsten Hopp cd3dcf
      int		prio;
Karsten Hopp cd3dcf
      int		id;
Karsten Hopp cd3dcf
      list_T	*pos_list;
Karsten Hopp cd3dcf
  {
Karsten Hopp cd3dcf
      matchitem_T	*cur;
Karsten Hopp cd3dcf
      matchitem_T	*prev;
Karsten Hopp cd3dcf
--- 6943,6956 ----
Karsten Hopp cd3dcf
   * Return ID of added match, -1 on failure.
Karsten Hopp cd3dcf
   */
Karsten Hopp cd3dcf
      int
Karsten Hopp cd3dcf
! match_add(wp, grp, pat, prio, id, pos_list, conceal_char)
Karsten Hopp cd3dcf
      win_T	*wp;
Karsten Hopp cd3dcf
      char_u	*grp;
Karsten Hopp cd3dcf
      char_u	*pat;
Karsten Hopp cd3dcf
      int		prio;
Karsten Hopp cd3dcf
      int		id;
Karsten Hopp cd3dcf
      list_T	*pos_list;
Karsten Hopp cd3dcf
+     char_u      *conceal_char UNUSED; /* pointer to conceal replacement char */
Karsten Hopp cd3dcf
  {
Karsten Hopp cd3dcf
      matchitem_T	*cur;
Karsten Hopp cd3dcf
      matchitem_T	*prev;
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 7009,7014 ****
Karsten Hopp cd3dcf
--- 7010,7020 ----
Karsten Hopp cd3dcf
      m->match.regprog = regprog;
Karsten Hopp cd3dcf
      m->match.rmm_ic = FALSE;
Karsten Hopp cd3dcf
      m->match.rmm_maxcol = 0;
Karsten Hopp cd3dcf
+ #ifdef FEAT_CONCEAL
Karsten Hopp cd3dcf
+     m->conceal_char = 0;
Karsten Hopp cd3dcf
+     if (conceal_char != NULL)
Karsten Hopp cd3dcf
+ 	m->conceal_char = (*mb_ptr2char)(conceal_char);
Karsten Hopp cd3dcf
+ #endif
Karsten Hopp cd3dcf
  
Karsten Hopp cd3dcf
      /* Set up position matches */
Karsten Hopp cd3dcf
      if (pos_list != NULL)
Karsten Hopp cd3dcf
*** ../vim-7.4.791/src/version.c	2015-07-21 15:03:00.695467174 +0200
Karsten Hopp cd3dcf
--- src/version.c	2015-07-21 15:14:54.272647935 +0200
Karsten Hopp cd3dcf
***************
Karsten Hopp cd3dcf
*** 743,744 ****
Karsten Hopp cd3dcf
--- 743,746 ----
Karsten Hopp cd3dcf
  {   /* Add new patch number below this line */
Karsten Hopp cd3dcf
+ /**/
Karsten Hopp cd3dcf
+     792,
Karsten Hopp cd3dcf
  /**/
Karsten Hopp cd3dcf
Karsten Hopp cd3dcf
-- 
Karsten Hopp cd3dcf
"Marriage is a wonderful institution...
Karsten Hopp cd3dcf
but who wants to live in an institution?"
Karsten Hopp cd3dcf
 - Groucho Marx
Karsten Hopp cd3dcf
Karsten Hopp cd3dcf
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp cd3dcf
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp cd3dcf
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp cd3dcf
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///