diff options
-rw-r--r-- | runtime/autoload/health.vim | 2 | ||||
-rw-r--r-- | runtime/autoload/health/provider.vim | 20 | ||||
-rw-r--r-- | src/nvim/ops.c | 2 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 4 | ||||
-rw-r--r-- | src/nvim/version.c | 6 | ||||
-rw-r--r-- | test/functional/legacy/010_errorformat_spec.lua | 156 | ||||
-rw-r--r-- | test/functional/legacy/increment_spec.lua | 13 | ||||
-rw-r--r-- | test/functional/legacy/quickfix_spec.lua | 156 | ||||
-rw-r--r-- | test/functional/plugin/health_spec.lua | 1 |
9 files changed, 189 insertions, 171 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index a84cb6a3cc..9e32067204 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -58,7 +58,7 @@ function! health#check(plugin_names) abort let output = execute( \ 'call health#report_error(''Failed to run healthcheck for "' \ .s:to_plugin_name(c) - \ .'" plugin. Exception:''."\n".v:exception)') + \ .'" plugin. Exception:''."\n".v:throwpoint."\n".v:exception)') endif endtry call append('$', split(output, "\n") + ['']) diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 16ce2e3249..0d837e9dea 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -26,10 +26,8 @@ endfunction " Handler for s:system() function. function! s:system_handler(jobid, data, event) abort - if a:event == 'stdout' - let self.stdout .= join(a:data, '') - elseif a:event == 'stderr' - let self.stderr .= join(a:data, '') + if a:event == 'stdout' || a:event == 'stderr' + let self.output .= join(a:data, '') elseif a:event == 'exit' let s:shell_error = a:data endif @@ -39,8 +37,7 @@ endfunction function! s:system(cmd, ...) abort let stdin = a:0 ? a:1 : '' let opts = { - \ 'stdout': '', - \ 'stderr': '', + \ 'output': '', \ 'on_stdout': function('s:system_handler'), \ 'on_stderr': function('s:system_handler'), \ 'on_exit': function('s:system_handler'), @@ -51,7 +48,7 @@ function! s:system(cmd, ...) abort call health#report_error(printf('Command error %d: %s', jobid, \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))) let s:shell_error = 1 - return '' + return opts.output endif if !empty(stdin) @@ -66,10 +63,10 @@ function! s:system(cmd, ...) abort elseif s:shell_error != 0 call health#report_error(printf("Command error (%d) %s: %s", jobid, \ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd, - \ opts.stderr)) + \ opts.output)) endif - return opts.stdout + return opts.output endfunction function! s:systemlist(cmd, ...) abort @@ -409,7 +406,10 @@ endfunction function! s:check_ruby() abort call health#report_start('Ruby provider') - let ruby_version = s:systemlist('ruby -v')[0] + let ruby_version = 'not found' + if executable('ruby') + let ruby_version = s:systemlist('ruby -v')[0] + endif let ruby_prog = provider#ruby#Detect() let suggestions = \ ['Install or upgrade the neovim RubyGem using `gem install neovim`.'] diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 0263bd15da..dfa89acb1a 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -4679,6 +4679,8 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1) theend: if (visual) { curwin->w_cursor = save_cursor; + } else if (did_change) { + curwin->w_set_curswant = true; } return did_change; diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index f23037613b..d6697902ef 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2970,6 +2970,7 @@ void ex_vimgrep(exarg_T *eap) /* Get the search pattern: either white-separated or enclosed in // */ regmatch.regprog = NULL; + char_u *title = vim_strsave(*eap->cmdlinep); p = skip_vimgrep_pat(eap->arg, &s, &flags); if (p == NULL) { EMSG(_(e_invalpat)); @@ -3001,7 +3002,7 @@ void ex_vimgrep(exarg_T *eap) && eap->cmdidx != CMD_vimgrepadd && eap->cmdidx != CMD_lvimgrepadd) || qi->qf_curlist == qi->qf_listcount) { // make place for a new list - qf_new_list(qi, *eap->cmdlinep); + qf_new_list(qi, title != NULL ? title : *eap->cmdlinep); } else if (qi->qf_lists[qi->qf_curlist].qf_count > 0) { // Adding to existing list, find last entry. for (prevp = qi->qf_lists[qi->qf_curlist].qf_start; @@ -3229,6 +3230,7 @@ void ex_vimgrep(exarg_T *eap) } theend: + xfree(title); xfree(dirname_now); xfree(dirname_start); xfree(target_dir); diff --git a/src/nvim/version.c b/src/nvim/version.c index 055a997cd4..a51c2b6ea9 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -810,7 +810,7 @@ static int included_patches[] = { // 1637 NA // 1636 NA // 1635 NA - // 1634, + 1634, // 1633 NA // 1632 NA // 1631 NA @@ -830,7 +830,7 @@ static int included_patches[] = { // 1617 NA // 1616 NA // 1615 NA - // 1614, + 1614, // 1613 NA // 1612 NA // 1611 NA @@ -853,7 +853,7 @@ static int included_patches[] = { // 1594 NA // 1593 NA 1592, - // 1591, + 1591, // 1590, // 1589, 1588, diff --git a/test/functional/legacy/010_errorformat_spec.lua b/test/functional/legacy/010_errorformat_spec.lua deleted file mode 100644 index 785bf136b5..0000000000 --- a/test/functional/legacy/010_errorformat_spec.lua +++ /dev/null @@ -1,156 +0,0 @@ --- Test for 'errorformat'. This will fail if the quickfix feature was --- disabled. - -local helpers = require('test.functional.helpers')(after_each) -local feed, clear, execute = helpers.feed, helpers.clear, helpers.execute -local expect, write_file = helpers.expect, helpers.write_file - -describe('errorformat', function() - setup(function() - clear() - local error_file_text = [[ - start of errorfile - "Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set. - "Xtestfile", line 6 col 19; this is an error - gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c - Xtestfile:9: parse error before `asd' - make: *** [vim] Error 1 - in file "Xtestfile" linenr 10: there is an error - - 2 returned - "Xtestfile", line 11 col 1; this is an error - "Xtestfile", line 12 col 2; this is another error - "Xtestfile", line 14:10; this is an error in column 10 - =Xtestfile=, line 15:10; this is another error, but in vcol 10 this time - "Xtestfile", linenr 16: yet another problem - Error in "Xtestfile" at line 17: - x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17 - ^ - Error in "Xtestfile" at line 18: - x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18 - .............^ - Error in "Xtestfile" at line 19: - x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19 - --------------^ - Error in "Xtestfile" at line 20: - x should be a dot - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20 - ^ - - Does anyone know what is the problem and how to correction it? - "Xtestfile", line 21 col 9: What is the title of the quickfix window? - "Xtestfile", line 22 col 9: What is the title of the quickfix window? - ]] - write_file('Xerrorfile1', error_file_text .. 'end of errorfile\n') - write_file('Xerrorfile2', error_file_text) - write_file('Xtestfile', [[ - start of testfile - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22 - end of testfile - ]]) - end) - teardown(function() - os.remove('Xerrorfile1') - os.remove('Xerrorfile2') - os.remove('Xtestfile') - end) - - it('is working', function() - -- Also test a BOM is ignored. - execute( - 'set encoding=utf-8', - [[set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m]], - [[set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m]], - 'cf Xerrorfile2', - 'clast', - 'copen', - 'let a=w:quickfix_title', - 'wincmd p' - ) - feed('lgR<C-R>=a<CR><esc>') - execute('cf Xerrorfile1') - feed('grA<cr>') - execute('cn') - feed('gRLINE 6, COL 19<esc>') - execute('cn') - feed('gRNO COLUMN SPECIFIED<esc>') - execute('cn') - feed('gRAGAIN NO COLUMN<esc>') - execute('cn') - feed('gRCOL 1<esc>') - execute('cn') - feed('gRCOL 2<esc>') - execute('cn') - feed('gRCOL 10<esc>') - execute('cn') - feed('gRVCOL 10<esc>') - execute('cn') - feed('grI<cr>') - execute('cn') - feed('gR. SPACE POINTER<esc>') - execute('cn') - feed('gR. DOT POINTER<esc>') - execute('cn') - feed('gR. DASH POINTER<esc>') - execute('cn') - feed('gR. TAB-SPACE POINTER<esc>') - execute( - 'clast', - 'cprev', - 'cprev', - 'wincmd w', - 'let a=w:quickfix_title', - 'wincmd p' - ) - feed('lgR<C-R>=a<CR><esc>') - - -- Assert buffer contents. - expect([[ - start of testfile - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3 - xxxxxxxxxxAxxxxxxxxxxxxxxxxxxx line 4 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5 - xxxxxxxxxxxxxxxxxLINE 6, COL 19 line 6 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8 - NO COLUMN SPECIFIEDxxxxxxxxxxx line 9 - AGAIN NO COLUMNxxxxxxxxxxxxxxx line 10 - COL 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11 - COL 2xxxxxxxxxxxxxxxxxxxxxxxxx line 12 - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13 - xxxxxxxxCOL 10xxxxxxxxxxxxxxxx line 14 - xVCOL 10xxxxxxxxxxxxxxxxxxxxxx line 15 - Ixxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16 - xxxx. SPACE POINTERxxxxxxxxxxx line 17 - xxxxx. DOT POINTERxxxxxxxxxxxx line 18 - xxxxxx. DASH POINTERxxxxxxxxxx line 19 - xxxxxxx. TAB-SPACE POINTERxxxx line 20 - xxxxxxxx:cf Xerrorfile1xxxxxxx line 21 - xxxxxxxx:cf Xerrorfile2xxxxxxx line 22 - end of testfile]]) - end) -end) diff --git a/test/functional/legacy/increment_spec.lua b/test/functional/legacy/increment_spec.lua index 0483edc934..a76718ed8e 100644 --- a/test/functional/legacy/increment_spec.lua +++ b/test/functional/legacy/increment_spec.lua @@ -727,6 +727,14 @@ describe('Ctrl-A/Ctrl-X on visual selections', function() exec "norm! gg$\<C-A>" call assert_equal("002", getline(1)) endfunc + + " Test a regression of patch 7.4.1087 fixed. + func Test_normal_increment_02() + call setline(1, ["hello 10", "world"]) + exec "norm! ggl\<C-A>jx" + call assert_equal(["hello 11", "worl"], getline(1, '$')) + call assert_equal([0, 2, 4, 0], getpos('.')) + endfunc ]=]) end) @@ -745,4 +753,9 @@ describe('Ctrl-A/Ctrl-X on visual selections', function() call('Test_normal_increment_01') eq({}, nvim.get_vvar('errors')) end) + + it('maintains correct column after CTRL-A', function() + call('Test_normal_increment_02') + eq({}, nvim.get_vvar('errors')) + end) end) diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua index 7657b8641b..b5a8e10a97 100644 --- a/test/functional/legacy/quickfix_spec.lua +++ b/test/functional/legacy/quickfix_spec.lua @@ -389,6 +389,23 @@ describe('helpgrep', function() augroup! testgroup endfunction + + func Test_vimgreptitle() + augroup QfBufWinEnter + au! + au BufWinEnter * :let g:a=get(w:, 'quickfix_title', 'NONE') + augroup END + try + vimgrep /pattern/j file + catch /E480/ + endtry + copen + call assert_equal(': vimgrep /pattern/j file', g:a) + augroup QfBufWinEnter + au! + augroup END + augroup! QfBufWinEnter + endfunc ]]) end) @@ -447,6 +464,11 @@ describe('helpgrep', function() eq(':setqflist()', eval('g:foo')) end) + it('does not truncate quickfix title', function() + call('Test_vimgreptitle') + expected_empty() + end) + it('errors when an autocommand closes the location list\'s window', function() call('Test_locationlist_curwin_was_closed') expected_empty() @@ -457,3 +479,137 @@ describe('helpgrep', function() expected_empty() end) end) + +describe('errorformat', function() + before_each(function() + clear() + + source([[ + " More tests for 'errorformat' + function! Test_efm1() + if !has('unix') + " The 'errorformat' setting is different on non-Unix systems. + " This test works only on Unix-like systems. + return + endif + + let l = [ + \ '"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.', + \ '"Xtestfile", line 6 col 19; this is an error', + \ 'gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c', + \ 'Xtestfile:9: parse error before `asd''', + \ 'make: *** [vim] Error 1', + \ 'in file "Xtestfile" linenr 10: there is an error', + \ '', + \ '2 returned', + \ '"Xtestfile", line 11 col 1; this is an error', + \ '"Xtestfile", line 12 col 2; this is another error', + \ '"Xtestfile", line 14:10; this is an error in column 10', + \ '=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time', + \ '"Xtestfile", linenr 16: yet another problem', + \ 'Error in "Xtestfile" at line 17:', + \ 'x should be a dot', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17', + \ ' ^', + \ 'Error in "Xtestfile" at line 18:', + \ 'x should be a dot', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18', + \ '.............^', + \ 'Error in "Xtestfile" at line 19:', + \ 'x should be a dot', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19', + \ '--------------^', + \ 'Error in "Xtestfile" at line 20:', + \ 'x should be a dot', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20', + \ ' ^', + \ '', + \ 'Does anyone know what is the problem and how to correction it?', + \ '"Xtestfile", line 21 col 9: What is the title of the quickfix window?', + \ '"Xtestfile", line 22 col 9: What is the title of the quickfix window?' + \ ] + + call writefile(l, 'Xerrorfile1') + call writefile(l[:-2], 'Xerrorfile2') + + let m = [ + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21', + \ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22' + \ ] + call writefile(m, 'Xtestfile') + + let save_efm = &efm + set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m + set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m + + exe 'cf Xerrorfile2' + clast + copen + call assert_equal(':cf Xerrorfile2', w:quickfix_title) + wincmd p + + exe 'cf Xerrorfile1' + call assert_equal([4, 12], [line('.'), col('.')]) + cn + call assert_equal([6, 19], [line('.'), col('.')]) + cn + call assert_equal([9, 2], [line('.'), col('.')]) + cn + call assert_equal([10, 2], [line('.'), col('.')]) + cn + call assert_equal([11, 1], [line('.'), col('.')]) + cn + call assert_equal([12, 2], [line('.'), col('.')]) + cn + call assert_equal([14, 10], [line('.'), col('.')]) + cn + call assert_equal([15, 3, 10], [line('.'), col('.'), virtcol('.')]) + cn + call assert_equal([16, 2], [line('.'), col('.')]) + cn + call assert_equal([17, 6], [line('.'), col('.')]) + cn + call assert_equal([18, 7], [line('.'), col('.')]) + cn + call assert_equal([19, 8], [line('.'), col('.')]) + cn + call assert_equal([20, 9], [line('.'), col('.')]) + clast + cprev + cprev + wincmd w + call assert_equal(':cf Xerrorfile1', w:quickfix_title) + wincmd p + + let &efm = save_efm + call delete('Xerrorfile1') + call delete('Xerrorfile2') + call delete('Xtestfile') + endfunction + ]]) + end) + + it('works', function() + call('Test_efm1') + expected_empty() + end) +end) diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua index 5b5e5f9ace..52dc008707 100644 --- a/test/functional/plugin/health_spec.lua +++ b/test/functional/plugin/health_spec.lua @@ -68,6 +68,7 @@ describe('health.vim', function() health#broken#check ======================================================================== - ERROR: Failed to run healthcheck for "broken" plugin. Exception: + function health#check[20]..health#broken#check, line 1 caused an error ]]) end) |