From 6b89dbb55f84c485310c8c9e094dbafe3ecbace6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 22 Oct 2017 14:22:16 +0200 Subject: [PATCH 1/9] patch 8.0.1208: 'statusline' drops empty group with highlight change Problem: 'statusline' drops empty group with highlight change. Solution: Do not drop an empty group if it changes highlighting. (Marius Gedminas, closes #2228) --- src/buffer.c | 17 +++++++-- src/testdir/test_statusline.vim | 65 ++++++++++++++++++++++++++++++++- src/version.c | 2 + 3 files changed, 80 insertions(+), 4 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 22effbb81f..1bf692a830 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -3883,6 +3883,8 @@ build_stl_str_hl( int width; int itemcnt; int curitem; + int group_end_userhl; + int group_start_userhl; int groupitem[STL_MAX_ITEM]; int groupdepth; struct stl_item @@ -4023,11 +4025,20 @@ build_stl_str_hl( if (curitem > groupitem[groupdepth] + 1 && item[groupitem[groupdepth]].minwid == 0) { - /* remove group if all items are empty */ + /* remove group if all items are empty and highlight group + * doesn't change */ + group_start_userhl = group_end_userhl = 0; + for (n = 0; n < groupitem[groupdepth]; n++) + if (item[n].type == Highlight) + group_start_userhl = item[n].minwid; for (n = groupitem[groupdepth] + 1; n < curitem; n++) - if (item[n].type == Normal || item[n].type == Highlight) + { + if (item[n].type == Normal) break; - if (n == curitem) + if (item[n].type == Highlight) + group_end_userhl = item[n].minwid; + } + if (n == curitem && group_start_userhl == group_end_userhl) { p = t; l = 0; diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim index 351b119acd..de943f2466 100644 --- a/src/testdir/test_statusline.vim +++ b/src/testdir/test_statusline.vim @@ -5,7 +5,6 @@ " %N " %T " %X -" %* source view_util.vim @@ -249,6 +248,70 @@ func Test_statusline() call assert_equal(sa1, sa3) call assert_notequal(sa1, sa2) + " An empty group that contains highlight changes + let g:a = '' + set statusline=ab%(cd%1*%{g:a}%*%)de + call assert_match('^abde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 4) + call assert_equal(sa1, sa2) + let g:a = 'X' + call assert_match('^abcdXde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 5) + let sa3=screenattr(&lines - 1, 7) + call assert_equal(sa1, sa3) + call assert_notequal(sa1, sa2) + + let g:a = '' + set statusline=ab%1*%(cd%*%{g:a}%1*%)de + call assert_match('^abde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 4) + call assert_notequal(sa1, sa2) + let g:a = 'X' + call assert_match('^abcdXde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 3) + let sa3=screenattr(&lines - 1, 5) + let sa4=screenattr(&lines - 1, 7) + call assert_notequal(sa1, sa2) + call assert_equal(sa1, sa3) + call assert_equal(sa2, sa4) + + " An empty group that contains highlight changes and doesn't reset them + let g:a = '' + set statusline=ab%(cd%1*%{g:a}%)de + call assert_match('^abcdde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 5) + call assert_notequal(sa1, sa2) + let g:a = 'X' + call assert_match('^abcdXde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 5) + let sa3=screenattr(&lines - 1, 7) + call assert_notequal(sa1, sa2) + call assert_equal(sa2, sa3) + + let g:a = '' + set statusline=ab%1*%(cd%*%{g:a}%)de + call assert_match('^abcdde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 3) + let sa3=screenattr(&lines - 1, 5) + call assert_notequal(sa1, sa2) + call assert_equal(sa1, sa3) + let g:a = 'X' + call assert_match('^abcdXde\s*$', s:get_statusline()) + let sa1=screenattr(&lines - 1, 1) + let sa2=screenattr(&lines - 1, 3) + let sa3=screenattr(&lines - 1, 5) + let sa4=screenattr(&lines - 1, 7) + call assert_notequal(sa1, sa2) + call assert_equal(sa1, sa3) + call assert_equal(sa1, sa4) + " %%: a percent sign. set statusline=10%% call assert_match('^10%\s*$', s:get_statusline()) diff --git a/src/version.c b/src/version.c index 040d32466b..d9a3fdb0a0 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1208, /**/ 1207, /**/ From 53f0c962394dc6bc66d5b0762af9434e672d1b25 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 22 Oct 2017 14:23:59 +0200 Subject: [PATCH 2/9] patch 8.0.1209: still too many old style tests Problem: Still too many old style tests. Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, closes #2230) --- src/Makefile | 17 +++-- src/testdir/Make_all.mak | 9 +-- src/testdir/Make_amiga.mak | 2 +- src/testdir/Make_dos.mak | 2 +- src/testdir/Make_ming.mak | 3 - src/testdir/Make_vms.mms | 6 +- src/testdir/Makefile | 1 - src/testdir/main.aap | 4 +- src/testdir/test34.in | 87 -------------------------- src/testdir/test34.ok | 10 --- src/testdir/test54.in | 22 ------- src/testdir/test54.ok | 1 - src/testdir/test8.in | 46 -------------- src/testdir/test8.ok | 7 --- src/testdir/test_autocmd.vim | 87 +++++++++++++++++++++++++- src/testdir/test_autoformat_join.in | 23 ------- src/testdir/test_autoformat_join.ok | 8 --- src/testdir/test_join.vim | 22 +++++++ src/testdir/test_user_func.vim | 96 +++++++++++++++++++++++++++++ src/version.c | 2 + 20 files changed, 221 insertions(+), 234 deletions(-) delete mode 100644 src/testdir/test34.in delete mode 100644 src/testdir/test34.ok delete mode 100644 src/testdir/test54.in delete mode 100644 src/testdir/test54.ok delete mode 100644 src/testdir/test8.in delete mode 100644 src/testdir/test8.ok delete mode 100644 src/testdir/test_autoformat_join.in delete mode 100644 src/testdir/test_autoformat_join.ok create mode 100644 src/testdir/test_user_func.vim diff --git a/src/Makefile b/src/Makefile index 7752fa17ed..a6128178a1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2088,9 +2088,9 @@ run_memfile_test: $(MEMFILE_TEST_TARGET) run_message_test: $(MESSAGE_TEST_TARGET) $(VALGRIND) ./$(MESSAGE_TEST_TARGET) || exit 1; echo $* passed; -# Run individual OLD style test, assuming that Vim was already compiled. +# Run individual OLD style test. +# These do not depend on the executable, compile it when needed. test1 \ - test_autoformat_join \ test_changelist \ test_close_count \ test_erasebackword \ @@ -2100,20 +2100,19 @@ test1 \ test_listchars \ test_search_mbyte \ test_wordcount \ - test3 test8 \ - test11 test12 test14 test15 test17 test19 \ + test3 test11 test12 test14 test15 test17 test19 \ test20 test25 test28 test29 \ - test30 test32 test34 test36 test37 test38 test39 \ + test30 test32 test36 test37 test38 test39 \ test40 test42 test44 test45 test48 test49 \ - test50 test52 test54 test55 test59 \ + test50 test52 test55 test59 \ test64 test66 test68 test69 \ test70 test72 test73 test77 test79 \ test83 test85 test86 test87 test88 \ - test94 test95 test99 \ - test108: + test94 test95 test99 test108: cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) -# Run individual NEW style test, assuming that Vim was already compiled. +# Run individual NEW style test. +# These do not depend on the executable, compile it when needed. test_arglist \ test_arabic \ test_assert \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index eb13761d22..d0afdb5614 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -14,14 +14,12 @@ SCRIPTS_FIRST = \ # Tests that run on all systems. SCRIPTS_ALL = \ test3.out \ - test8.out \ test14.out \ test15.out \ test19.out \ test20.out \ test28.out \ test29.out \ - test34.out \ test36.out \ test37.out \ test38.out \ @@ -44,7 +42,6 @@ SCRIPTS_ALL = \ test95.out \ test99.out \ test108.out \ - test_autoformat_join.out \ test_changelist.out \ test_close_count.out \ test_erasebackword.out \ @@ -72,11 +69,6 @@ SCRIPTS_MORE2 = \ test49.out -# Tests that run on most systems, but not MingW and Cygwin. -SCRIPTS_MORE3 = \ - test54.out - - # Tests that run on most systems, but not on VMS SCRIPTS_MORE4 = \ test17.out \ @@ -187,6 +179,7 @@ NEW_TESTS = test_arabic.res \ test_textobjects.res \ test_undo.res \ test_usercommands.res \ + test_user_func.res \ test_viminfo.res \ test_vimscript.res \ test_visual.res \ diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 2b5d543ab1..7a8eca2e28 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -19,7 +19,7 @@ include Make_all.mak # test85 no Lua interface # test86, 87 no Python interface -SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4) +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE4) # Must run test1 first to create small.vim. $(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(SCRIPTS_FIRST) diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 05978ade2f..4e0c8f7dbc 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -17,7 +17,7 @@ default: nongui # test49 fails in various ways # test97 \{ and \$ are not escaped characters. -SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4) +SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI) DOSTMP = dostmp diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index ecfa97e4c7..ea748cd939 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -4,8 +4,6 @@ # # Author: Bill McCarthy # -# Note that test54 has been removed until it is fixed. -# # Requires a set of Unix tools: echo, diff, etc. ifneq (sh.exe, $(SHELL)) @@ -35,7 +33,6 @@ include Make_all.mak # test10 'errorformat' is different # test12 can't unlink a swap file # test25 uses symbolic link -# test54 doesn't work yet # test97 \{ and \$ are not escaped characters SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32) diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index efed68f9ca..30b671c354 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -74,14 +74,13 @@ VIMPROG = <->vim.exe .SUFFIXES : .out .in SCRIPT = test1.out test3.out \ - test8.out \ test14.out test15.out \ test19.out test20.out \ test28.out test29.out test30.out test32.out \ - test34.out test36.out test37.out \ + test36.out test37.out \ test38.out test39.out test40.out test42.out \ test44.out test45.out \ - test48.out test49.out test54.out \ + test48.out test49.out \ test55.out \ test64.out \ test66.out test68.out test69.out \ @@ -92,7 +91,6 @@ SCRIPT = test1.out test3.out \ test95.out test99.out \ test108.out\ test_autocmd_option.out \ - test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ test_close_count.out \ diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 3a69c6c1ac..90e0cdb2d6 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -24,7 +24,6 @@ include Make_all.mak SCRIPTS = $(SCRIPTS_ALL) \ $(SCRIPTS_MORE1) \ $(SCRIPTS_MORE2) \ - $(SCRIPTS_MORE3) \ $(SCRIPTS_MORE4) SCRIPTS_BENCH = bench_re_freeze.out diff --git a/src/testdir/main.aap b/src/testdir/main.aap index 54f7eb2565..51e60de82c 100644 --- a/src/testdir/main.aap +++ b/src/testdir/main.aap @@ -5,12 +5,12 @@ VimProg ?= ../vim Scripts = test1.out test2.out test3.out test6.out - test8.out test11.out + test11.out test12.out test13.out test14.out test15.out test17.out test18.out test19.out test20.out test21.out test25.out test27.out test28.out test29.out test30.out test32.out - test34.out test36.out test37.out + test36.out test37.out test38.out test39.out test40.out test42.out test44.out test45.out test46.out test47.out test48.out test49.out test74.out diff --git a/src/testdir/test34.in b/src/testdir/test34.in deleted file mode 100644 index 71ee5f63b2..0000000000 --- a/src/testdir/test34.in +++ /dev/null @@ -1,87 +0,0 @@ -Test for user functions. -Also test an mapping calling a function. -Also test that a builtin function cannot be replaced. -Also test for regression when calling arbitrary expression. - -STARTTEST -:so small.vim -:function Table(title, ...) -: let ret = a:title -: let idx = 1 -: while idx <= a:0 -: exe "let ret = ret . a:" . idx -: let idx = idx + 1 -: endwhile -: return ret -:endfunction -:function Compute(n1, n2, divname) -: if a:n2 == 0 -: return "fail" -: endif -: exe "let g:" . a:divname . " = ". a:n1 / a:n2 -: return "ok" -:endfunction -:func Expr1() -: normal! v -: return "111" -:endfunc -:func Expr2() -: call search('XX', 'b') -: return "222" -:endfunc -:func ListItem() -: let g:counter += 1 -: return g:counter . '. ' -:endfunc -:func ListReset() -: let g:counter = 0 -: return '' -:endfunc -:func FuncWithRef(a) -: unlet g:FuncRef -: return a:a -:endfunc -:let g:FuncRef=function("FuncWithRef") -:let counter = 0 -:inoremap ( ListItem() -:inoremap [ ListReset() -:imap + Expr1() -:imap * Expr2() -:let retval = "nop" -/^here -C=Table("xxx", 4, "asdf") - =Compute(45, 0, "retval") - =retval - =Compute(45, 5, "retval") - =retval - =g:FuncRef(333) - -XX+-XX ----*--- -(one -(two -[(one again:call append(line('$'), max([1, 2, 3])) -:call extend(g:, {'max': function('min')}) -:call append(line('$'), max([1, 2, 3])) -:try -: " Regression: the first line below used to throw ?E110: Missing ')'? -: " Second is here just to prove that this line is correct when not skipping -: " rhs of &&. -: $put =(0&&(function('tr'))(1, 2, 3)) -: $put =(1&&(function('tr'))(1, 2, 3)) -:catch -: $put ='!!! Unexpected exception:' -: $put =v:exception -:endtry -:$-9,$w! test.out -:delfunc Table -:delfunc Compute -:delfunc Expr1 -:delfunc Expr2 -:delfunc ListItem -:delfunc ListReset -:unlet retval counter -:q! -ENDTEST - -here diff --git a/src/testdir/test34.ok b/src/testdir/test34.ok deleted file mode 100644 index 97995de80e..0000000000 --- a/src/testdir/test34.ok +++ /dev/null @@ -1,10 +0,0 @@ -xxx4asdf fail nop ok 9 333 -XX111-XX ----222--- -1. one -2. two -1. one again -3 -3 -0 -1 diff --git a/src/testdir/test54.in b/src/testdir/test54.in deleted file mode 100644 index 9fc6537e08..0000000000 --- a/src/testdir/test54.in +++ /dev/null @@ -1,22 +0,0 @@ -Some tests for buffer-local autocommands - -STARTTEST -:so small.vim -:e xx -:if has("vms") -: !del test.out.* -: au BufLeave :!write sys$output "buffer-local autommand in %" > test.out -:else -: !rm -f test.out -: au BufLeave :!echo buffer-local autommand in %>> test.out -:endif -:e somefile " here, autocommand for xx shall write test.out -: " but autocommand shall not apply to buffer named -:bwipe xx " here, autocommand shall be auto-deleted -:e xx " nothing shall be written -:e somefile " nothing shall be written -:qa! -ENDTEST - -start of test file xx -end of test file xx diff --git a/src/testdir/test54.ok b/src/testdir/test54.ok deleted file mode 100644 index 0fd1dc915b..0000000000 --- a/src/testdir/test54.ok +++ /dev/null @@ -1 +0,0 @@ -buffer-local autommand in xx diff --git a/src/testdir/test8.in b/src/testdir/test8.in deleted file mode 100644 index d9d00d97ae..0000000000 --- a/src/testdir/test8.in +++ /dev/null @@ -1,46 +0,0 @@ -Test for BufWritePre autocommand that deletes or unloads the buffer. -Test for BufUnload autocommand that unloads all other buffers. - -STARTTEST -:so small.vim -:au BufWritePre Xxx1 bunload -:au BufWritePre Xxx2 bwipe -/^start of -A1:.,/end of/w! Xxx1 " write test file Xxx1 -$r2:.,/end of/w! Xxx2 " write test file Xxx2 -:e! Xxx2 " edit Xxx2 -:bdel test8.in " delete this file from the buffer list -:e Xxx1 " edit Xxx1 -:w " write it, will unload it and give an error msg -:w! test.out " Write contents of this file -:e! Xxx2 " start editing Xxx2 -:bwipe test.out " remove test.out from the buffer list -:w " write it, will delete the buffer and give an error msg -:w >>test.out " Append contents of this file -:au! BufWritePre -:func CloseAll() - let i = 0 - while i <= bufnr('$') - if i != bufnr('%') && bufloaded(i) - exe i . "bunload" - endif - let i += 1 - endwhile -endfunc -:func WriteToOut() - edit! test.out - $put ='VimLeave done' - write -endfunc -:set viminfo='100,nviminfo -:au BufUnload * call CloseAll() -:au VimLeave * call WriteToOut() -:e small.vim -:sp mbyte.vim -:q -:qa! -ENDTEST - -start of Xxx - test -end of Xxx diff --git a/src/testdir/test8.ok b/src/testdir/test8.ok deleted file mode 100644 index adecb2f4be..0000000000 --- a/src/testdir/test8.ok +++ /dev/null @@ -1,7 +0,0 @@ -start of Xxx2 - test -end of Xxx -start of Xxx1 - test -end of Xxx -VimLeave done diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 6af0820eb1..6ca3b220e6 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -773,6 +773,7 @@ func Test_BufLeave_Wipe() call delete('Xxx1') call delete('Xxx2') + call delete('test.out') %bwipe au! BufLeave @@ -809,9 +810,93 @@ func Test_Cmdline() au! CmdlineLeave / let g:left = expand('') let g:entered = 0 let g:left = 0 - call feedkeys("/hello", 'xt') + new + call setline(1, 'hello') + call feedkeys("/hello\", 'xt') call assert_equal('/', g:entered) call assert_equal('/', g:left) + bwipe! au! CmdlineEnter au! CmdlineLeave endfunc + +" Test for BufWritePre autocommand that deletes or unloads the buffer. +func Test_BufWritePre() + %bwipe + au BufWritePre Xxx1 bunload + au BufWritePre Xxx2 bwipe + + call writefile(['start of Xxx1', 'test', 'end of Xxx1'], 'Xxx1') + call writefile(['start of Xxx2', 'test', 'end of Xxx2'], 'Xxx2') + + edit Xtest + e! Xxx2 + bdel Xtest + e Xxx1 + " write it, will unload it and give an error msg + call assert_fails('w', 'E203') + call assert_equal('Xxx2', bufname('%')) + edit Xtest + e! Xxx2 + bwipe Xtest + " write it, will delete the buffer and give an error msg + call assert_fails('w', 'E203') + call assert_equal('Xxx1', bufname('%')) + au! BufWritePre + call delete('Xxx1') + call delete('Xxx2') +endfunc + +" Test for BufUnload autocommand that unloads all the other buffers +func Test_bufunload_all() + call writefile(['Test file Xxx1'], 'Xxx1')" + call writefile(['Test file Xxx2'], 'Xxx2')" + + let content = [ + \ "func UnloadAllBufs()", + \ " let i = 1", + \ " while i <= bufnr('$')", + \ " if i != bufnr('%') && bufloaded(i)", + \ " exe i . 'bunload'", + \ " endif", + \ " let i += 1", + \ " endwhile", + \ "endfunc", + \ "au BufUnload * call UnloadAllBufs()", + \ "au VimLeave * call writefile(['Test Finished'], 'Xout')", + \ "edit Xxx1", + \ "split Xxx2", + \ "q"] + call writefile(content, 'Xtest') + + call delete('Xout') + call system(v:progpath. ' --clean -N --not-a-term -S Xtest') + call assert_true(filereadable('Xout')) + + call delete('Xxx1') + call delete('Xxx2') + call delete('Xtest') + call delete('Xout') +endfunc + +" Some tests for buffer-local autocommands +func Test_buflocal_autocmd() + let g:bname = '' + edit xx + au BufLeave let g:bname = expand("%") + " here, autocommand for xx should trigger. + " but autocommand shall not apply to buffer named . + edit somefile + call assert_equal('xx', g:bname) + let g:bname = '' + " here, autocommand shall be auto-deleted + bwipe xx + " autocmd should not trigger + edit xx + call assert_equal('', g:bname) + " autocmd should not trigger + edit somefile + call assert_equal('', g:bname) + enew + unlet g:bname +endfunc diff --git a/src/testdir/test_autoformat_join.in b/src/testdir/test_autoformat_join.in deleted file mode 100644 index 16fed6d7ed..0000000000 --- a/src/testdir/test_autoformat_join.in +++ /dev/null @@ -1,23 +0,0 @@ -Tests for setting the '[,'] marks when joining lines. - -STARTTEST -:so small.vim -:/^\t\t/ -0gqj: -:let a=string(getpos("'[")).'/'.string(getpos("']")) -:/^This line/;'}-join -:let b=string(getpos("'[")).'/'.string(getpos("']")) -:$put ='First test: Start/End '.string(a) -:$put ='Second test: Start/End '.string(b) -:/^\t\t/,$wq! test.out -ENDTEST - - - O sodales, ludite, vos qui -attamen consulite per voster honur. Tua pulchra facies me fay planszer milies - -This line. -Should be joined with the next line -and with this line - -Results: diff --git a/src/testdir/test_autoformat_join.ok b/src/testdir/test_autoformat_join.ok deleted file mode 100644 index 3b1df79514..0000000000 --- a/src/testdir/test_autoformat_join.ok +++ /dev/null @@ -1,8 +0,0 @@ - O sodales, ludite, vos qui attamen consulite per voster honur. -Tua pulchra facies me fay planszer milies - -This line. Should be joined with the next line and with this line - -Results: -First test: Start/End '[0, 16, 1, 0]/[0, 17, 1, 0]' -Second test: Start/End '[0, 19, 11, 0]/[0, 19, 67, 0]' diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim index 8a028f1e55..1c97414164 100644 --- a/src/testdir/test_join.vim +++ b/src/testdir/test_join.vim @@ -11,3 +11,25 @@ func Test_join_with_count() call assert_equal('one two three four', getline(1)) quit! endfunc + +" Tests for setting the '[,'] marks when joining lines. +func Test_join_marks() + enew + call append(0, [ + \ "\t\tO sodales, ludite, vos qui", + \ "attamen consulite per voster honur. Tua pulchra " . + \ "facies me fay planszer milies", + \ "", + \ "This line.", + \ "Should be joined with the next line", + \ "and with this line"]) + + normal gg0gqj + call assert_equal([0, 1, 1, 0], getpos("'[")) + call assert_equal([0, 2, 1, 0], getpos("']")) + + /^This line/;'}-join + call assert_equal([0, 4, 11, 0], getpos("'[")) + call assert_equal([0, 4, 67, 0], getpos("']")) + enew! +endfunc diff --git a/src/testdir/test_user_func.vim b/src/testdir/test_user_func.vim new file mode 100644 index 0000000000..e7a3701386 --- /dev/null +++ b/src/testdir/test_user_func.vim @@ -0,0 +1,96 @@ +" Test for user functions. +" Also test an mapping calling a function. +" Also test that a builtin function cannot be replaced. +" Also test for regression when calling arbitrary expression. + +func Table(title, ...) + let ret = a:title + let idx = 1 + while idx <= a:0 + exe "let ret = ret . a:" . idx + let idx = idx + 1 + endwhile + return ret +endfunc + +func Compute(n1, n2, divname) + if a:n2 == 0 + return "fail" + endif + exe "let g:" . a:divname . " = ". a:n1 / a:n2 + return "ok" +endfunc + +func Expr1() + silent! normal! v + return "111" +endfunc + +func Expr2() + call search('XX', 'b') + return "222" +endfunc + +func ListItem() + let g:counter += 1 + return g:counter . '. ' +endfunc + +func ListReset() + let g:counter = 0 + return '' +endfunc + +func FuncWithRef(a) + unlet g:FuncRef + return a:a +endfunc + +func Test_user_func() + let g:FuncRef=function("FuncWithRef") + let g:counter = 0 + inoremap ( ListItem() + inoremap [ ListReset() + imap + Expr1() + imap * Expr2() + let g:retval = "nop" + + call assert_equal('xxx4asdf', Table("xxx", 4, "asdf")) + call assert_equal('fail', Compute(45, 0, "retval")) + call assert_equal('nop', g:retval) + call assert_equal('ok', Compute(45, 5, "retval")) + call assert_equal(9, g:retval) + call assert_equal(333, g:FuncRef(333)) + + enew + + normal oXX+-XX + call assert_equal('XX111-XX', getline('.')) + normal o---*--- + call assert_equal('---222---', getline('.')) + normal o(one + call assert_equal('1. one', getline('.')) + normal o(two + call assert_equal('2. two', getline('.')) + normal o[(one again + call assert_equal('1. one again', getline('.')) + + call assert_equal(3, max([1, 2, 3])) + call assert_fails("call extend(g:, {'max': function('min')})", 'E704') + call assert_equal(3, max([1, 2, 3])) + + " Regression: the first line below used to throw ?E110: Missing ')'? + " Second is here just to prove that this line is correct when not skipping + " rhs of &&. + call assert_equal(0, (0 && (function('tr'))(1, 2, 3))) + call assert_equal(1, (1 && (function('tr'))(1, 2, 3))) + + delfunc Table + delfunc Compute + delfunc Expr1 + delfunc Expr2 + delfunc ListItem + delfunc ListReset + unlet g:retval g:counter + enew! +endfunc diff --git a/src/version.c b/src/version.c index d9a3fdb0a0..b0eefff021 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1209, /**/ 1208, /**/ From f8e8c0643b1cd97db11912bc4f773e1328a0da02 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 22 Oct 2017 14:44:17 +0200 Subject: [PATCH 3/9] patch 8.0.1210: CTRL-G and CTRL-T are ignored with typeahead Problem: When typing a search pattern CTRL-G and CTRL-T are ignored when there is typeahead. Solution: Don't pass SEARCH_PEEK and don't call char_avail(). (haya14busa, closes #2233) --- src/ex_getln.c | 30 +++++++++++++++++------------- src/testdir/test_search.vim | 20 ++++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/ex_getln.c b/src/ex_getln.c index ceeeaf89f0..6876a215a8 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -158,6 +158,20 @@ trigger_cmd_autocmd(int typechar, int evt) } #endif +/* + * Abandon the command line. + */ + static void +abandon_cmdline(void) +{ + vim_free(ccline.cmdbuff); + ccline.cmdbuff = NULL; + if (msg_scrolled == 0) + compute_cmdrow(); + MSG(""); + redraw_cmdline = TRUE; +} + /* * getcmdline() - accept a command line starting with firstc. * @@ -1702,11 +1716,8 @@ getcmdline( if (p_is && !cmd_silent && (firstc == '/' || firstc == '?')) { pos_T t; - int search_flags = SEARCH_KEEP + SEARCH_NOOF - + SEARCH_PEEK; + int search_flags = SEARCH_KEEP + SEARCH_NOOF; - if (char_avail()) - continue; cursor_off(); out_flush(); if (c == Ctrl_G) @@ -2083,15 +2094,8 @@ returncmd: } #endif - if (gotesc) /* abandon command line */ - { - vim_free(ccline.cmdbuff); - ccline.cmdbuff = NULL; - if (msg_scrolled == 0) - compute_cmdrow(); - MSG(""); - redraw_cmdline = TRUE; - } + if (gotesc) + abandon_cmdline(); } /* diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim index e6a46ff145..19e631e699 100644 --- a/src/testdir/test_search.vim +++ b/src/testdir/test_search.vim @@ -356,6 +356,26 @@ func Test_search_cmdline4() bw! endfunc +func Test_search_cmdline5() + if !exists('+incsearch') + return + endif + " Do not call test_override("char_avail", 1) so that and work + " regardless char_avail. + new + call setline(1, [' 1 the first', ' 2 the second', ' 3 the third']) + set incsearch + 1 + call feedkeys("/the\\\", 'tx') + call assert_equal(' 3 the third', getline('.')) + $ + call feedkeys("?the\\\\", 'tx') + call assert_equal(' 2 the second', getline('.')) + " clean up + set noincsearch + bw! +endfunc + " Tests for regexp with various magic settings func Test_search_regexp() enew! diff --git a/src/version.c b/src/version.c index b0eefff021..6ab48f1798 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1210, /**/ 1209, /**/ From ca05aa24af88836f8aa792360b3780589f294981 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 22 Oct 2017 15:36:14 +0200 Subject: [PATCH 4/9] patch 8.0.1211: cannot reorder tab pages with drag & drop Problem: Cannot reorder tab pages with drag & drop. Solution: Support drag & drop for GTK and MS-Windows. (Ken Takata, Masamichi Abe) --- src/gui_gtk_x11.c | 31 +++++++++++++++- src/gui_w32.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++ src/version.c | 2 + 3 files changed, 126 insertions(+), 1 deletion(-) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 9225375a10..9be54b90e0 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -3567,8 +3567,29 @@ on_select_tab( gpointer data UNUSED) { if (!ignore_tabline_evt) - { send_tabline_event(idx + 1); +} + +/* + * Handle reordering the tabs (using D&D). + */ + static void +on_tab_reordered( + GtkNotebook *notebook UNUSED, +# if GTK_CHECK_VERSION(3,0,0) + gpointer *page UNUSED, +# else + GtkNotebookPage *page UNUSED, +# endif + gint idx, + gpointer data UNUSED) +{ + if (!ignore_tabline_evt) + { + if ((tabpage_index(curtab) - 1) < idx) + tabpage_move(idx + 1); + else + tabpage_move(idx); } } @@ -3658,6 +3679,9 @@ gui_mch_update_tabline(void) page, event_box, nr++); + gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), + page, + TRUE); } event_box = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui.tabline), page); @@ -4093,14 +4117,19 @@ gui_mch_init(void) # endif gtk_container_add(GTK_CONTAINER(event_box), label); gtk_notebook_set_tab_label(GTK_NOTEBOOK(gui.tabline), page, event_box); + gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), page, TRUE); } # if GTK_CHECK_VERSION(3,0,0) g_signal_connect(G_OBJECT(gui.tabline), "switch-page", G_CALLBACK(on_select_tab), NULL); + g_signal_connect(G_OBJECT(gui.tabline), "page-reordered", + G_CALLBACK(on_tab_reordered), NULL); # else gtk_signal_connect(GTK_OBJECT(gui.tabline), "switch_page", GTK_SIGNAL_FUNC(on_select_tab), NULL); + gtk_signal_connect(GTK_OBJECT(gui.tabline), "page-reordered", + GTK_SIGNAL_FUNC(on_tab_reordered), NULL); # endif /* Create a popup menu for the tab line and connect it. */ diff --git a/src/gui_w32.c b/src/gui_w32.c index c5564cd2ac..64acc76527 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -8151,6 +8151,34 @@ initialise_tabline(void) # endif } +/* + * Get tabpage_T from POINT. + */ + static tabpage_T * +GetTabFromPoint( + HWND hWnd, + POINT pt) +{ + tabpage_T *ptp = NULL; + + if (gui_mch_showing_tabline()) + { + TCHITTESTINFO htinfo; + htinfo.pt = pt; + /* ignore if a window under cusor is not tabcontrol. */ + if (s_tabhwnd == hWnd) + { + int idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); + if (idx != -1) + ptp = find_tabpage(idx + 1); + } + } + return ptp; +} + +static POINT s_pt = {0, 0}; +static HCURSOR s_hCursor = NULL; + static LRESULT CALLBACK tabline_wndproc( HWND hwnd, @@ -8158,7 +8186,73 @@ tabline_wndproc( WPARAM wParam, LPARAM lParam) { + POINT pt; + tabpage_T *tp; + RECT rect; + int nCenter; + int idx0; + int idx1; + HandleMouseHide(uMsg, lParam); + + switch (uMsg) + { + case WM_LBUTTONDOWN: + { + s_pt.x = GET_X_LPARAM(lParam); + s_pt.y = GET_Y_LPARAM(lParam); + SetCapture(hwnd); + s_hCursor = GetCursor(); /* backup default cursor */ + break; + } + case WM_MOUSEMOVE: + if (GetCapture() == hwnd + && ((wParam & MK_LBUTTON)) != 0) + { + pt.x = GET_X_LPARAM(lParam); + pt.y = s_pt.y; + if (abs(pt.x - s_pt.x) > GetSystemMetrics(SM_CXDRAG)) + { + SetCursor(LoadCursor(NULL, IDC_SIZEWE)); + + tp = GetTabFromPoint(hwnd, pt); + if (tp != NULL) + { + idx0 = tabpage_index(curtab) - 1; + idx1 = tabpage_index(tp) - 1; + + TabCtrl_GetItemRect(hwnd, idx1, &rect); + nCenter = rect.left + (rect.right - rect.left) / 2; + + /* Check if the mouse cursor goes over the center of + * the next tab to prevent "flickering". */ + if ((idx0 < idx1) && (nCenter < pt.x)) + { + tabpage_move(idx1 + 1); + update_screen(0); + } + else if ((idx1 < idx0) && (pt.x < nCenter)) + { + tabpage_move(idx1); + update_screen(0); + } + } + } + } + break; + case WM_LBUTTONUP: + { + if (GetCapture() == hwnd) + { + SetCursor(s_hCursor); + ReleaseCapture(); + } + break; + } + default: + break; + } + return CallWindowProc(s_tabline_wndproc, hwnd, uMsg, wParam, lParam); } #endif diff --git a/src/version.c b/src/version.c index 6ab48f1798..f913633c7a 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1211, /**/ 1210, /**/ From 66857f410426ca335f4771a58a32b2d14a7e52b9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 22 Oct 2017 16:43:20 +0200 Subject: [PATCH 5/9] patch 8.0.1212: MS-Windows: tear-off menu does not work on 64 bit Problem: MS-Windows: tear-off menu does not work on 64 bit. (shaggyaxe) Solution: Change how the menu handle is looked up. (Ken Takata, closes #1205) --- src/gui_w32.c | 35 ++++++++++++++++++++++++++++++++--- src/version.c | 2 ++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/gui_w32.c b/src/gui_w32.c index 64acc76527..4eaa2be384 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -7567,6 +7567,26 @@ nCopyAnsiToWideChar( #ifdef FEAT_TEAROFF +/* + * Lookup menu handle from "menu_id". + */ + static HMENU +tearoff_lookup_menuhandle( + vimmenu_T *menu, + WORD menu_id) +{ + for ( ; menu != NULL; menu = menu->next) + { + if (menu->modes == 0) /* this menu has just been deleted */ + continue; + if (menu_is_separator(menu->dname)) + continue; + if ((WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000) == menu_id) + return menu->submenu_id; + } + return NULL; +} + /* * The callback function for all the modeless dialogs that make up the * "tearoff menus" Very simple - forward button presses (to fool Vim into @@ -7580,7 +7600,10 @@ tearoff_callback( LPARAM lParam) { if (message == WM_INITDIALOG) + { + SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); return (TRUE); + } /* May show the mouse pointer again. */ HandleMouseHide(message, lParam); @@ -7594,8 +7617,11 @@ tearoff_callback( if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) { + vimmenu_T *menu; + + menu = (vimmenu_T*)GetWindowLongPtr(hwnd, DWLP_USER); (void)TrackPopupMenu( - (HMENU)(long_u)(LOWORD(wParam) ^ 0x8000), + tearoff_lookup_menuhandle(menu, LOWORD(wParam)), TPM_LEFTALIGN | TPM_LEFTBUTTON, (int)rect.right - 8, (int)mp.y, @@ -7707,6 +7733,7 @@ gui_mch_tearoff( WORD dlgwidth; WORD menuID; vimmenu_T *pmenu; + vimmenu_T *top_menu; vimmenu_T *the_menu = menu; HWND hwnd; HDC hdc; @@ -7885,6 +7912,7 @@ gui_mch_tearoff( menu = menu->children->next; else menu = menu->children; + top_menu = menu; for ( ; menu != NULL; menu = menu->next) { if (menu->modes == 0) /* this menu has just been deleted */ @@ -7995,11 +8023,12 @@ gui_mch_tearoff( /* show modelessly */ - the_menu->tearoff_handle = CreateDialogIndirect( + the_menu->tearoff_handle = CreateDialogIndirectParam( s_hinst, (LPDLGTEMPLATE)pdlgtemplate, s_hwnd, - (DLGPROC)tearoff_callback); + (DLGPROC)tearoff_callback, + (LPARAM)top_menu); LocalFree(LocalHandle(pdlgtemplate)); SelectFont(hdc, oldFont); diff --git a/src/version.c b/src/version.c index f913633c7a..2ac4de9f13 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1212, /**/ 1211, /**/ From 2e4cb3b042faba5efc9b5a8b4f86942a417494ce Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 22 Oct 2017 21:11:17 +0200 Subject: [PATCH 6/9] patch 8.0.1213: setting 'mzschemedll' has no effect Problem: Setting 'mzschemedll' has no effect. Solution: Move loading .vimrc to before call to mzscheme_main(). --- src/main.c | 27 ++++++++++++++------------- src/version.c | 2 ++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main.c b/src/main.c index fd96f41bde..3db8efb9ba 100644 --- a/src/main.c +++ b/src/main.c @@ -403,12 +403,26 @@ main debug_break_level = params.use_debug_break_level; #endif + /* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments. + * Allows for setting 'loadplugins' there. */ + if (params.use_vimrc != NULL + && (STRCMP(params.use_vimrc, "NONE") == 0 + || STRCMP(params.use_vimrc, "DEFAULTS") == 0)) + p_lpl = FALSE; + + /* Execute --cmd arguments. */ + exe_pre_commands(¶ms); + + /* Source startup scripts. */ + source_startup_scripts(¶ms); + #ifdef FEAT_MZSCHEME /* * Newer version of MzScheme (Racket) require earlier (trampolined) * initialisation via scheme_main_setup. * Implement this by initialising it as early as possible * and splitting off remaining Vim main into vim_main2(). + * Do source startup scripts, so that 'mzschemedll' can be set. */ return mzscheme_main(); #else @@ -427,19 +441,6 @@ main vim_main2(void) { #ifndef NO_VIM_MAIN - /* Reset 'loadplugins' for "-u NONE" before "--cmd" arguments. - * Allows for setting 'loadplugins' there. */ - if (params.use_vimrc != NULL - && (STRCMP(params.use_vimrc, "NONE") == 0 - || STRCMP(params.use_vimrc, "DEFAULTS") == 0)) - p_lpl = FALSE; - - /* Execute --cmd arguments. */ - exe_pre_commands(¶ms); - - /* Source startup scripts. */ - source_startup_scripts(¶ms); - #ifdef FEAT_EVAL /* * Read all the plugin files. diff --git a/src/version.c b/src/version.c index 2ac4de9f13..160edbe45e 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1213, /**/ 1212, /**/ From 4f1982800f0aff28df6875e718a786f6c4b11ad9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 23 Oct 2017 21:53:30 +0200 Subject: [PATCH 7/9] patch 8.0.1214: accessing freed memory when EXITFREE is set Problem: Accessing freed memory when EXITFREE is set and there is more than one tab and window. (Dominique Pelle) Solution: Free options later. Skip redraw when exiting. --- src/misc2.c | 4 +++- src/screen.c | 2 +- src/version.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/misc2.c b/src/misc2.c index fac44c737a..52ce097a81 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1135,7 +1135,6 @@ free_all_mem(void) free_all_autocmds(); # endif clear_termcodes(); - free_all_options(); free_all_marks(); alist_clear(&global_alist); free_homedir(); @@ -1196,6 +1195,9 @@ free_all_mem(void) /* Destroy all windows. Must come before freeing buffers. */ win_free_all(); + /* Free all option values. Must come after closing windows. */ + free_all_options(); + /* Free all buffers. Reset 'autochdir' to avoid accessing things that * were freed already. */ #ifdef FEAT_AUTOCHDIR diff --git a/src/screen.c b/src/screen.c index 3e08b600f6..c92b17ebb5 100644 --- a/src/screen.c +++ b/src/screen.c @@ -203,7 +203,7 @@ redraw_win_later( win_T *wp, int type) { - if (wp->w_redr_type < type) + if (!exiting && wp->w_redr_type < type) { wp->w_redr_type = type; if (type >= NOT_VALID) diff --git a/src/version.c b/src/version.c index 160edbe45e..c8bab5d4ce 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1214, /**/ 1213, /**/ From 2f40d129bf45cd35976e4120336ae6d504f5a5dd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 24 Oct 2017 21:49:36 +0200 Subject: [PATCH 8/9] patch 8.0.1215: newer gcc warns for implicit fallthrough Problem: Newer gcc warns for implicit fallthrough. Solution: Consistently use a FALLTHROUGH comment. (Christian Brabandt) --- src/buffer.c | 2 ++ src/edit.c | 5 ++++- src/eval.c | 4 ++-- src/ex_docmd.c | 2 +- src/ex_getln.c | 3 +-- src/if_perl.xs | 1 + src/main.c | 4 ++-- src/message.c | 5 +++-- src/normal.c | 9 +++++---- src/regexp.c | 12 ++++++------ src/regexp_nfa.c | 3 ++- src/spell.c | 12 ++++++------ src/version.c | 2 ++ src/window.c | 4 ++-- 14 files changed, 39 insertions(+), 29 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 1bf692a830..0d69b9d66b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4325,6 +4325,7 @@ build_stl_str_hl( case STL_OFFSET_X: base = 'X'; + /* FALLTHROUGH */ case STL_OFFSET: #ifdef FEAT_BYTEOFF l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL); @@ -4336,6 +4337,7 @@ build_stl_str_hl( case STL_BYTEVAL_X: base = 'X'; + /* FALLTHROUGH */ case STL_BYTEVAL: num = byteval; if (num == NL) diff --git a/src/edit.c b/src/edit.c index 5f513068ae..a179620522 100644 --- a/src/edit.c +++ b/src/edit.c @@ -984,7 +984,7 @@ edit( case ESC: /* End input mode */ if (echeck_abbr(ESC + ABBR_OFF)) break; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case Ctrl_C: /* End input mode */ #ifdef FEAT_CMDWIN @@ -5774,13 +5774,16 @@ quote_meta(char_u *dest, char_u *src, int len) if (ctrl_x_mode == CTRL_X_DICTIONARY || ctrl_x_mode == CTRL_X_THESAURUS) break; + /* FALLTHROUGH */ case '~': if (!p_magic) /* quote these only if magic is set */ break; + /* FALLTHROUGH */ case '\\': if (ctrl_x_mode == CTRL_X_DICTIONARY || ctrl_x_mode == CTRL_X_THESAURUS) break; + /* FALLTHROUGH */ case '^': /* currently it's not needed. */ case '$': m++; diff --git a/src/eval.c b/src/eval.c index d4fba7fe0d..8cb91e783d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -6995,7 +6995,7 @@ free_tv(typval_T *varp) { case VAR_FUNC: func_unref(varp->vval.v_string); - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case VAR_STRING: vim_free(varp->vval.v_string); break; @@ -7040,7 +7040,7 @@ clear_tv(typval_T *varp) { case VAR_FUNC: func_unref(varp->vval.v_string); - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case VAR_STRING: vim_free(varp->vval.v_string); varp->vval.v_string = NULL; diff --git a/src/ex_docmd.c b/src/ex_docmd.c index ea6df86ad0..036569f76c 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4115,7 +4115,7 @@ set_one_cmd_context( case CMD_bunload: while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) arg = xp->xp_pattern + 1; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case CMD_buffer: case CMD_sbuffer: case CMD_checktime: diff --git a/src/ex_getln.c b/src/ex_getln.c index 6876a215a8..ba6a403597 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1563,9 +1563,8 @@ getcmdline( break; goto cmdline_not_changed; } - /* FALLTHROUGH */ - #ifdef FEAT_CMDHIST + /* FALLTHROUGH */ case K_UP: case K_DOWN: case K_S_UP: diff --git a/src/if_perl.xs b/src/if_perl.xs index 4ead057c1c..2e6004bb93 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -1101,6 +1101,7 @@ perl_to_vim(SV *sv, typval_T *rettv) rettv->vval.v_number = SvIV(sv); break; } + /* FALLTHROUGH */ case SVt_PV: /* string */ { size_t len = 0; diff --git a/src/main.c b/src/main.c index 3db8efb9ba..0dad4d6a80 100644 --- a/src/main.c +++ b/src/main.c @@ -2228,7 +2228,7 @@ command_line_scan(mparm_T *parmp) argv_idx = -1; break; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'S': /* "-S {file}" execute Vim script */ case 'i': /* "-i {viminfo}" use for viminfo */ #ifndef FEAT_DIFF @@ -2386,7 +2386,7 @@ scripterror: argv_idx = -1; break; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'W': /* "-W {scriptout}" overwrite script file */ if (scriptout != NULL) goto scripterror; diff --git a/src/message.c b/src/message.c index af22607591..41ab17a3f6 100644 --- a/src/message.c +++ b/src/message.c @@ -670,7 +670,8 @@ emsg(char_u *s) ex_exitval = 1; - /* Reset msg_silent, an error causes messages to be switched back on. */ + /* Reset msg_silent, an error causes messages to be switched back on. + */ msg_silent = 0; cmd_silent = FALSE; @@ -2837,7 +2838,7 @@ do_more_prompt(int typed_char) skip_redraw = TRUE; /* skip redraw once */ need_wait_return = FALSE; /* don't wait in main() */ } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'q': /* quit */ case Ctrl_C: case ESC: diff --git a/src/normal.c b/src/normal.c index fbeffe51e9..e781cd70e2 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1945,6 +1945,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) AppendToRedobuff((char_u *)"!\r"); /* use any last used !cmd */ else bangredo = TRUE; /* do_bang() will put cmd in redo buffer */ + /* FALLTHROUGH */ case OP_INDENT: case OP_COLON: @@ -5150,7 +5151,7 @@ dozet: break; } undo = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'g': /* "zg": add good word to word list */ case 'w': /* "zw": add wrong word to word list */ @@ -8267,7 +8268,7 @@ nv_g_cmd(cmdarg_T *cap) /* "g'm" and "g`m": jump to mark without setting pcmark */ case '\'': cap->arg = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case '`': nv_gomark(cap); break; @@ -8328,7 +8329,7 @@ nv_g_cmd(cmdarg_T *cap) case 'q': case 'w': oap->cursor_start = curwin->w_cursor; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case '~': case 'u': case 'U': @@ -9117,7 +9118,7 @@ nv_edit(cmdarg_T *cap) * the first column, then it inserts. */ if (curwin->w_cursor.col == 0) break; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case 'a': /* "a"ppend is like "i"nsert on the next character. */ #ifdef FEAT_VIRTUALEDIT diff --git a/src/regexp.c b/src/regexp.c index c4745ce7a4..a5d7a13a42 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -1997,7 +1997,7 @@ regatom(int *flagp) goto collection; /* "\_x" is character class plus newline */ - /*FALLTHROUGH*/ + /* FALLTHROUGH */ /* * Character classes. @@ -5847,7 +5847,7 @@ regrepeat( case IDENT: case IDENT + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SIDENT: case SIDENT + ADD_NL: while (count < maxcount) @@ -5877,7 +5877,7 @@ regrepeat( case KWORD: case KWORD + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SKWORD: case SKWORD + ADD_NL: while (count < maxcount) @@ -5908,7 +5908,7 @@ regrepeat( case FNAME: case FNAME + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SFNAME: case SFNAME + ADD_NL: while (count < maxcount) @@ -5938,7 +5938,7 @@ regrepeat( case PRINT: case PRINT + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case SPRINT: case SPRINT + ADD_NL: while (count < maxcount) @@ -6131,7 +6131,7 @@ do_class: case ANYOF: case ANYOF + ADD_NL: testval = TRUE; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case ANYBUT: case ANYBUT + ADD_NL: diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 40d6605f01..86061a3a50 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -1320,7 +1320,7 @@ nfa_regatom(void) goto collection; /* "\_x" is character class plus newline */ - /*FALLTHROUGH*/ + /* FALLTHROUGH */ /* * Character classes. @@ -4698,6 +4698,7 @@ skip_add: subs = addstate(l, state->out, subs, pim, off_arg); break; } + /* FALLTHROUGH */ case NFA_MCLOSE1: case NFA_MCLOSE2: case NFA_MCLOSE3: diff --git a/src/spell.c b/src/spell.c index eb1b9fb6c8..cdcf822957 100644 --- a/src/spell.c +++ b/src/spell.c @@ -5019,7 +5019,7 @@ suggest_trie_walk( } PROF_STORE(sp->ts_state) sp->ts_state = STATE_PLAIN; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_PLAIN: /* @@ -5243,7 +5243,7 @@ suggest_trie_walk( } break; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_INS_PREP: if (sp->ts_flags & TSF_DIDDEL) @@ -5277,7 +5277,7 @@ suggest_trie_walk( } break; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_INS: /* Insert one byte. Repeat this for each possible byte at this @@ -5464,7 +5464,7 @@ suggest_trie_walk( *p = p[1]; p[1] = c; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_SWAP3: /* Swap two bytes, skipping one: "123" -> "321". We change @@ -5703,7 +5703,7 @@ suggest_trie_walk( p[1] = p[2]; p[2] = c; } - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_REP_INI: /* Check if matching with REP items from the .aff file would work. @@ -5736,7 +5736,7 @@ suggest_trie_walk( PROF_STORE(sp->ts_state) sp->ts_state = STATE_REP; - /*FALLTHROUGH*/ + /* FALLTHROUGH */ case STATE_REP: /* Try matching with REP items from the .aff file. For each match diff --git a/src/version.c b/src/version.c index c8bab5d4ce..05db90f1bf 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1215, /**/ 1214, /**/ diff --git a/src/window.c b/src/window.c index 96e32d8ef2..ad084a4ebd 100644 --- a/src/window.c +++ b/src/window.c @@ -433,8 +433,8 @@ newwindow: g_do_tagpreview = Prenum; else g_do_tagpreview = p_pvh; - /*FALLTHROUGH*/ #endif + /* FALLTHROUGH */ case ']': case Ctrl_RSB: CHECK_CMDWIN @@ -557,8 +557,8 @@ wingotofile: g_do_tagpreview = Prenum; else g_do_tagpreview = p_pvh; - /*FALLTHROUGH*/ #endif + /* FALLTHROUGH */ case ']': case Ctrl_RSB: /* keep Visual mode, can select words to use as a tag */ From 6ce650480844bfaa5410874416b4a2e15f40b870 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 24 Oct 2017 22:32:59 +0200 Subject: [PATCH 9/9] patch 8.0.1216: tabline is not always updated for :file command Problem: Tabline is not always updated for :file command. (Norio Takagi) Solution: Set redraw_tabline. (Hirohito Higashi) --- src/ex_cmds.c | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 60f47bbd24..154372883d 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3002,6 +3002,7 @@ ex_file(exarg_T *eap) /* print full file name if :cd used */ if (!shortmess(SHM_FILEINFO)) fileinfo(FALSE, FALSE, eap->forceit); + redraw_tabline = TRUE; } /* diff --git a/src/version.c b/src/version.c index 05db90f1bf..3668e30248 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1216, /**/ 1215, /**/