mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	Merge pull request #13060 from janlazo/vim-8.1.2310
vim-patch:8.1.{1619,1771,1624,2274,2310,2401},8.2.{554,1806}
			
			
This commit is contained in:
		@@ -337,7 +337,7 @@ return {
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    command='caddexpr',
 | 
					    command='caddexpr',
 | 
				
			||||||
    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR),
 | 
					    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM),
 | 
				
			||||||
    addr_type=ADDR_LINES,
 | 
					    addr_type=ADDR_LINES,
 | 
				
			||||||
    func='ex_cexpr',
 | 
					    func='ex_cexpr',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -409,7 +409,7 @@ return {
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    command='cexpr',
 | 
					    command='cexpr',
 | 
				
			||||||
    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR, BANG),
 | 
					    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, BANG),
 | 
				
			||||||
    addr_type=ADDR_LINES,
 | 
					    addr_type=ADDR_LINES,
 | 
				
			||||||
    func='ex_cexpr',
 | 
					    func='ex_cexpr',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -447,7 +447,7 @@ return {
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    command='cgetexpr',
 | 
					    command='cgetexpr',
 | 
				
			||||||
    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR),
 | 
					    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM),
 | 
				
			||||||
    addr_type=ADDR_LINES,
 | 
					    addr_type=ADDR_LINES,
 | 
				
			||||||
    func='ex_cexpr',
 | 
					    func='ex_cexpr',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -1299,7 +1299,7 @@ return {
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    command='laddexpr',
 | 
					    command='laddexpr',
 | 
				
			||||||
    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR),
 | 
					    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM),
 | 
				
			||||||
    addr_type=ADDR_LINES,
 | 
					    addr_type=ADDR_LINES,
 | 
				
			||||||
    func='ex_cexpr',
 | 
					    func='ex_cexpr',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -1389,7 +1389,7 @@ return {
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    command='lexpr',
 | 
					    command='lexpr',
 | 
				
			||||||
    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR, BANG),
 | 
					    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, BANG),
 | 
				
			||||||
    addr_type=ADDR_LINES,
 | 
					    addr_type=ADDR_LINES,
 | 
				
			||||||
    func='ex_cexpr',
 | 
					    func='ex_cexpr',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -1427,7 +1427,7 @@ return {
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    command='lgetexpr',
 | 
					    command='lgetexpr',
 | 
				
			||||||
    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM, TRLBAR),
 | 
					    flags=bit.bor(NEEDARG, WORD1, NOTRLCOM),
 | 
				
			||||||
    addr_type=ADDR_LINES,
 | 
					    addr_type=ADDR_LINES,
 | 
				
			||||||
    func='ex_cexpr',
 | 
					    func='ex_cexpr',
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6377,7 +6377,7 @@ void ex_cexpr(exarg_T *eap)
 | 
				
			|||||||
  // Evaluate the expression.  When the result is a string or a list we can
 | 
					  // Evaluate the expression.  When the result is a string or a list we can
 | 
				
			||||||
  // use it to fill the errorlist.
 | 
					  // use it to fill the errorlist.
 | 
				
			||||||
  typval_T tv;
 | 
					  typval_T tv;
 | 
				
			||||||
  if (eval0(eap->arg, &tv, NULL, true) != FAIL) {
 | 
					  if (eval0(eap->arg, &tv, &eap->nextcmd, true) != FAIL) {
 | 
				
			||||||
    if ((tv.v_type == VAR_STRING && tv.vval.v_string != NULL)
 | 
					    if ((tv.v_type == VAR_STRING && tv.vval.v_string != NULL)
 | 
				
			||||||
        || tv.v_type == VAR_LIST) {
 | 
					        || tv.v_type == VAR_LIST) {
 | 
				
			||||||
      incr_quickfix_busy();
 | 
					      incr_quickfix_busy();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -294,6 +294,13 @@ func GetVimCommandClean()
 | 
				
			|||||||
  return cmd
 | 
					  return cmd
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					" Get the command to run Vim, with --clean, and force to run in terminal so it
 | 
				
			||||||
 | 
					" won't start a new GUI.
 | 
				
			||||||
 | 
					func GetVimCommandCleanTerm()
 | 
				
			||||||
 | 
					  " Add -v to have gvim run in the terminal (if possible)
 | 
				
			||||||
 | 
					  return GetVimCommandClean() .. ' -v '
 | 
				
			||||||
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" Run Vim, using the "vimcmd" file and "-u NORC".
 | 
					" Run Vim, using the "vimcmd" file and "-u NORC".
 | 
				
			||||||
" "before" is a list of Vim commands to be executed before loading plugins.
 | 
					" "before" is a list of Vim commands to be executed before loading plugins.
 | 
				
			||||||
" "after" is a list of Vim commands to be executed after loading plugins.
 | 
					" "after" is a list of Vim commands to be executed after loading plugins.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -596,9 +596,17 @@ endfunc
 | 
				
			|||||||
" This test must come before the Test_cursorline test, as it appears this
 | 
					" This test must come before the Test_cursorline test, as it appears this
 | 
				
			||||||
" defines the Normal highlighting group anyway.
 | 
					" defines the Normal highlighting group anyway.
 | 
				
			||||||
func Test_1_highlight_Normalgroup_exists()
 | 
					func Test_1_highlight_Normalgroup_exists()
 | 
				
			||||||
  " MS-Windows GUI sets the font
 | 
					 | 
				
			||||||
  if !has('win32') || !has('gui_running')
 | 
					 | 
				
			||||||
  let hlNormal = HighlightArgs('Normal')
 | 
					  let hlNormal = HighlightArgs('Normal')
 | 
				
			||||||
 | 
					  if !has('gui_running')
 | 
				
			||||||
    call assert_match('hi Normal\s*clear', hlNormal)
 | 
					    call assert_match('hi Normal\s*clear', hlNormal)
 | 
				
			||||||
 | 
					  elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
 | 
				
			||||||
 | 
					    " expect is DEFAULT_FONT of gui_gtk_x11.c
 | 
				
			||||||
 | 
					    call assert_match('hi Normal\s*font=Monospace 10', hlNormal)
 | 
				
			||||||
 | 
					  elseif has('gui_motif') || has('gui_athena')
 | 
				
			||||||
 | 
					    " expect is DEFAULT_FONT of gui_x11.c
 | 
				
			||||||
 | 
					    call assert_match('hi Normal\s*font=7x13', hlNormal)
 | 
				
			||||||
 | 
					  elseif has('win32')
 | 
				
			||||||
 | 
					    " expect any font
 | 
				
			||||||
 | 
					    call assert_match('hi Normal\s*font=.*', hlNormal)
 | 
				
			||||||
  endif
 | 
					  endif
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -406,7 +406,7 @@ func Test_error_in_map_expr()
 | 
				
			|||||||
  [CODE]
 | 
					  [CODE]
 | 
				
			||||||
  call writefile(lines, 'Xtest.vim')
 | 
					  call writefile(lines, 'Xtest.vim')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let buf = term_start(GetVimCommandClean() .. ' -S Xtest.vim', {'term_rows': 8})
 | 
					  let buf = term_start(GetVimCommandCleanTerm() .. ' -S Xtest.vim', {'term_rows': 8})
 | 
				
			||||||
  let job = term_getjob(buf)
 | 
					  let job = term_getjob(buf)
 | 
				
			||||||
  call WaitForAssert({-> assert_notequal('', term_getline(buf, 8))})
 | 
					  call WaitForAssert({-> assert_notequal('', term_getline(buf, 8))})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,7 +95,7 @@ func XlistTests(cchar)
 | 
				
			|||||||
  " Populate the list and then try
 | 
					  " Populate the list and then try
 | 
				
			||||||
  Xgetexpr ['non-error 1', 'Xtestfile1:1:3:Line1',
 | 
					  Xgetexpr ['non-error 1', 'Xtestfile1:1:3:Line1',
 | 
				
			||||||
		  \ 'non-error 2', 'Xtestfile2:2:2:Line2',
 | 
							  \ 'non-error 2', 'Xtestfile2:2:2:Line2',
 | 
				
			||||||
		  \ 'non-error 3', 'Xtestfile3:3:1:Line3']
 | 
							  \ 'non-error| 3', 'Xtestfile3:3:1:Line3']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  " List only valid entries
 | 
					  " List only valid entries
 | 
				
			||||||
  let l = split(execute('Xlist', ''), "\n")
 | 
					  let l = split(execute('Xlist', ''), "\n")
 | 
				
			||||||
@@ -107,7 +107,7 @@ func XlistTests(cchar)
 | 
				
			|||||||
  let l = split(execute('Xlist!', ''), "\n")
 | 
					  let l = split(execute('Xlist!', ''), "\n")
 | 
				
			||||||
  call assert_equal([' 1: non-error 1', ' 2 Xtestfile1:1 col 3: Line1',
 | 
					  call assert_equal([' 1: non-error 1', ' 2 Xtestfile1:1 col 3: Line1',
 | 
				
			||||||
		   \ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2',
 | 
							   \ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2',
 | 
				
			||||||
		   \ ' 5: non-error 3', ' 6 Xtestfile3:3 col 1: Line3'], l)
 | 
							   \ ' 5: non-error| 3', ' 6 Xtestfile3:3 col 1: Line3'], l)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  " List a range of errors
 | 
					  " List a range of errors
 | 
				
			||||||
  let l = split(execute('Xlist 3,6', ''), "\n")
 | 
					  let l = split(execute('Xlist 3,6', ''), "\n")
 | 
				
			||||||
@@ -507,7 +507,7 @@ func Xtest_browse(cchar)
 | 
				
			|||||||
  Xexpr ""
 | 
					  Xexpr ""
 | 
				
			||||||
  call assert_equal(0, g:Xgetlist({'idx' : 0}).idx)
 | 
					  call assert_equal(0, g:Xgetlist({'idx' : 0}).idx)
 | 
				
			||||||
  call assert_equal(0, g:Xgetlist({'size' : 0}).size)
 | 
					  call assert_equal(0, g:Xgetlist({'size' : 0}).size)
 | 
				
			||||||
  Xaddexpr ['foo', 'bar', 'baz', 'quux', 'shmoo']
 | 
					  Xaddexpr ['foo', 'bar', 'baz', 'quux', 'sh|moo']
 | 
				
			||||||
  call assert_equal(5, g:Xgetlist({'size' : 0}).size)
 | 
					  call assert_equal(5, g:Xgetlist({'size' : 0}).size)
 | 
				
			||||||
  Xlast
 | 
					  Xlast
 | 
				
			||||||
  call assert_equal(5, g:Xgetlist({'idx' : 0}).idx)
 | 
					  call assert_equal(5, g:Xgetlist({'idx' : 0}).idx)
 | 
				
			||||||
@@ -4049,4 +4049,46 @@ func Test_qfcmd_abort()
 | 
				
			|||||||
  augroup END
 | 
					  augroup END
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					" Test for using a file in one of the parent directories.
 | 
				
			||||||
 | 
					func Test_search_in_dirstack()
 | 
				
			||||||
 | 
					  call mkdir('Xtestdir/a/b/c', 'p')
 | 
				
			||||||
 | 
					  let save_cwd = getcwd()
 | 
				
			||||||
 | 
					  call writefile(["X1_L1", "X1_L2"], 'Xtestdir/Xfile1')
 | 
				
			||||||
 | 
					  call writefile(["X2_L1", "X2_L2"], 'Xtestdir/a/Xfile2')
 | 
				
			||||||
 | 
					  call writefile(["X3_L1", "X3_L2"], 'Xtestdir/a/b/Xfile3')
 | 
				
			||||||
 | 
					  call writefile(["X4_L1", "X4_L2"], 'Xtestdir/a/b/c/Xfile4')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  let lines = "Entering dir Xtestdir\n" .
 | 
				
			||||||
 | 
						      \ "Entering dir a\n" .
 | 
				
			||||||
 | 
						      \ "Entering dir b\n" .
 | 
				
			||||||
 | 
						      \ "Xfile2:2:X2_L2\n" .
 | 
				
			||||||
 | 
						      \ "Leaving dir a\n" .
 | 
				
			||||||
 | 
						      \ "Xfile1:2:X1_L2\n" .
 | 
				
			||||||
 | 
						      \ "Xfile3:1:X3_L1\n" .
 | 
				
			||||||
 | 
						      \ "Entering dir c\n" .
 | 
				
			||||||
 | 
						      \ "Xfile4:2:X4_L2\n" .
 | 
				
			||||||
 | 
						      \ "Leaving dir c\n"
 | 
				
			||||||
 | 
					  set efm=%DEntering\ dir\ %f,%XLeaving\ dir\ %f,%f:%l:%m
 | 
				
			||||||
 | 
					  cexpr lines .. "Leaving dir Xtestdir|\n" | let next = 1
 | 
				
			||||||
 | 
					  call assert_equal(11, getqflist({'size' : 0}).size)
 | 
				
			||||||
 | 
					  call assert_equal(4, getqflist({'idx' : 0}).idx)
 | 
				
			||||||
 | 
					  call assert_equal('X2_L2', getline('.'))
 | 
				
			||||||
 | 
					  call assert_equal(1, next)
 | 
				
			||||||
 | 
					  cnext
 | 
				
			||||||
 | 
					  call assert_equal(6, getqflist({'idx' : 0}).idx)
 | 
				
			||||||
 | 
					  call assert_equal('X1_L2', getline('.'))
 | 
				
			||||||
 | 
					  cnext
 | 
				
			||||||
 | 
					  call assert_equal(7, getqflist({'idx' : 0}).idx)
 | 
				
			||||||
 | 
					  call assert_equal(1, line('$'))
 | 
				
			||||||
 | 
					  call assert_equal('', getline(1))
 | 
				
			||||||
 | 
					  cnext
 | 
				
			||||||
 | 
					  call assert_equal(9, getqflist({'idx' : 0}).idx)
 | 
				
			||||||
 | 
					  call assert_equal(1, line('$'))
 | 
				
			||||||
 | 
					  call assert_equal('', getline(1))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  set efm&
 | 
				
			||||||
 | 
					  exe 'cd ' . save_cwd
 | 
				
			||||||
 | 
					  call delete('Xtestdir', 'rf')
 | 
				
			||||||
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" vim: shiftwidth=2 sts=2 expandtab
 | 
					" vim: shiftwidth=2 sts=2 expandtab
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -355,7 +355,7 @@ func Test_error_in_timer_callback()
 | 
				
			|||||||
  [CODE]
 | 
					  [CODE]
 | 
				
			||||||
  call writefile(lines, 'Xtest.vim')
 | 
					  call writefile(lines, 'Xtest.vim')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let buf = term_start(GetVimCommandClean() .. ' -S Xtest.vim', {'term_rows': 8})
 | 
					  let buf = term_start(GetVimCommandCleanTerm() .. ' -S Xtest.vim', {'term_rows': 8})
 | 
				
			||||||
  let job = term_getjob(buf)
 | 
					  let job = term_getjob(buf)
 | 
				
			||||||
  call WaitForAssert({-> assert_notequal('', term_getline(buf, 8))})
 | 
					  call WaitForAssert({-> assert_notequal('', term_getline(buf, 8))})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user