diff --git a/runtime/filetype.vim b/runtime/filetype.vim index af27c85d88..72a756d84b 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1129,7 +1129,7 @@ au BufNewFile,BufRead *.dpr setf pascal " PDF au BufNewFile,BufRead *.pdf setf pdf -" PCMK - HAE - crm configure edit +" PCMK - HAE - crm configure edit au BufNewFile,BufRead *.pcmk setf pcmk " Perl @@ -1893,8 +1893,11 @@ au BufNewFile,BufRead *.yy,*.yxx,*.y++ setf yacc " Yacc or racc au BufNewFile,BufRead *.y call dist#ft#FTy() -" Yaml or Raml -au BufNewFile,BufRead *.yaml,*.yml,*.raml setf yaml +" Yaml +au BufNewFile,BufRead *.yaml,*.yml setf yaml + +" Raml +au BufNewFile,BufRead *.raml setf raml " yum conf (close enough to dosini) au BufNewFile,BufRead */etc/yum.conf setf dosini @@ -2107,7 +2110,7 @@ au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') au BufNewFile,BufRead *.text,README setf text " Help files match *.txt but should have a last line that is a modeline. -au BufNewFile,BufRead *.txt +au BufNewFile,BufRead *.txt \ if getline('$') !~ 'vim:.*ft=help' \| setf text \| endif diff --git a/src/edit.c b/src/edit.c index 21aca80925..1438e9c8ea 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1048,7 +1048,10 @@ doESCkey: if (ins_esc(&count, cmdchar, nomove)) { - if (cmdchar != 'r' && cmdchar != 'v') + // When CTRL-C was typed got_int will be set, with the result + // that the autocommands won't be executed. When mapped got_int + // is not set, but let's keep the behavior the same. + if (cmdchar != 'r' && cmdchar != 'v' && c != Ctrl_C) ins_apply_autocmds(EVENT_INSERTLEAVE); did_cursorhold = FALSE; return (c == Ctrl_O); @@ -2418,7 +2421,7 @@ has_compl_option(int dict_opt) int vim_is_ctrl_x_key(int c) { - /* Always allow ^R - let it's results then be checked */ + // Always allow ^R - let its results then be checked if (c == Ctrl_R) return TRUE; diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index fdc2237ecd..79125b53e9 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -1409,3 +1409,33 @@ func Test_edit_alt() bwipe XAltFile call delete('XAltFile') endfunc + +func Test_leave_insert_autocmd() + new + au InsertLeave * let g:did_au = 1 + let g:did_au = 0 + call feedkeys("afoo\", 'tx') + call assert_equal(1, g:did_au) + call assert_equal('foo', getline(1)) + + let g:did_au = 0 + call feedkeys("Sbar\", 'tx') + call assert_equal(0, g:did_au) + call assert_equal('bar', getline(1)) + + inoremap x xx + let g:did_au = 0 + call feedkeys("Saax", 'tx') + call assert_equal(1, g:did_au) + call assert_equal('aaxx', getline(1)) + + inoremap x xx + let g:did_au = 0 + call feedkeys("Sbbx", 'tx') + call assert_equal(0, g:did_au) + call assert_equal('bbxx', getline(1)) + + bwipe! + au! InsertLeave + iunmap x +endfunc diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 9c537646f5..d146bd2ce1 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -495,6 +495,7 @@ let s:filename_checks = { \ 'xslt': ['file.xsl', 'file.xslt'], \ 'yacc': ['file.yy', 'file.yxx', 'file.y++'], \ 'yaml': ['file.yaml', 'file.yml'], + \ 'raml': ['file.raml'], \ 'z8a': ['file.z8a'], \ 'zimbu': ['file.zu'], \ 'zimbutempl': ['file.zut'], diff --git a/src/testdir/test_filter_cmd.vim b/src/testdir/test_filter_cmd.vim index 3d802f9530..6f40a902e1 100644 --- a/src/testdir/test_filter_cmd.vim +++ b/src/testdir/test_filter_cmd.vim @@ -105,8 +105,11 @@ func Test_filter_commands() unlet test_filter_c " Test filtering :set command + let helplang=&helplang + set helplang=en let res = join(split(execute("filter /^help/ set"), "\n")[1:], " ") call assert_match('^\s*helplang=\w*$', res) + let &helplang=helplang " Test filtering :llist command call setloclist(0, [{"filename": "/path/vim.c"}, {"filename": "/path/vim.h"}, {"module": "Main.Test"}]) diff --git a/src/testdir/test_modeline.vim b/src/testdir/test_modeline.vim index f02c68c7b7..3bde58db40 100644 --- a/src/testdir/test_modeline.vim +++ b/src/testdir/test_modeline.vim @@ -1,9 +1,12 @@ " Tests for parsing the modeline. func Test_modeline_invalid() - " This was reading before allocated memory. + " This was reading allocated memory in the past. call writefile(['vi:0', 'nothing'], 'Xmodeline') + let modeline = &modeline + set modeline call assert_fails('split Xmodeline', 'E518:') + let &modeline = modeline bwipe! call delete('Xmodeline') endfunc diff --git a/src/testdir/test_suspend.vim b/src/testdir/test_suspend.vim index 462173e8cc..a9964b0400 100644 --- a/src/testdir/test_suspend.vim +++ b/src/testdir/test_suspend.vim @@ -9,7 +9,7 @@ func Test_suspend() let buf = term_start('/bin/sh') " Wait for shell prompt. - call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))}) + call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) call term_sendkeys(buf, v:progpath \ . " --clean -X" @@ -26,7 +26,7 @@ func Test_suspend() \ "\"] " Suspend and wait for shell prompt. call term_sendkeys(buf, suspend_cmd) - call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))}) + call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) " Without 'autowrite', buffer should not be written. call assert_equal(0, filereadable('Xfoo')) @@ -40,7 +40,7 @@ func Test_suspend() call assert_equal(0, filereadable('Xfoo')) call term_sendkeys(buf, ":suspend\") " Wait for shell prompt. - call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))}) + call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) call assert_equal(['foo'], readfile('Xfoo')) call term_sendkeys(buf, "fg\") call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))}) diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 78fda5d74d..ec87b64637 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -490,14 +490,17 @@ func Test_terminal_cwd_failure() call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:') " Case 3: Directory exists but is not accessible. - call mkdir('Xdir', '', '0600') - " return early if the directory permissions could not be set properly - if getfperm('Xdir')[2] == 'x' - call delete('Xdir', 'rf') - return + " Skip this for root, it will be accessible anyway. + if $USER != 'root' + call mkdir('XdirNoAccess', '', '0600') + " return early if the directory permissions could not be set properly + if getfperm('XdirNoAccess')[2] == 'x' + call delete('XdirNoAccess', 'rf') + return + endif + call assert_fails("call term_start(&shell, {'cwd': 'XdirNoAccess'})", 'E475:') + call delete('XdirNoAccess', 'rf') endif - call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:') - call delete('Xdir', 'rf') endfunc func Test_terminal_servername() diff --git a/src/version.c b/src/version.c index 3a126261e5..9c0faad32c 100644 --- a/src/version.c +++ b/src/version.c @@ -807,6 +807,18 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 509, +/**/ + 508, +/**/ + 507, +/**/ + 506, +/**/ + 505, +/**/ + 504, /**/ 503, /**/