From 4dbc2627641a6b950c30c31cbf7b7e6c36da1927 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 2 Nov 2018 11:59:15 +0100 Subject: [PATCH 1/6] patch 8.1.0504: when CTRL-C is mapped it triggers InsertLeave Problem: When CTRL-C is mapped it triggers InsertLeave. Solution: Make CTRL-C behave the same way when typed or used in a mapping. --- src/edit.c | 7 +++++-- src/testdir/test_edit.vim | 30 ++++++++++++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/edit.c b/src/edit.c index 4b9bdffb47..239881ee5c 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); @@ -2408,7 +2411,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 651f1f8fa4..63f58ae750 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/version.c b/src/version.c index bc22e73da1..2c06a0f391 100644 --- a/src/version.c +++ b/src/version.c @@ -792,6 +792,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 504, /**/ 503, /**/ From bd9a0c611ce08f8dce033537bc2f110987b99802 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 3 Nov 2018 19:00:14 +0100 Subject: [PATCH 2/6] patch 8.1.0505: filter command test may fail if helplang is not set Problem: Filter command test may fail if helplang is not set. Solution: Set 'helplang' for the test. (James McCoy, closes #3591) --- src/testdir/test_filter_cmd.vim | 3 +++ src/version.c | 2 ++ 2 files changed, 5 insertions(+) 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/version.c b/src/version.c index 2c06a0f391..5da60271ce 100644 --- a/src/version.c +++ b/src/version.c @@ -792,6 +792,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 505, /**/ 504, /**/ From 9691f82f862ed18c2e3e48f9d2cd902bb947f803 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 3 Nov 2018 19:06:25 +0100 Subject: [PATCH 3/6] patch 8.1.0506: modeline test fails when run by root Problem: Modeline test fails when run by root. Solution: Set 'modeline' for the test. (James McCoy, closes #3592) --- src/testdir/test_modeline.vim | 5 ++++- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) 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/version.c b/src/version.c index 5da60271ce..54b9a6c7b6 100644 --- a/src/version.c +++ b/src/version.c @@ -792,6 +792,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 506, /**/ 505, /**/ From da1c11c6411182e9a4bd4374e3fb8851fef77113 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 3 Nov 2018 19:52:15 +0100 Subject: [PATCH 4/6] patch 8.1.0507: .raml files not properly detected Problem: .raml files not properly detected. Solution: Recognize .raml as raml instead of yaml. (closes #3594) --- runtime/filetype.vim | 11 +++++++---- src/testdir/test_filetype.vim | 1 + src/version.c | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) 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/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/version.c b/src/version.c index 54b9a6c7b6..28f39d4b93 100644 --- a/src/version.c +++ b/src/version.c @@ -792,6 +792,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 507, /**/ 506, /**/ From 0f62cf5b335968f7448af1a6f46e0104b7bc365e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 3 Nov 2018 21:09:15 +0100 Subject: [PATCH 5/6] patch 8.1.0508: suspend test fails when run by root Problem: Suspend test fails when run by root. Solution: Accept both '$' and '#' for the prompt. (James McCoy, closes #3590) --- src/testdir/test_suspend.vim | 6 +++--- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) 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/version.c b/src/version.c index 28f39d4b93..1e66b3ed78 100644 --- a/src/version.c +++ b/src/version.c @@ -792,6 +792,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 508, /**/ 507, /**/ From 0b38f54730c3f9835ddade01c2263ce0f56c1c0f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 3 Nov 2018 21:47:16 +0100 Subject: [PATCH 6/6] patch 8.1.0509: checking cwd not accessible fails for root Problem: Checking cwd not accessible fails for root. (James McCoy) Solution: Skip this part of the test for root. (closes #3595) --- src/testdir/test_terminal.vim | 17 ++++++++++------- src/version.c | 2 ++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 235cd3160c..88cb89e9ba 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 1e66b3ed78..fb8a16dc2d 100644 --- a/src/version.c +++ b/src/version.c @@ -792,6 +792,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 509, /**/ 508, /**/