Patch 7.4.1740
Problem:    syn-cchar defined with matchadd() does not appear if there are no
            other syntax definitions which matches buffer text.
Solution:   Check for startcol. (Ozaki Kiichi, haya14busa, closes #757)
Files:      src/screen.c, src/testdir/Make_all.mak,
            src/testdir/test_alot_utf8.vim, src/testdir/test_match_conceal.in,
            src/testdir/test_match_conceal.ok,
            src/testdir/test_matchadd_conceal.vim,
            src/testdir/test_matchadd_conceal_utf8.vim,
            src/testdir/test_undolevels.vim


*** ../vim-7.4.1739/src/screen.c        2016-04-11 21:54:58.497878752 +0200
--- src/screen.c        2016-04-14 17:59:07.009275638 +0200
***************
*** 3057,3064 ****
                                           wrapping */
      int               vcol_off        = 0;    /* offset for concealed 
characters */
      int               did_wcol        = FALSE;
!     int               match_conc      = FALSE; /* cchar for match functions */
!     int               has_match_conc  = FALSE; /* match wants to conceal */
      int               old_boguscols   = 0;
  # define VCOL_HLC (vcol - vcol_off)
  # define FIX_FOR_BOGUSCOLS \
--- 3057,3064 ----
                                           wrapping */
      int               vcol_off        = 0;    /* offset for concealed 
characters */
      int               did_wcol        = FALSE;
!     int               match_conc      = 0;    /* cchar for match functions */
!     int               has_match_conc  = 0;    /* match wants to conceal */
      int               old_boguscols   = 0;
  # define VCOL_HLC (vcol - vcol_off)
  # define FIX_FOR_BOGUSCOLS \
***************
*** 3595,3601 ****
      for (;;)
      {
  #ifdef FEAT_CONCEAL
!       has_match_conc = FALSE;
  #endif
        /* Skip this quickly when working on the text. */
        if (draw_state != WL_LINE)
--- 3595,3601 ----
      for (;;)
      {
  #ifdef FEAT_CONCEAL
!       has_match_conc = 0;
  #endif
        /* Skip this quickly when working on the text. */
        if (draw_state != WL_LINE)
***************
*** 3944,3954 ****
                            if (cur != NULL && syn_name2id((char_u *)"Conceal")
                                                               == cur->hlg_id)
                            {
!                               has_match_conc = TRUE;
                                match_conc = cur->conceal_char;
                            }
                            else
!                               has_match_conc = match_conc = FALSE;
  #endif
                        }
                        else if (v == (long)shl->endcol)
--- 3944,3955 ----
                            if (cur != NULL && syn_name2id((char_u *)"Conceal")
                                                               == cur->hlg_id)
                            {
!                               has_match_conc =
!                                            v == (long)shl->startcol ? 2 : 1;
                                match_conc = cur->conceal_char;
                            }
                            else
!                               has_match_conc = match_conc = 0;
  #endif
                        }
                        else if (v == (long)shl->endcol)
***************
*** 4905,4916 ****
            if (   wp->w_p_cole > 0
                && (wp != curwin || lnum != wp->w_cursor.lnum ||
                                                        conceal_cursor_line(wp) 
)
!               && ( (syntax_flags & HL_CONCEAL) != 0 || has_match_conc)
                && !(lnum_in_visual_area
                                    && vim_strchr(wp->w_p_cocu, 'v') == NULL))
            {
                char_attr = conceal_attr;
!               if (prev_syntax_id != syntax_seqnr
                        && (syn_get_sub_char() != NUL || match_conc
                                                         || wp->w_p_cole == 1)
                        && wp->w_p_cole != 3)
--- 4906,4917 ----
            if (   wp->w_p_cole > 0
                && (wp != curwin || lnum != wp->w_cursor.lnum ||
                                                        conceal_cursor_line(wp) 
)
!               && ( (syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0)
                && !(lnum_in_visual_area
                                    && vim_strchr(wp->w_p_cocu, 'v') == NULL))
            {
                char_attr = conceal_attr;
!               if ((prev_syntax_id != syntax_seqnr || has_match_conc > 1)
                        && (syn_get_sub_char() != NUL || match_conc
                                                         || wp->w_p_cole == 1)
                        && wp->w_p_cole != 3)
*** ../vim-7.4.1739/src/testdir/Make_all.mak    2016-04-03 14:00:29.320148959 
+0200
--- src/testdir/Make_all.mak    2016-04-14 17:59:07.009275638 +0200
***************
*** 104,110 ****
        test_listlbr.out \
        test_mapping.out \
        test_marks.out \
-       test_match_conceal.out \
        test_nested_function.out \
        test_options.out \
        test_ruby.out \
--- 104,109 ----
***************
*** 164,170 ****
  
  
  # Tests using runtest.vim.vim.
! # Keep test_alot.res as the last one, sort the others.
  NEW_TESTS = test_arglist.res \
            test_assert.res \
            test_backspace_opt.res \
--- 163,169 ----
  
  
  # Tests using runtest.vim.vim.
! # Keep test_alot*.res as the last one, sort the others.
  NEW_TESTS = test_arglist.res \
            test_assert.res \
            test_backspace_opt.res \
***************
*** 175,180 ****
--- 174,180 ----
            test_increment.res \
            test_json.res \
            test_langmap.res \
+           test_matchadd_conceal.res \
            test_packadd.res \
            test_perl.res \
            test_quickfix.res \
*** ../vim-7.4.1739/src/testdir/test_alot_utf8.vim      2016-04-14 
16:56:57.115452561 +0200
--- src/testdir/test_alot_utf8.vim      2016-04-14 17:59:07.009275638 +0200
***************
*** 5,8 ****
--- 5,9 ----
  " files, so that they can be run by themselves.
  
  source test_expr_utf8.vim
+ source test_matchadd_conceal_utf8.vim
  source test_regexp_utf8.vim
*** ../vim-7.4.1739/src/testdir/test_match_conceal.in   2015-07-21 
15:48:13.593517912 +0200
--- src/testdir/test_match_conceal.in   1970-01-01 01:00:00.000000000 +0100
***************
*** 1,159 ****
- Test for matchadd() and conceal feature
- 
- STARTTEST
- :so small.vim
- :if !has("conceal") | e! test.ok | w! test.out | qa! | endif
- :set term=ansi
- :so mbyte.vim
- :if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif
- :10new|:vsp|:vert resize 20
- :put =\"\#\ This\ is\ a\ Test\"
- :norm! mazt
- :fu! ScreenChar(width, lines)
- :     let c=''
- :     for j in range(1,a:lines)
- :         for i in range(1,a:width)
- :             let c.=nr2char(screenchar(j, i))
- :         endfor
- :           let c.="\n"
- :     endfor
- :     return c
- :endfu
- :fu! ScreenAttr(line, pos, eval)
- :       let g:attr=[]
- :       for col in a:pos
- :         call add(g:attr, screenattr(a:line,col))
- :     endfor
- :     " In case all values are zero, probably the terminal
- :       " isn't set correctly, so catch that case
- :     let null = (eval(join(g:attr, '+')) == 0)
- :       let str=substitute(a:eval, '\d\+', 'g:attr[&]', 'g')
- :     if null || eval(str)
- :         :let g:attr_test="OK: ". str
- :     else
- :         :let g:attr_test="FAILED: ".str
- :         :let g:attr_test.="\n". join(g:attr, ' ')
- :         :let g:attr_test.="\n TERM: ". &term
- :     endif
- :endfu
- :fu! DoRecordScreen()
- :     wincmd l
- :     $put =printf(\"\n%s\", g:test)
- :     $put =g:line
- :       $put =g:attr_test
- :     wincmd p
- :endfu
- :let g:test ="Test 1: simple addmatch()"
- :call matchadd('Conceal', '\%2l ')
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
- :call DoRecordScreen()
- :
- :let g:test ="Test 2: simple addmatch() and conceal (should be: 
#XThisXisXaXTest)"
- :norm! 'azt
- :call clearmatches()
- :syntax on
- :set concealcursor=n conceallevel=1
- :call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
- :call DoRecordScreen()
- :
- :let g:test ="Test 3: addmatch() and conceallevel=3 (should be: #ThisisaTest)"
- :norm! 'azt
- :set conceallevel=3
- :call clearmatches()
- :call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 1==2 && 1==3 && 1==4 && 0!=5")
- :call DoRecordScreen()
- :
- :let g:test ="Test 4: more match() (should be: #Thisisa Test)"
- :norm! 'azt
- :call matchadd('ErrorMsg', '\%2l Test', 20, -1, {'conceal': 'X'})
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 1==2 && 0!=3 && 3==4 && 0!=5 && 
3!=5")
- :call DoRecordScreen()
- :
- :let g:test ="Test 5/1: default conceal char (should be: # This is a Test)"
- :norm! 'azt
- :call clearmatches()
- :set conceallevel=1
- :call matchadd('Conceal', '\%2l ', 10, -1, {})
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
- :call DoRecordScreen()
- :let g:test ="Test 5/2: default conceal char (should be: #+This+is+a+Test)"
- :norm! 'azt
- :set listchars=conceal:+
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
- :call DoRecordScreen()
- :set listchars&vim
- :
- :let g:test ="Test 6/1: syn and match conceal (should be: #ZThisZisZaZTest)"
- :norm! 'azt
- :call clearmatches()
- :set conceallevel=1
- :call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
- :syn match MyConceal /\%2l / conceal containedin=ALL cchar=*
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
- :call DoRecordScreen()
- :let g:test ="Test 6/2: syn and match conceal (should be: #*This*is*a*Test)"
- :norm! 'azt
- :call clearmatches()
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
- :call DoRecordScreen()
- :
- :let g:test ="Test 7/1: clear matches"
- :norm! 'azt
- :syn on
- :call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
- :let a=getmatches()
- :call clearmatches()
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0==1 && 0==2 && 0==3 && 0==4 && 0==5")
- :call DoRecordScreen()
- :$put =a
- :call setmatches(a)
- :norm! 'azt
- :let g:test ="Test 7/2: reset match using setmatches()"
- :norm! 'azt
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
- :call DoRecordScreen()
- :
- :let g:test ="Test 8: using matchaddpos() (should be #Pis a Test"
- :norm! 'azt
- :call clearmatches()
- :call matchaddpos('Conceal', [[2,2,6]], 10, -1, {'conceal': 'P'})
- :let a=getmatches()
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1!=2 && 0==2 && 0==3 && 0!=4 && 
0!=5 && 4==5")
- :call DoRecordScreen()
- :$put =a
- :
- :let g:test ="Test 9: match using multibyte conceal char (should be: 
#ˑThisˑisˑaˑTest)"
- :norm! 'azt
- :call clearmatches()
- :call matchadd('Conceal', '\%2l ', 20, -1, {'conceal': "\u02d1"})
- :redraw!
- :let line=ScreenChar(winwidth(0),1)
- :call ScreenAttr(1,[1,2,7,10,12,16], "0!=1 && 1==2 && 1==3 && 1==4 && 0==5")
- :call DoRecordScreen()
- :
- :"sleep 10
- :%w! test.out
- :qa!
- ENDTEST
- dummy text
--- 0 ----
*** ../vim-7.4.1739/src/testdir/test_match_conceal.ok   2015-07-21 
15:48:13.593517912 +0200
--- src/testdir/test_match_conceal.ok   1970-01-01 01:00:00.000000000 +0100
***************
*** 1,52 ****
- 
- # This is a Test
- 
- Test 1: simple addmatch()
- # This is a Test    
- 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]
- 
- Test 2: simple addmatch() and conceal (should be: #XThisXisXaXTest)
- #XThisXisXaXTest    
- 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]
- 
- Test 3: addmatch() and conceallevel=3 (should be: #ThisisaTest)
- #ThisisaTest        
- 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]
- 
- Test 4: more match() (should be: #Thisisa Test)
- #Thisisa Test       
- 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]
- 
- Test 5/1: default conceal char (should be: # This is a Test)
- # This is a Test    
- 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]
- 
- Test 5/2: default conceal char (should be: #+This+is+a+Test)
- #+This+is+a+Test    
- 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]
- 
- Test 6/1: syn and match conceal (should be: #ZThisZisZaZTest)
- #ZThisZisZaZTest    
- 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]
- 
- Test 6/2: syn and match conceal (should be: #*This*is*a*Test)
- #*This*is*a*Test    
- 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]
- 
- Test 7/1: clear matches
- # This is a Test    
- 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]
- {'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': 10, 'conceal': 
'Z'}
- 
- Test 7/2: reset match using setmatches()
- #ZThisZisZaZTest    
- 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]
- 
- Test 8: using matchaddpos() (should be #Pis a Test
- #Pis a Test         
- 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]
- {'group': 'Conceal', 'id': 11, 'priority': 10, 'pos1': [2, 2, 6], 'conceal': 
'P'}
- 
- Test 9: match using multibyte conceal char (should be: #ˑThisˑisˑaˑTest)
- #ˑThisˑisˑaˑTest    
- 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]
--- 0 ----
*** ../vim-7.4.1739/src/testdir/test_matchadd_conceal.vim       2016-04-14 
19:47:24.006526231 +0200
--- src/testdir/test_matchadd_conceal.vim       2016-04-14 17:59:07.009275638 
+0200
***************
*** 0 ****
--- 1,266 ----
+ " Test for matchadd() and conceal feature
+ if !has('conceal')
+   finish
+ endif
+ 
+ if !has('gui_running') && has('unix')
+   set term=ansi
+ endif
+ 
+ function! s:screenline(lnum) abort
+   let line = []
+   for c in range(1, winwidth(0))
+     call add(line, nr2char(screenchar(a:lnum, c)))
+   endfor
+   return s:trim(join(line, ''))
+ endfunction
+ 
+ function! s:trim(str) abort
+   return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$')
+ endfunction
+ 
+ function! Test_simple_matchadd()
+   new
+ 
+   1put='# This is a Test'
+   "             1234567890123456
+   let expect = '# This is a Test'
+ 
+   call cursor(1, 1)
+   call matchadd('Conceal', '\%2l ')
+   redraw!
+   let lnum = 2
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   quit!
+ endfunction
+ 
+ function! Test_simple_matchadd_and_conceal()
+   new
+   setlocal concealcursor=n conceallevel=1
+ 
+   1put='# This is a Test'
+   "             1234567890123456
+   let expect = '#XThisXisXaXTest'
+ 
+   call cursor(1, 1)
+   call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
+   redraw!
+   let lnum = 2
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   quit!
+ endfunction
+ 
+ function! Test_matchadd_and_conceallevel_3()
+   new
+ 
+   setlocal conceallevel=3
+   " set filetype and :syntax on to change screenattr()
+   setlocal filetype=conf
+   syntax on
+ 
+   1put='# This is a Test'
+   "             1234567890123456
+   let expect = '#ThisisaTest'
+ 
+   call cursor(1, 1)
+   call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
+   redraw!
+   let lnum = 2
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   " more matchadd()
+   "             1234567890123456
+   let expect = '#Thisisa Test'
+ 
+   call matchadd('ErrorMsg', '\%2l Test', 20, -1, {'conceal': 'X'})
+   redraw!
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2) , screenattr(lnum, 7))
+   call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 10), screenattr(lnum, 12))
+   call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 16))
+   call assert_notequal(screenattr(lnum, 10), screenattr(lnum, 16))
+ 
+   syntax off
+   quit!
+ endfunction
+ 
+ function! Test_default_conceal_char()
+   new
+   setlocal concealcursor=n conceallevel=1
+ 
+   1put='# This is a Test'
+   "             1234567890123456
+   let expect = '# This is a Test'
+ 
+   call cursor(1, 1)
+   call matchadd('Conceal', '\%2l ', 10, -1, {})
+   redraw!
+   let lnum = 2
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   "             1234567890123456
+   let expect = '#+This+is+a+Test'
+   let listchars_save = &listchars
+   set listchars=conceal:+
+   redraw!
+ 
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   let &listchars = listchars_save
+   quit!
+ endfunction
+ 
+ function! Test_syn_and_match_conceal()
+   new
+   setlocal concealcursor=n conceallevel=1
+ 
+   1put='# This is a Test'
+   "             1234567890123456
+   let expect = '#ZThisZisZaZTest'
+ 
+   call cursor(1, 1)
+   call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
+   syntax match MyConceal /\%2l / conceal containedin=ALL cchar=*
+   redraw!
+   let lnum = 2
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   "             1234567890123456
+   let expect = '#*This*is*a*Test'
+   call clearmatches()
+   redraw!
+ 
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   syntax off
+   quit!
+ endfunction
+ 
+ function! Test_clearmatches()
+   new
+   setlocal concealcursor=n conceallevel=1
+ 
+   1put='# This is a Test'
+   "             1234567890123456
+   let expect = '# This is a Test'
+ 
+   call cursor(1, 1)
+   call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
+   let a = getmatches()
+   call clearmatches()
+   redraw!
+ 
+   let lnum = 2
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   " reset match using setmatches()
+   "             1234567890123456
+   let expect = '#ZThisZisZaZTest'
+   call setmatches(a)
+   redraw!
+ 
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+   call assert_equal({'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 
'id': a[0].id, 'conceal': 'Z'}, a[0])
+ 
+   quit!
+ endfunction
+ 
+ function! Test_using_matchaddpos()
+   new
+   setlocal concealcursor=n conceallevel=1
+   " set filetype and :syntax on to change screenattr()
+   setlocal filetype=conf
+   syntax on
+ 
+   1put='# This is a Test'
+   "             1234567890123456
+   let expect = '#Pis a Test'
+ 
+   call cursor(1, 1)
+   call matchaddpos('Conceal', [[2,2,6]], 10, -1, {'conceal': 'P'})
+   let a = getmatches()
+   redraw!
+ 
+   let lnum = 2
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 2))
+   call assert_notequal(screenattr(lnum, 2) , screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 10))
+   call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 12))
+   call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 16))
+   call assert_equal(screenattr(lnum, 12), screenattr(lnum, 16))
+   call assert_equal({'group': 'Conceal', 'id': a[0].id, 'priority': 10, 
'pos1': [2, 2, 6], 'conceal': 'P'}, a[0])
+ 
+   syntax off
+   quit!
+ endfunction
+ 
+ function! Test_matchadd_repeat_conceal_with_syntax_off()
+   new
+ 
+   " To test targets in the same line string is replaced with conceal char
+   " correctly, repeat 'TARGET'
+   1put ='TARGET_TARGETTARGET'
+   call cursor(1, 1)
+   redraw
+   call assert_equal('TARGET_TARGETTARGET', s:screenline(2))
+ 
+   setlocal conceallevel=2
+   call matchadd('Conceal', 'TARGET', 10, -1, {'conceal': 't'})
+ 
+   redraw
+   call assert_equal('t_tt', s:screenline(2))
+ 
+   quit!
+ endfunction
*** ../vim-7.4.1739/src/testdir/test_matchadd_conceal_utf8.vim  2016-04-14 
19:47:24.010526191 +0200
--- src/testdir/test_matchadd_conceal_utf8.vim  2016-04-14 17:59:07.009275638 
+0200
***************
*** 0 ****
--- 1,45 ----
+ " Test for matchadd() and conceal feature using utf-8.
+ if !has('conceal') || !has('multi_byte')
+   finish
+ endif
+ set encoding=utf-8
+ scriptencoding utf-8
+ 
+ if !has('gui_running') && has('unix')
+   set term=ansi
+ endif
+ 
+ function! s:screenline(lnum) abort
+   let line = []
+   for c in range(1, winwidth(0))
+     call add(line, nr2char(screenchar(a:lnum, c)))
+   endfor
+   return s:trim(join(line, ''))
+ endfunction
+ 
+ function! s:trim(str) abort
+   return matchstr(a:str,'^\s*\zs.\{-}\ze\s*$')
+ endfunction
+ 
+ function! Test_match_using_multibyte_conceal_char()
+   new
+   setlocal concealcursor=n conceallevel=1
+ 
+   1put='# This is a Test'
+   "             1234567890123456
+   let expect = '#ˑThisˑisˑaˑTest'
+ 
+   call cursor(1, 1)
+   call matchadd('Conceal', '\%2l ', 20, -1, {'conceal': "\u02d1"})
+   redraw!
+ 
+   let lnum = 2
+   call assert_equal(expect, s:screenline(lnum))
+   call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
+   call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
+   call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
+ 
+   quit!
+ endfunction
*** ../vim-7.4.1739/src/testdir/test_undolevels.vim     2016-03-15 
17:43:51.633786581 +0100
--- src/testdir/test_undolevels.vim     2016-04-14 18:37:47.389426360 +0200
***************
*** 41,44 ****
--- 41,48 ----
    call assert_equal(50, &g:undolevels)
    call assert_equal(-123456, &l:undolevels)
  
+   " Drop created windows
+   set ul&
+   new
+   only!
  endfunc
*** ../vim-7.4.1739/src/version.c       2016-04-14 19:44:33.104277737 +0200
--- src/version.c       2016-04-14 19:45:37.527617521 +0200
***************
*** 750,751 ****
--- 750,753 ----
  {   /* Add new patch number below this line */
+ /**/
+     1740,
  /**/

-- 
FIRST HEAD:  Oh! quick! get the sword out I want to cut his head off.
THIRD HEAD:  Oh, cut your own head off.
SECOND HEAD: Yes - do us all a favour.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui