diff options
-rw-r--r-- | cmake/FindMsgpack.cmake | 2 | ||||
-rw-r--r-- | man/nvim.1 | 20 | ||||
-rw-r--r-- | runtime/autoload/phpcomplete.vim | 141 | ||||
-rw-r--r-- | runtime/doc/help.txt | 12 | ||||
-rw-r--r-- | runtime/doc/repeat.txt | 3 | ||||
-rw-r--r-- | runtime/syntax/csh.vim | 2 | ||||
-rw-r--r-- | runtime/syntax/groovy.vim | 3 | ||||
-rw-r--r-- | runtime/syntax/php.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/sh.vim | 59 | ||||
-rw-r--r-- | runtime/syntax/sm.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/tex.vim | 29 | ||||
-rw-r--r-- | runtime/syntax/yacc.vim | 4 | ||||
-rw-r--r-- | src/nvim/eval.c | 12 | ||||
-rw-r--r-- | src/nvim/fileio.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_eval.in | 234 | ||||
-rw-r--r-- | src/nvim/testdir/test_eval.ok | bin | 10814 -> 0 bytes | |||
-rw-r--r-- | src/nvim/testdir/test_eval_func.vim | 12 | ||||
-rw-r--r-- | src/nvim/tui/tui.c | 12 | ||||
-rw-r--r-- | src/nvim/version.c | 10 | ||||
-rw-r--r-- | src/nvim/window.c | 11 | ||||
-rw-r--r-- | test/functional/legacy/eval_spec.lua | 696 | ||||
-rw-r--r-- | test/functional/legacy/glob2regpat_spec.lua | 22 | ||||
-rw-r--r-- | test/functional/legacy/quickfix_spec.lua | 18 |
24 files changed, 929 insertions, 388 deletions
diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index fbd107e45a..60afc88839 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -7,7 +7,7 @@ if(NOT MSGPACK_USE_BUNDLED) find_package(PkgConfig) if (PKG_CONFIG_FOUND) - pkg_search_module(PC_MSGPACK QUIET msgpackc msgpack) + pkg_search_module(PC_MSGPACK QUIET msgpackc>=1.0 msgpack>=1.0) endif() else() set(PC_MSGPACK_INCLUDEDIR) diff --git a/man/nvim.1 b/man/nvim.1 index f9c4e24d0b..7e8cd5b809 100644 --- a/man/nvim.1 +++ b/man/nvim.1 @@ -1,4 +1,4 @@ -.Dd November 11, 2015 +.Dd January 28, 2016 .Dt NVIM 1 .Os .Sh NAME @@ -373,8 +373,24 @@ Used to set the 'shell' option, which determines the shell used by the command. .It Ev NVIM_TUI_ENABLE_CURSOR_SHAPE If defined, change the cursor shape to a vertical bar while in insert mode. -Requires that the host terminal support the DECSCUSR CSI escape sequence. +Requires that the host terminal supports the DECSCUSR CSI escape sequence. Has no effect in GUIs. +.Pp +Depending on the terminal emulator, using this option with +.Nm +under +.Xr tmux 1 +might require adding the following to +.Pa ~/.tmux.conf : +.Bd -literal -offset indent +set -ga terminal-overrides ',*:Ss=\eE[%p1%d q:Se=\eE[2 q' +.Ed +.Pp +See +.Ic terminal-overrides +in the +.Xr tmux 1 +manual page for more information. .It Ev NVIM_TUI_ENABLE_TRUE_COLOR If defined, assume the host terminal supports 24 bit colors. Has no effect in GUIs. diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index dbc40fdf36..6dcddfd43e 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2015 Feb 28 +" Last Change: 2015 Apr 02 " " OPTIONS: " @@ -141,71 +141,80 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ if a:base != "" let context = substitute(context, '\s*[$a-zA-Z_0-9\x7f-\xff]*$', '', '') end + else + let context = '' end - let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(getline(0, line('.'))) + try + let winheight = winheight(0) + let winnr = winnr() - if context =~? '^use\s' || context ==? 'use' - return phpcomplete#CompleteUse(a:base) - endif + let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(getline(0, line('.'))) - if context =~ '\(->\|::\)$' - " {{{ - " Get name of the class - let classname = phpcomplete#GetClassName(line('.'), context, current_namespace, imports) - - " Get location of class definition, we have to iterate through all - if classname != '' - if classname =~ '\' - " split the last \ segment as a classname, everything else is the namespace - let classname_parts = split(classname, '\') - let namespace = join(classname_parts[0:-2], '\') - let classname = classname_parts[-1] - else - let namespace = '\' - endif - let classlocation = phpcomplete#GetClassLocation(classname, namespace) - else - let classlocation = '' + if context =~? '^use\s' || context ==? 'use' + return phpcomplete#CompleteUse(a:base) endif - if classlocation != '' - if classlocation == 'VIMPHP_BUILTINOBJECT' && has_key(g:php_builtin_classes, tolower(classname)) - return phpcomplete#CompleteBuiltInClass(context, classname, a:base) + if context =~ '\(->\|::\)$' + " {{{ + " Get name of the class + let classname = phpcomplete#GetClassName(line('.'), context, current_namespace, imports) + + " Get location of class definition, we have to iterate through all + if classname != '' + if classname =~ '\' + " split the last \ segment as a classname, everything else is the namespace + let classname_parts = split(classname, '\') + let namespace = join(classname_parts[0:-2], '\') + let classname = classname_parts[-1] + else + let namespace = '\' + endif + let classlocation = phpcomplete#GetClassLocation(classname, namespace) + else + let classlocation = '' endif - if filereadable(classlocation) - let classfile = readfile(classlocation) - let classcontent = '' - let classcontent .= "\n".phpcomplete#GetClassContents(classlocation, classname) - let sccontent = split(classcontent, "\n") - let visibility = expand('%:p') == fnamemodify(classlocation, ':p') ? 'private' : 'public' + if classlocation != '' + if classlocation == 'VIMPHP_BUILTINOBJECT' && has_key(g:php_builtin_classes, tolower(classname)) + return phpcomplete#CompleteBuiltInClass(context, classname, a:base) + endif - return phpcomplete#CompleteUserClass(context, a:base, sccontent, visibility) - endif - endif + if filereadable(classlocation) + let classfile = readfile(classlocation) + let classcontent = '' + let classcontent .= "\n".phpcomplete#GetClassContents(classlocation, classname) + let sccontent = split(classcontent, "\n") + let visibility = expand('%:p') == fnamemodify(classlocation, ':p') ? 'private' : 'public' - return phpcomplete#CompleteUnknownClass(a:base, context) - " }}} - elseif context =~? 'implements' - return phpcomplete#CompleteClassName(a:base, ['i'], current_namespace, imports) - elseif context =~? 'extends\s\+.\+$' && a:base == '' - return ['implements'] - elseif context =~? 'extends' - let kinds = context =~? 'class\s' ? ['c'] : ['i'] - return phpcomplete#CompleteClassName(a:base, kinds, current_namespace, imports) - elseif context =~? 'class [a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' - " special case when you've typed the class keyword and the name too, only extends and implements allowed there - return filter(['extends', 'implements'], 'stridx(v:val, a:base) == 0') - elseif context =~? 'new' - return phpcomplete#CompleteClassName(a:base, ['c'], current_namespace, imports) - endif + return phpcomplete#CompleteUserClass(context, a:base, sccontent, visibility) + endif + endif - if a:base =~ '^\$' - return phpcomplete#CompleteVariable(a:base) - else - return phpcomplete#CompleteGeneral(a:base, current_namespace, imports) - endif + return phpcomplete#CompleteUnknownClass(a:base, context) + " }}} + elseif context =~? 'implements' + return phpcomplete#CompleteClassName(a:base, ['i'], current_namespace, imports) + elseif context =~? 'extends\s\+.\+$' && a:base == '' + return ['implements'] + elseif context =~? 'extends' + let kinds = context =~? 'class\s' ? ['c'] : ['i'] + return phpcomplete#CompleteClassName(a:base, kinds, current_namespace, imports) + elseif context =~? 'class [a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' + " special case when you've typed the class keyword and the name too, only extends and implements allowed there + return filter(['extends', 'implements'], 'stridx(v:val, a:base) == 0') + elseif context =~? 'new' + return phpcomplete#CompleteClassName(a:base, ['c'], current_namespace, imports) + endif + + if a:base =~ '^\$' + return phpcomplete#CompleteVariable(a:base) + else + return phpcomplete#CompleteGeneral(a:base, current_namespace, imports) + endif + finally + silent! exec winnr.'resize '.winheight + endtry endfunction " }}} @@ -1523,21 +1532,19 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor return '' endif - if line =~? '\v^\s*(abstract\s+|final\s+)*\s*class' - let class_name = matchstr(line, '\c\s*class\s*\zs'.class_name_pattern.'\ze') + if line =~? '\v^\s*(abstract\s+|final\s+)*\s*class\s' + let class_name = matchstr(line, '\cclass\s\+\zs'.class_name_pattern.'\ze') let extended_class = matchstr(line, '\cclass\s\+'.class_name_pattern.'\s\+extends\s\+\zs'.class_name_pattern.'\ze') let classname_candidate = a:context =~? 'parent::' ? extended_class : class_name - else - let i += 1 - continue + if classname_candidate != '' + let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType(classname_candidate, class_candidate_namespace, class_candidate_imports, methodstack) + " return absolute classname, without leading \ + return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate + endif endif - if classname_candidate != '' - let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType(classname_candidate, class_candidate_namespace, class_candidate_imports, methodstack) - " return absolute classname, without leading \ - return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate - endif + let i += 1 endwhile elseif a:context =~? '(\s*new\s\+'.class_name_pattern.'\s*)->' let classname_candidate = matchstr(a:context, '\cnew\s\+\zs'.class_name_pattern.'\ze') @@ -2031,7 +2038,7 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam " remember the window we started at let phpcomplete_original_window = winnr() - silent! tab 1new + silent! below 1new silent! 0put =cfile call search('\c\(class\|interface\|trait\)\_s\+'.a:class_name.'\(\>\|$\)') let cfline = line('.') @@ -2370,7 +2377,7 @@ endfunction! function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ let original_window = winnr() - silent! tab 1new + silent! below 1new silent! 0put =a:file_lines normal! G diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 3d44ed83d7..19bcb35da8 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -1,4 +1,4 @@ -*help.txt* For Vim version 7.4. Last change: 2015 Apr 11 +*help.txt* For Vim version 7.4. Last change: 2015 Apr 15 VIM - main help file k @@ -171,16 +171,6 @@ Standard plugins ~ |pi_zip.txt| Zip archive explorer LOCAL ADDITIONS: *local-additions* -|Mines.txt| The Mines Game Jul 30, 2009 -|Tabular.txt| Configurable, flexible, intuitive text aligning -|cecutil.txt| DrChip's Utilities Jun 11, 2004 -|example.txt| Example for a locally added help file -|matchit.txt| Extended "%" matching -|pi_netrw.txt| For Vim version 7.4. Last change: 2014 Jul 09 -|synchk.txt| Syntax Checker May 15, 2013 -|test.txt| Testing the hélp cömmånd nôw -|typecorr.txt| Plugin for correcting typing mistakes -|helpp.txt| Dummy line to avoid an error message ------------------------------------------------------------------------------ *bars* Bars example diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 59dbbf3067..21b5eef811 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2015 Jan 07 +*repeat.txt* For Vim version 7.4. Last change: 2015 Apr 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -583,6 +583,7 @@ For example, to profile the one_script.vim script file: > :prof[ile] start {fname} *:prof* *:profile* *E750* Start profiling, write the output in {fname} upon exit. + "~/" and environment variables in {fname} will be expanded. If {fname} already exists it will be silently overwritten. The variable |v:profiling| is set to one. diff --git a/runtime/syntax/csh.vim b/runtime/syntax/csh.vim index a67cb09189..9dc2c4ef56 100644 --- a/runtime/syntax/csh.vim +++ b/runtime/syntax/csh.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: C-shell (csh) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Version: 11 " Last Change: Oct 23, 2014 +" Version: 11 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_CSH " For version 5.x: Clear all syntax items diff --git a/runtime/syntax/groovy.vim b/runtime/syntax/groovy.vim index c745960bd5..65dbf17728 100644 --- a/runtime/syntax/groovy.vim +++ b/runtime/syntax/groovy.vim @@ -4,7 +4,7 @@ " Maintainer: Tobias Rapp <yahuxo@gmx.de> " Version: 0.1.13 " URL: http://www.vim.org/scripts/script.php?script_id=945 -" Last Change: 2013 Apr 24 +" Last Change: 2015 Apr 13 " THE ORIGINAL AUTHOR'S NOTES: " @@ -220,7 +220,6 @@ syn region groovyComment start="/\*" end="\*/" contains=@groovyCommen syn match groovyCommentStar contained "^\s*\*[^/]"me=e-1 syn match groovyCommentStar contained "^\s*\*$" syn match groovyLineComment "//.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell -syn match groovyLineComment "#.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell GroovyHiLink groovyCommentString groovyString GroovyHiLink groovyComment2String groovyString GroovyHiLink groovyCommentCharacter groovyCharacter diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index 860181e0e6..e2d73111e4 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: php PHP 3/4/5 " Maintainer: Jason Woofenden <jason@jasonwoof.com> -" Last Change: Sep 18, 2014 -" URL: https://gitorious.org/jasonwoof/vim-syntax/blobs/master/php.vim +" Last Change: Mar 24, 2015 +" URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD " Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com> " Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index f3218ffcb2..ad0df1f117 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,8 +2,8 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> -" Last Change: Jan 08, 2015 -" Version: 134 +" Last Change: Apr 10, 2015 +" Version: 136 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr) @@ -104,7 +104,7 @@ syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsa if exists("b:is_kornshell") syn cluster ErrorList add=shDTestError endif -syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDerefSimple,shDo,shEcho,shEscape,shIf,shFor,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement +syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor syn cluster shArithList contains=@shArithParenList,shParenError syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq @@ -127,9 +127,9 @@ syn cluster shHereList contains=shBeginHere,shHerePayload syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo -syn cluster shLoopList contains=@shCaseList,shIf,shFor,shForPP,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet,shOption +syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator -syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shExDoubleQuote,shDoubleQuote,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq +syn cluster shTestList contains=shCharClass,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr " Echo: {{{1 " ==== " This one is needed INSIDE a CommandSub, so that `echo bla` be correct @@ -197,13 +197,12 @@ syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\ syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern syn match shTestPattern contained '\w\+' -syn region shTestDoubleQuote contained start='"' skip='\\"' end='"' contains=shBQpairs +syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' syn match shTestSingleQuote contained '\\.' syn match shTestSingleQuote contained "'[^']*'" -syn match shBQpairs contained '\\\\' if exists("b:is_kornshell") || exists("b:is_bash") - syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList - syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList + syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList,shComment + syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList,shComment endif " Character Class In Range: {{{1 @@ -213,15 +212,16 @@ syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum " Loops: do, if, while, until {{{1 " ====== if s:sh_fold_ifdofor - syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList - syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList - syn region shFor fold matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn + syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList + syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList + syn region shFor fold matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn + syn region shForPP fold matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr else - syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList - syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList - syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn + syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList + syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList + syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn + syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr endif -syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr if exists("b:is_kornshell") || exists("b:is_bash") syn cluster shCaseList add=shRepeat syn cluster shFunctionList add=shRepeat @@ -409,19 +409,27 @@ endif if exists("b:is_bash") if s:sh_fold_functions - syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - syn region shFunctionTwo fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionTwo fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionFour fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment else - syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList - syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList + syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList + syn region shFunctionFour matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained endif else if s:sh_fold_functions - syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionFour fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment else - syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList - syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList + syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList + syn region shFunctionFour matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained endif endif @@ -577,7 +585,7 @@ hi def link shDoubleQuote shString hi def link shEcho shString hi def link shEchoDelim shOperator hi def link shEchoQuote shString -"hi def link shForPP shLoop +hi def link shForPP shLoop hi def link shEmbeddedEcho shString hi def link shEscape shCommandSub hi def link shExDoubleQuote shDoubleQuote @@ -604,7 +612,6 @@ hi def link shTestOpr shConditional hi def link shTestPattern shString hi def link shTestDoubleQuote shString hi def link shTestSingleQuote shString -hi def link shBQpairs shString hi def link shVariable shSetList hi def link shWrapLineOperator shOperator diff --git a/runtime/syntax/sm.vim b/runtime/syntax/sm.vim index ad96cdb3b5..8fdc14b71a 100644 --- a/runtime/syntax/sm.vim +++ b/runtime/syntax/sm.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: sendmail " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Jan 13, 2015 -" Version: 6 +" Last Change: Oct 23, 2014 +" Version: 7 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SM if exists("b:current_syntax") diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index dcdeca2e6c..f704766877 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> -" Last Change: Nov 18, 2014 -" Version: 83 +" Last Change: Apr 02, 2015 +" Version: 84 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -391,10 +391,17 @@ endif " particular support for bold and italic {{{1 if s:tex_fast =~ 'b' if s:tex_conceal =~ 'b' - syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup - syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup - syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup - syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup + if !exists("g:tex_nospell") || !g:tex_nospell + syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texBoldGroup,@Spell + syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texItalGroup,@Spell + syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texItalGroup,@Spell + syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texBoldGroup,@Spell + else + syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texBoldGroup + syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texItalGroup + syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texItalGroup + syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texBoldGroup + endif endif endif @@ -576,14 +583,14 @@ else syn match texComment "%.*$" contains=@texCommentGroup if s:tex_fast =~ 'c' syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" fold contains=@texFoldGroup,@NoSpell - syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" fold contains=@Spell,@texFoldGroup + syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" fold contains=@texFoldGroup,@NoSpell + syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" fold contains=@Spell,@texFoldGroup endif else - syn match texComment "%.*$" contains=@texCommentGroup + syn match texComment "%.*$" contains=@texCommentGroup if s:tex_fast =~ 'c' - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell - syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" contains=@Spell,@texFoldGroup + syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell + syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" contains=@Spell,@texFoldGroup endif endif endif diff --git a/runtime/syntax/yacc.vim b/runtime/syntax/yacc.vim index 9dc6cccb2d..977ffa75e4 100644 --- a/runtime/syntax/yacc.vim +++ b/runtime/syntax/yacc.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Yacc " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Jan 14, 2015 -" Version: 12 +" Last Change: Apr 02, 2015 +" Version: 13 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " " Options: {{{1 diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 22ff7988f3..a1c5f958d1 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10822,15 +10822,15 @@ static void f_globpath(typval_T *argvars, typval_T *rettv) } } -/* - * "glob2regpat()" function - */ +// "glob2regpat()" function static void f_glob2regpat(typval_T *argvars, typval_T *rettv) { - char_u *pat = get_tv_string_chk(&argvars[0]); + char_u *pat = get_tv_string_chk(&argvars[0]); // NULL on type error - rettv->v_type = VAR_STRING; - rettv->vval.v_string = file_pat_to_reg_pat(pat, NULL, NULL, FALSE); + rettv->v_type = VAR_STRING; + rettv->vval.v_string = (pat == NULL) + ? NULL + : file_pat_to_reg_pat(pat, NULL, NULL, false); } /* diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index c095a7d27f..badb5b85b0 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -7106,6 +7106,7 @@ char_u * file_pat_to_reg_pat( char *allow_dirs, // Result passed back out in here int no_bslash // Don't use a backward slash as pathsep ) + FUNC_ATTR_NONNULL_ARG(1) { const char_u *endp; char_u *reg_pat; @@ -7118,6 +7119,10 @@ char_u * file_pat_to_reg_pat( if (pat_end == NULL) pat_end = pat + STRLEN(pat); + if (pat_end == pat) { + return (char_u *)xstrdup("^$"); + } + size_t size = 2; // '^' at start, '$' at end. for (p = pat; p < pat_end; p++) { diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index e27ac227c8..41ce2daa91 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -7,7 +7,7 @@ export SHELL := sh VIMPROG := ../../../build/bin/nvim SCRIPTSOURCE := ../../../runtime -SCRIPTS := test_eval.out \ +SCRIPTS := \ test8.out test10.out \ test11.out test12.out test13.out test14.out \ test17.out \ diff --git a/src/nvim/testdir/test_eval.in b/src/nvim/testdir/test_eval.in deleted file mode 100644 index 54cdb03ba2..0000000000 --- a/src/nvim/testdir/test_eval.in +++ /dev/null @@ -1,234 +0,0 @@ -Test for various eval features. vim: set ft=vim : - -Note: system clipboard is saved, changed and restored. - -clipboard contents -something else - -STARTTEST -:so small.vim -:set noswapfile -:lang C -:fun AppendRegContents(reg) - call AppendRegParts(a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1))) -:endfun -:fun AppendRegParts(reg, type, cont, strcont, cont1, strcont1) - call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, a:type, a:cont, a:strcont, a:cont1, a:strcont1)) -endfun -:command -nargs=? AR :call AppendRegContents(<q-args>) -:fun SetReg(...) - call call('setreg', a:000) - call append('$', printf('{{{2 setreg(%s)', string(a:000)[1:-2])) - call AppendRegContents(a:1) - if a:1 isnot# '=' - execute "silent normal! Go==\n==\e\"".a:1."P" - endif -endfun -:fun ErrExe(str) - call append('$', 'Executing '.a:str) - try - execute a:str - catch - $put =v:exception - endtry -endfun -:fun Test() -$put ='{{{1 let tests' -let @" = 'abc' -AR " -let @" = "abc\n" -AR " -let @" = "abc\<C-m>" -AR " -let @= = '"abc"' -AR = - -$put ='{{{1 Basic setreg tests' -call SetReg('a', 'abcA', 'c') -call SetReg('b', 'abcB', 'v') -call SetReg('c', 'abcC', 'l') -call SetReg('d', 'abcD', 'V') -call SetReg('e', 'abcE', 'b') -call SetReg('f', 'abcF', "\<C-v>") -call SetReg('g', 'abcG', 'b10') -call SetReg('h', 'abcH', "\<C-v>10") -call SetReg('I', 'abcI') - -$put ='{{{1 Appending single lines with setreg()' -call SetReg('A', 'abcAc', 'c') -call SetReg('A', 'abcAl', 'l') -call SetReg('A', 'abcAc2','c') -call SetReg('b', 'abcBc', 'ca') -call SetReg('b', 'abcBb', 'ba') -call SetReg('b', 'abcBc2','ca') -call SetReg('b', 'abcBb2','b50a') - -call SetReg('C', 'abcCl', 'l') -call SetReg('C', 'abcCc', 'c') -call SetReg('D', 'abcDb', 'b') - -call SetReg('E', 'abcEb', 'b') -call SetReg('E', 'abcEl', 'l') -call SetReg('F', 'abcFc', 'c') - -$put ='{{{1 Appending NL with setreg()' -call setreg('a', 'abcA2', 'c') -call setreg('b', 'abcB2', 'v') -call setreg('c', 'abcC2', 'l') -call setreg('d', 'abcD2', 'V') -call setreg('e', 'abcE2', 'b') -call setreg('f', 'abcF2', "\<C-v>") -call setreg('g', 'abcG2', 'b10') -call setreg('h', 'abcH2', "\<C-v>10") -call setreg('I', 'abcI2') - -call SetReg('A', "\n") -call SetReg('B', "\n", 'c') -call SetReg('C', "\n") -call SetReg('D', "\n", 'l') -call SetReg('E', "\n") -call SetReg('F', "\n", 'b') - -$put ='{{{1 Setting lists with setreg()' -call SetReg('a', ['abcA3'], 'c') -call SetReg('b', ['abcB3'], 'l') -call SetReg('c', ['abcC3'], 'b') -call SetReg('d', ['abcD3']) -call SetReg('e', [1, 2, 'abc', 3]) -call SetReg('f', [1, 2, 3]) - -$put ='{{{1 Appending lists with setreg()' -call SetReg('A', ['abcA3c'], 'c') -call SetReg('b', ['abcB3l'], 'la') -call SetReg('C', ['abcC3b'], 'lb') -call SetReg('D', ['abcD32']) - -call SetReg('A', ['abcA32']) -call SetReg('B', ['abcB3c'], 'c') -call SetReg('C', ['abcC3l'], 'l') -call SetReg('D', ['abcD3b'], 'b') - -$put ='{{{1 Appending lists with NL with setreg()' -call SetReg('A', ["\n", 'abcA3l2'], 'l') -call SetReg('B', ["\n", 'abcB3c2'], 'c') -call SetReg('C', ["\n", 'abcC3b2'], 'b') -call SetReg('D', ["\n", 'abcD3b50'],'b50') - -$put ='{{{1 Setting lists with NLs with setreg()' -call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"]) -call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c') -call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l') -call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b') -call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10') - -$put ='{{{1 Search and expressions' -call SetReg('/', ['abc/']) -call SetReg('/', ["abc/\n"]) -call SetReg('=', ['"abc/"']) -call SetReg('=', ["\"abc/\n\""]) -$put ='{{{1 System clipboard' -if has('clipboard') -" Save and restore system clipboard. -" If no connection to X-Server is possible, test should succeed. -let _clipreg = ['*', getreg('*'), getregtype('*')] -let _clipopt = &cb -let &cb='unnamed' -5y -AR * -tabdo :windo :echo "hi" -6y -AR * -let &cb=_clipopt -call call('setreg', _clipreg) -else - call AppendRegParts('*', 'V', "clipboard contents\n", "['clipboard contents']", "clipboard contents\n", "['clipboard contents']") - call AppendRegParts('*', 'V', "something else\n", "['something else']", "something else\n", "['something else']") -endif -$put ='{{{1 Errors' -call ErrExe('call setreg()') -call ErrExe('call setreg(1)') -call ErrExe('call setreg(1, 2, 3, 4)') -call ErrExe('call setreg([], 2)') -call ErrExe('call setreg(1, {})') -call ErrExe('call setreg(1, 2, [])') -call ErrExe('call setreg("/", ["1", "2"])') -call ErrExe('call setreg("=", ["1", "2"])') -call ErrExe('call setreg(1, ["", "", [], ""])') -endfun -:" -:call Test() -:" -:delfunction SetReg -:delfunction AppendRegContents -:delfunction ErrExe -:delfunction Test -:delcommand AR -:call garbagecollect(1) -:" -:/^start:/+1,$wq! test.out -:" vim: et ts=4 isk-=\: fmr=???,??? -:call getchar() -:e test.out -:%d - -:" function name not starting with a capital -:try -: func! g:test() -: echo "test" -: endfunc -:catch -: $put =v:exception -:endtry - -:" function name folowed by # -:try -: func! test2() "# -: echo "test2" -: endfunc -:catch -: $put =v:exception -:endtry - -:" function name includes a colon -:try -: func! b:test() -: echo "test" -: endfunc -:catch -: $put =v:exception -:endtry - -:" function name starting with/without "g:", buffer-local funcref. -:function! g:Foo(n) -: $put ='called Foo(' . a:n . ')' -:endfunction -:let b:my_func = function('Foo') -:call b:my_func(1) -:echo g:Foo(2) -:echo Foo(3) - -:" script-local function used in Funcref must exist. -:so test_eval_func.vim - -:" using $ instead of '$' must give an error -:try -: call append($, 'foobar') -:catch -: $put =v:exception -:endtry - -:$put ='{{{1 getcurpos/setpos' -/^012345678 -6l:let sp = getcurpos() -0:call setpos('.', sp) -jyl:$put - -:/^start:/+1,$wq! test.out -:" vim: et ts=4 isk-=\: fmr=???,??? -:call getchar() -ENDTEST - -012345678 -012345678 - -start: diff --git a/src/nvim/testdir/test_eval.ok b/src/nvim/testdir/test_eval.ok Binary files differdeleted file mode 100644 index cf7a5cd418..0000000000 --- a/src/nvim/testdir/test_eval.ok +++ /dev/null diff --git a/src/nvim/testdir/test_eval_func.vim b/src/nvim/testdir/test_eval_func.vim deleted file mode 100644 index 48d01df27d..0000000000 --- a/src/nvim/testdir/test_eval_func.vim +++ /dev/null @@ -1,12 +0,0 @@ -" Vim script used in test_eval.in. Needed for script-local function. - -func! s:Testje() - return "foo" -endfunc - -let Bar = function('s:Testje') - -$put ='s:Testje exists: ' . exists('s:Testje') -$put ='func s:Testje exists: ' . exists('*s:Testje') -$put ='Bar exists: ' . exists('Bar') -$put ='func Bar exists: ' . exists('*Bar') diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 7f7d138358..00e2821075 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -845,7 +845,7 @@ static void fix_terminfo(TUIData *data) if ((term_prog && !strcmp(term_prog, "Konsole")) || os_getenv("KONSOLE_DBUS_SESSION") != NULL) { // Konsole uses a proprietary escape code to set the cursor shape - // and does not suppport DECSCUSR. + // and does not support DECSCUSR. data->unibi_ext.enter_insert_mode = (int)unibi_add_ext_str(ut, NULL, TMUX_WRAP("\x1b]50;CursorShape=1;BlinkingCursorEnabled=1\x07")); data->unibi_ext.enter_replace_mode = (int)unibi_add_ext_str(ut, NULL, @@ -854,13 +854,15 @@ static void fix_terminfo(TUIData *data) TMUX_WRAP("\x1b]50;CursorShape=0;BlinkingCursorEnabled=0\x07")); } else if (!vte_version || atoi(vte_version) >= 3900) { // Assume that the terminal supports DECSCUSR unless it is an - // old VTE based terminal + // old VTE based terminal. This should not get wrapped for tmux, + // which will handle it via its Ss/Se terminfo extension - usually + // according to its terminal-overrides. data->unibi_ext.enter_insert_mode = (int)unibi_add_ext_str(ut, NULL, - TMUX_WRAP("\x1b[5 q")); + "\x1b[5 q"); data->unibi_ext.enter_replace_mode = (int)unibi_add_ext_str(ut, NULL, - TMUX_WRAP("\x1b[3 q")); + "\x1b[3 q"); data->unibi_ext.exit_insert_mode = (int)unibi_add_ext_str(ut, NULL, - TMUX_WRAP("\x1b[2 q")); + "\x1b[2 q"); } end: diff --git a/src/nvim/version.c b/src/nvim/version.c index 41bcd7d738..30f104562f 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -69,6 +69,16 @@ static char *features[] = { // clang-format off static int included_patches[] = { + 1137, + + + + 1081, + + + + + 1055, // 1054, // 1053, diff --git a/src/nvim/window.c b/src/nvim/window.c index 853f8755c3..191cb04d75 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1913,9 +1913,16 @@ int win_close(win_T *win, int free_buf) */ if (win->w_buffer != NULL) { win->w_closing = true; - close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE); - if (win_valid(win)) + close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, true); + if (win_valid(win)) { win->w_closing = false; + } + + // Make sure curbuf is valid. It can become invalid if 'bufhidden' is + // "wipe". + if (!buf_valid(curbuf)) { + curbuf = firstbuf; + } } if (only_one_window() && win_valid(win) && win->w_buffer == NULL diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua new file mode 100644 index 0000000000..05cd73dbd4 --- /dev/null +++ b/test/functional/legacy/eval_spec.lua @@ -0,0 +1,696 @@ +-- Test for various eval features. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect +local eq, eval, wait, write_file = helpers.eq, helpers.eval, helpers.wait, helpers.write_file + +local function has_clipboard() + clear() + return 1 == eval("has('clipboard')") +end + +describe('eval', function() + setup(function() + write_file('test_eval_setup.vim', [[ + set noswapfile + lang C + + fun AppendRegContents(reg) + call AppendRegParts(a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1))) + endfun + + fun AppendRegParts(reg, type, cont, strcont, cont1, strcont1) + call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, a:type, a:cont, a:strcont, a:cont1, a:strcont1)) + endfun + + command -nargs=? AR :call AppendRegContents(<q-args>) + + fun SetReg(...) + call call('setreg', a:000) + call append('$', printf('{{{2 setreg(%s)', string(a:000)[1:-2])) + call AppendRegContents(a:1) + if a:1 isnot# '=' + execute "silent normal! Go==\n==\e\"".a:1."P" + endif + endfun + ]]) + end) + before_each(clear) + teardown(function() + os.remove('test_eval_setup.vim') + end) + + it(':let', function() + execute('so test_eval_setup.vim') + execute([[let @" = 'abc']]) + execute('AR "') + execute([[let @" = "abc\n"]]) + source('AR "') + execute([[let @" = "abc\<C-m>"]]) + execute('AR "') + execute([[let @= = '"abc"']]) + execute('AR =') + expect([[ + + ": type v; value: abc (['abc']), expr: abc (['abc']) + ": type V; value: abc]].."\x00 (['abc']), expr: abc\x00"..[[ (['abc']) + ": type V; value: abc]].."\r\x00 (['abc\r']), expr: abc\r\x00 (['abc\r"..[[']) + =: type v; value: abc (['abc']), expr: "abc" (['"abc"'])]]) + end) + + it('basic setreg() tests', function() + execute('so test_eval_setup.vim') + insert('{{{1 Basic setreg tests') + execute([[call SetReg('a', 'abcA', 'c')]]) + execute([[call SetReg('b', 'abcB', 'v')]]) + execute([[call SetReg('c', 'abcC', 'l')]]) + execute([[call SetReg('d', 'abcD', 'V')]]) + execute([[call SetReg('e', 'abcE', 'b')]]) + execute([[call SetReg('f', 'abcF', "\<C-v>")]]) + execute([[call SetReg('g', 'abcG', 'b10')]]) + execute([[call SetReg('h', 'abcH', "\<C-v>10")]]) + execute([[call SetReg('I', 'abcI')]]) + + feed('Go{{{1 Appending single lines with setreg()<esc>') + execute([[call SetReg('A', 'abcAc', 'c')]]) + execute([[call SetReg('A', 'abcAl', 'l')]]) + execute([[call SetReg('A', 'abcAc2','c')]]) + execute([[call SetReg('b', 'abcBc', 'ca')]]) + execute([[call SetReg('b', 'abcBb', 'ba')]]) + execute([[call SetReg('b', 'abcBc2','ca')]]) + execute([[call SetReg('b', 'abcBb2','b50a')]]) + execute([[call SetReg('C', 'abcCl', 'l')]]) + execute([[call SetReg('C', 'abcCc', 'c')]]) + execute([[call SetReg('D', 'abcDb', 'b')]]) + execute([[call SetReg('E', 'abcEb', 'b')]]) + execute([[call SetReg('E', 'abcEl', 'l')]]) + execute([[call SetReg('F', 'abcFc', 'c')]]) + expect([[ + {{{1 Basic setreg tests + {{{2 setreg('a', 'abcA', 'c') + a: type v; value: abcA (['abcA']), expr: abcA (['abcA']) + == + =abcA= + {{{2 setreg('b', 'abcB', 'v') + b: type v; value: abcB (['abcB']), expr: abcB (['abcB']) + == + =abcB= + {{{2 setreg('c', 'abcC', 'l') + c: type V; value: abcC]].."\x00 (['abcC']), expr: abcC\x00"..[[ (['abcC']) + == + abcC + == + {{{2 setreg('d', 'abcD', 'V') + d: type V; value: abcD]].."\x00 (['abcD']), expr: abcD\x00"..[[ (['abcD']) + == + abcD + == + {{{2 setreg('e', 'abcE', 'b') + e: type ]]..'\x16'..[[4; value: abcE (['abcE']), expr: abcE (['abcE']) + == + =abcE= + {{{2 setreg('f', 'abcF', ']]..'\x16'..[[') + f: type ]]..'\x16'..[[4; value: abcF (['abcF']), expr: abcF (['abcF']) + == + =abcF= + {{{2 setreg('g', 'abcG', 'b10') + g: type ]]..'\x16'..[[10; value: abcG (['abcG']), expr: abcG (['abcG']) + == + =abcG = + {{{2 setreg('h', 'abcH', ']]..'\x16'..[[10') + h: type ]]..'\x16'..[[10; value: abcH (['abcH']), expr: abcH (['abcH']) + == + =abcH = + {{{2 setreg('I', 'abcI') + I: type v; value: abcI (['abcI']), expr: abcI (['abcI']) + == + =abcI= + {{{1 Appending single lines with setreg() + {{{2 setreg('A', 'abcAc', 'c') + A: type v; value: abcAabcAc (['abcAabcAc']), expr: abcAabcAc (['abcAabcAc']) + == + =abcAabcAc= + {{{2 setreg('A', 'abcAl', 'l') + A: type V; value: abcAabcAcabcAl]].."\x00 (['abcAabcAcabcAl']), expr: abcAabcAcabcAl\x00"..[[ (['abcAabcAcabcAl']) + == + abcAabcAcabcAl + == + {{{2 setreg('A', 'abcAc2', 'c') + A: type v; value: abcAabcAcabcAl]].."\x00abcAc2 (['abcAabcAcabcAl', 'abcAc2']), expr: abcAabcAcabcAl\x00"..[[abcAc2 (['abcAabcAcabcAl', 'abcAc2']) + == + =abcAabcAcabcAl + abcAc2= + {{{2 setreg('b', 'abcBc', 'ca') + b: type v; value: abcBabcBc (['abcBabcBc']), expr: abcBabcBc (['abcBabcBc']) + == + =abcBabcBc= + {{{2 setreg('b', 'abcBb', 'ba') + b: type ]]..'\x16'..[[5; value: abcBabcBcabcBb (['abcBabcBcabcBb']), expr: abcBabcBcabcBb (['abcBabcBcabcBb']) + == + =abcBabcBcabcBb= + {{{2 setreg('b', 'abcBc2', 'ca') + b: type v; value: abcBabcBcabcBb]].."\x00abcBc2 (['abcBabcBcabcBb', 'abcBc2']), expr: abcBabcBcabcBb\x00"..[[abcBc2 (['abcBabcBcabcBb', 'abcBc2']) + == + =abcBabcBcabcBb + abcBc2= + {{{2 setreg('b', 'abcBb2', 'b50a') + b: type ]].."\x1650; value: abcBabcBcabcBb\x00abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2']), expr: abcBabcBcabcBb\x00"..[[abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2']) + == + =abcBabcBcabcBb = + abcBc2abcBb2 + {{{2 setreg('C', 'abcCl', 'l') + C: type V; value: abcC]].."\x00abcCl\x00 (['abcC', 'abcCl']), expr: abcC\x00abcCl\x00"..[[ (['abcC', 'abcCl']) + == + abcC + abcCl + == + {{{2 setreg('C', 'abcCc', 'c') + C: type v; value: abcC]].."\x00abcCl\x00abcCc (['abcC', 'abcCl', 'abcCc']), expr: abcC\x00abcCl\x00"..[[abcCc (['abcC', 'abcCl', 'abcCc']) + == + =abcC + abcCl + abcCc= + {{{2 setreg('D', 'abcDb', 'b') + D: type ]].."\x165; value: abcD\x00abcDb (['abcD', 'abcDb']), expr: abcD\x00"..[[abcDb (['abcD', 'abcDb']) + == + =abcD = + abcDb + {{{2 setreg('E', 'abcEb', 'b') + E: type ]].."\x165; value: abcE\x00abcEb (['abcE', 'abcEb']), expr: abcE\x00"..[[abcEb (['abcE', 'abcEb']) + == + =abcE = + abcEb + {{{2 setreg('E', 'abcEl', 'l') + E: type V; value: abcE]].."\x00abcEb\x00abcEl\x00 (['abcE', 'abcEb', 'abcEl']), expr: abcE\x00abcEb\x00abcEl\x00"..[[ (['abcE', 'abcEb', 'abcEl']) + == + abcE + abcEb + abcEl + == + {{{2 setreg('F', 'abcFc', 'c') + F: type v; value: abcF]].."\x00abcFc (['abcF', 'abcFc']), expr: abcF\x00"..[[abcFc (['abcF', 'abcFc']) + == + =abcF + abcFc=]]) + end) + + it('appending NL with setreg()', function() + execute('so test_eval_setup.vim') + + execute([[call setreg('a', 'abcA2', 'c')]]) + execute([[call setreg('b', 'abcB2', 'v')]]) + execute([[call setreg('c', 'abcC2', 'l')]]) + execute([[call setreg('d', 'abcD2', 'V')]]) + execute([[call setreg('e', 'abcE2', 'b')]]) + execute([[call setreg('f', 'abcF2', "\<C-v>")]]) + -- These registers where set like this in the old test_eval.in but never + -- copied to the output buffer with SetReg(). They do not appear in + -- test_eval.ok. Therefore they are commented out. + --execute([[call setreg('g', 'abcG2', 'b10')]]) + --execute([[call setreg('h', 'abcH2', "\<C-v>10")]]) + --execute([[call setreg('I', 'abcI2')]]) + + execute([[call SetReg('A', "\n")]]) + execute([[call SetReg('B', "\n", 'c')]]) + execute([[call SetReg('C', "\n")]]) + execute([[call SetReg('D', "\n", 'l')]]) + execute([[call SetReg('E', "\n")]]) + execute([[call SetReg('F', "\n", 'b')]]) + expect([[ + + {{{2 setreg('A', ']]..'\x00'..[[') + A: type V; value: abcA2]].."\x00 (['abcA2']), expr: abcA2\x00"..[[ (['abcA2']) + == + abcA2 + == + {{{2 setreg('B', ']]..'\x00'..[[', 'c') + B: type v; value: abcB2]].."\x00 (['abcB2', '']), expr: abcB2\x00"..[[ (['abcB2', '']) + == + =abcB2 + = + {{{2 setreg('C', ']]..'\x00'..[[') + C: type V; value: abcC2]].."\x00\x00 (['abcC2', '']), expr: abcC2\x00\x00"..[[ (['abcC2', '']) + == + abcC2 + + == + {{{2 setreg('D', ']]..'\x00'..[[', 'l') + D: type V; value: abcD2]].."\x00\x00 (['abcD2', '']), expr: abcD2\x00\x00"..[[ (['abcD2', '']) + == + abcD2 + + == + {{{2 setreg('E', ']]..'\x00'..[[') + E: type V; value: abcE2]].."\x00\x00 (['abcE2', '']), expr: abcE2\x00\x00"..[[ (['abcE2', '']) + == + abcE2 + + == + {{{2 setreg('F', ']]..'\x00'..[[', 'b') + F: type ]].."\x160; value: abcF2\x00 (['abcF2', '']), expr: abcF2\x00"..[[ (['abcF2', '']) + == + =abcF2= + ]]) + end) + + it('setting and appending list with setreg()', function() + execute('so test_eval_setup.vim') + + execute([[$put ='{{{1 Setting lists with setreg()']]) + execute([=[call SetReg('a', ['abcA3'], 'c')]=]) + execute([=[call SetReg('b', ['abcB3'], 'l')]=]) + execute([=[call SetReg('c', ['abcC3'], 'b')]=]) + execute([=[call SetReg('d', ['abcD3'])]=]) + execute([=[call SetReg('e', [1, 2, 'abc', 3])]=]) + execute([=[call SetReg('f', [1, 2, 3])]=]) + + execute([[$put ='{{{1 Appending lists with setreg()']]) + execute([=[call SetReg('A', ['abcA3c'], 'c')]=]) + execute([=[call SetReg('b', ['abcB3l'], 'la')]=]) + execute([=[call SetReg('C', ['abcC3b'], 'lb')]=]) + execute([=[call SetReg('D', ['abcD32'])]=]) + execute([=[call SetReg('A', ['abcA32'])]=]) + execute([=[call SetReg('B', ['abcB3c'], 'c')]=]) + execute([=[call SetReg('C', ['abcC3l'], 'l')]=]) + execute([=[call SetReg('D', ['abcD3b'], 'b')]=]) + expect([[ + + {{{1 Setting lists with setreg() + {{{2 setreg('a', ['abcA3'], 'c') + a: type v; value: abcA3 (['abcA3']), expr: abcA3 (['abcA3']) + == + =abcA3= + {{{2 setreg('b', ['abcB3'], 'l') + b: type V; value: abcB3]].."\x00 (['abcB3']), expr: abcB3\x00"..[[ (['abcB3']) + == + abcB3 + == + {{{2 setreg('c', ['abcC3'], 'b') + c: type ]]..'\x16'..[[5; value: abcC3 (['abcC3']), expr: abcC3 (['abcC3']) + == + =abcC3= + {{{2 setreg('d', ['abcD3']) + d: type V; value: abcD3]].."\x00 (['abcD3']), expr: abcD3\x00"..[[ (['abcD3']) + == + abcD3 + == + {{{2 setreg('e', [1, 2, 'abc', 3]) + e: type V; value: 1]].."\x002\x00abc\x003\x00 (['1', '2', 'abc', '3']), expr: 1\x002\x00abc\x003\x00"..[[ (['1', '2', 'abc', '3']) + == + 1 + 2 + abc + 3 + == + {{{2 setreg('f', [1, 2, 3]) + f: type V; value: 1]].."\x002\x003\x00 (['1', '2', '3']), expr: 1\x002\x003\x00"..[[ (['1', '2', '3']) + == + 1 + 2 + 3 + == + {{{1 Appending lists with setreg() + {{{2 setreg('A', ['abcA3c'], 'c') + A: type v; value: abcA3]].."\x00abcA3c (['abcA3', 'abcA3c']), expr: abcA3\x00"..[[abcA3c (['abcA3', 'abcA3c']) + == + =abcA3 + abcA3c= + {{{2 setreg('b', ['abcB3l'], 'la') + b: type V; value: abcB3]].."\x00abcB3l\x00 (['abcB3', 'abcB3l']), expr: abcB3\x00abcB3l\x00"..[[ (['abcB3', 'abcB3l']) + == + abcB3 + abcB3l + == + {{{2 setreg('C', ['abcC3b'], 'lb') + C: type ]].."\x166; value: abcC3\x00abcC3b (['abcC3', 'abcC3b']), expr: abcC3\x00"..[[abcC3b (['abcC3', 'abcC3b']) + == + =abcC3 = + abcC3b + {{{2 setreg('D', ['abcD32']) + D: type V; value: abcD3]].."\x00abcD32\x00 (['abcD3', 'abcD32']), expr: abcD3\x00abcD32\x00"..[[ (['abcD3', 'abcD32']) + == + abcD3 + abcD32 + == + {{{2 setreg('A', ['abcA32']) + A: type V; value: abcA3]].."\x00abcA3c\x00abcA32\x00 (['abcA3', 'abcA3c', 'abcA32']), expr: abcA3\x00abcA3c\x00abcA32\x00"..[[ (['abcA3', 'abcA3c', 'abcA32']) + == + abcA3 + abcA3c + abcA32 + == + {{{2 setreg('B', ['abcB3c'], 'c') + B: type v; value: abcB3]].."\x00abcB3l\x00abcB3c (['abcB3', 'abcB3l', 'abcB3c']), expr: abcB3\x00abcB3l\x00"..[[abcB3c (['abcB3', 'abcB3l', 'abcB3c']) + == + =abcB3 + abcB3l + abcB3c= + {{{2 setreg('C', ['abcC3l'], 'l') + C: type V; value: abcC3]].."\x00abcC3b\x00abcC3l\x00 (['abcC3', 'abcC3b', 'abcC3l']), expr: abcC3\x00abcC3b\x00abcC3l\x00"..[[ (['abcC3', 'abcC3b', 'abcC3l']) + == + abcC3 + abcC3b + abcC3l + == + {{{2 setreg('D', ['abcD3b'], 'b') + D: type ]].."\x166; value: abcD3\x00abcD32\x00abcD3b (['abcD3', 'abcD32', 'abcD3b']), expr: abcD3\x00abcD32\x00"..[[abcD3b (['abcD3', 'abcD32', 'abcD3b']) + == + =abcD3 = + abcD32 + abcD3b]]) + + -- From now on we delete the buffer contents after each expect() to make + -- the next expect() easier to write. This is neccessary because null + -- bytes on a line by itself don't play well together with the dedent + -- function used in expect(). + execute('%delete') + execute([[$put ='{{{1 Appending lists with NL with setreg()']]) + execute([=[call SetReg('A', ["\n", 'abcA3l2'], 'l')]=]) + expect( + '\n'.. + '{{{1 Appending lists with NL with setreg()\n'.. + "{{{2 setreg('A', ['\x00', 'abcA3l2'], 'l')\n".. + "A: type V; value: abcA3\x00abcA3c\x00abcA32\x00\x00\x00abcA3l2\x00 (['abcA3', 'abcA3c', 'abcA32', '\x00', 'abcA3l2']), expr: abcA3\x00abcA3c\x00abcA32\x00\x00\x00abcA3l2\x00 (['abcA3', 'abcA3c', 'abcA32', '\x00', 'abcA3l2'])\n".. + '==\n'.. + 'abcA3\n'.. + 'abcA3c\n'.. + 'abcA32\n'.. + '\x00\n'.. + 'abcA3l2\n'.. + '==') + execute('%delete') + execute([=[call SetReg('B', ["\n", 'abcB3c2'], 'c')]=]) + expect( + '\n'.. + "{{{2 setreg('B', ['\x00', 'abcB3c2'], 'c')\n".. + "B: type v; value: abcB3\x00abcB3l\x00abcB3c\x00\x00\x00abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\x00', 'abcB3c2']), expr: abcB3\x00abcB3l\x00abcB3c\x00\x00\x00abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\x00', 'abcB3c2'])\n".. + '==\n'.. + '=abcB3\n'.. + 'abcB3l\n'.. + 'abcB3c\n'.. + '\x00\n'.. + 'abcB3c2=') + execute('%delete') + execute([=[call SetReg('C', ["\n", 'abcC3b2'], 'b')]=]) + expect( + '\n'.. + "{{{2 setreg('C', ['\x00', 'abcC3b2'], 'b')\n".. + "C: type \x167; value: abcC3\x00abcC3b\x00abcC3l\x00\x00\x00abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\x00', 'abcC3b2']), expr: abcC3\x00abcC3b\x00abcC3l\x00\x00\x00abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\x00', 'abcC3b2'])\n".. + '==\n'.. + '=abcC3 =\n'.. + ' abcC3b\n'.. + ' abcC3l\n'.. + ' \x00\n'.. + ' abcC3b2') + execute('%delete') + execute([=[call SetReg('D', ["\n", 'abcD3b50'],'b50')]=]) + expect( + '\n'.. + "{{{2 setreg('D', ['\x00', 'abcD3b50'], 'b50')\n".. + "D: type \x1650; value: abcD3\x00abcD32\x00abcD3b\x00\x00\x00abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\x00', 'abcD3b50']), expr: abcD3\x00abcD32\x00abcD3b\x00\x00\x00abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\x00', 'abcD3b50'])\n".. + '==\n'.. + '=abcD3 =\n'.. + ' abcD32\n'.. + ' abcD3b\n'.. + ' \x00\n'.. + ' abcD3b50') + end) + + -- The tests for setting lists with NLs are split into seperate it() blocks + -- to make the expect() calls easier to write. Otherwise the null byte can + -- make trouble on a line on its own. + it('setting lists with NLs with setreg(), part 1', function() + execute('so test_eval_setup.vim') + execute([=[call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])]=]) + expect( + '\n'.. + "{{{2 setreg('a', ['abcA4-0', '\x00', 'abcA4-2\x00', '\x00abcA4-3', 'abcA4-4\x00abcA4-4-2'])\n".. + "a: type V; value: abcA4-0\x00\x00\x00abcA4-2\x00\x00\x00abcA4-3\x00abcA4-4\x00abcA4-4-2\x00 (['abcA4-0', '\x00', 'abcA4-2\x00', '\x00abcA4-3', 'abcA4-4\x00abcA4-4-2']), expr: abcA4-0\x00\x00\x00abcA4-2\x00\x00\x00abcA4-3\x00abcA4-4\x00abcA4-4-2\x00 (['abcA4-0', '\x00', 'abcA4-2\x00', '\x00abcA4-3', 'abcA4-4\x00abcA4-4-2'])\n".. + '==\n'.. + 'abcA4-0\n'.. + '\x00\n'.. + 'abcA4-2\x00\n'.. + '\x00abcA4-3\n'.. + 'abcA4-4\x00abcA4-4-2\n'.. + '==') + end) + + it('setting lists with NLs with setreg(), part 2', function() + execute('so test_eval_setup.vim') + execute([=[call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')]=]) + expect( + '\n'.. + "{{{2 setreg('b', ['abcB4c-0', '\x00', 'abcB4c-2\x00', '\x00abcB4c-3', 'abcB4c-4\x00abcB4c-4-2'], 'c')\n".. + "b: type v; value: abcB4c-0\x00\x00\x00abcB4c-2\x00\x00\x00abcB4c-3\x00abcB4c-4\x00abcB4c-4-2 (['abcB4c-0', '\x00', 'abcB4c-2\x00', '\x00abcB4c-3', 'abcB4c-4\x00abcB4c-4-2']), expr: abcB4c-0\x00\x00\x00abcB4c-2\x00\x00\x00abcB4c-3\x00abcB4c-4\x00abcB4c-4-2 (['abcB4c-0', '\x00', 'abcB4c-2\x00', '\x00abcB4c-3', 'abcB4c-4\x00abcB4c-4-2'])\n".. + '==\n'.. + '=abcB4c-0\n'.. + '\x00\n'.. + 'abcB4c-2\x00\n'.. + '\x00abcB4c-3\n'.. + 'abcB4c-4\x00abcB4c-4-2=') + end) + + it('setting lists with NLs with setreg(), part 3', function() + execute('so test_eval_setup.vim') + execute([=[call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')]=]) + expect( + '\n'.. + "{{{2 setreg('c', ['abcC4l-0', '\x00', 'abcC4l-2\x00', '\x00abcC4l-3', 'abcC4l-4\x00abcC4l-4-2'], 'l')\n".. + "c: type V; value: abcC4l-0\x00\x00\x00abcC4l-2\x00\x00\x00abcC4l-3\x00abcC4l-4\x00abcC4l-4-2\x00 (['abcC4l-0', '\x00', 'abcC4l-2\x00', '\x00abcC4l-3', 'abcC4l-4\x00abcC4l-4-2']), expr: abcC4l-0\x00\x00\x00abcC4l-2\x00\x00\x00abcC4l-3\x00abcC4l-4\x00abcC4l-4-2\x00 (['abcC4l-0', '\x00', 'abcC4l-2\x00', '\x00abcC4l-3', 'abcC4l-4\x00abcC4l-4-2'])\n".. + '==\n'.. + 'abcC4l-0\n'.. + '\x00\n'.. + 'abcC4l-2\x00\n'.. + '\x00abcC4l-3\n'.. + 'abcC4l-4\x00abcC4l-4-2\n'.. + '==') + end) + it('setting lists with NLs with setreg(), part 4', function() + execute('so test_eval_setup.vim') + execute([=[call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')]=]) + expect( + '\n'.. + "{{{2 setreg('d', ['abcD4b-0', '\x00', 'abcD4b-2\x00', '\x00abcD4b-3', 'abcD4b-4\x00abcD4b-4-2'], 'b')\n".. + "d: type \x1619; value: abcD4b-0\x00\x00\x00abcD4b-2\x00\x00\x00abcD4b-3\x00abcD4b-4\x00abcD4b-4-2 (['abcD4b-0', '\x00', 'abcD4b-2\x00', '\x00abcD4b-3', 'abcD4b-4\x00abcD4b-4-2']), expr: abcD4b-0\x00\x00\x00abcD4b-2\x00\x00\x00abcD4b-3\x00abcD4b-4\x00abcD4b-4-2 (['abcD4b-0', '\x00', 'abcD4b-2\x00', '\x00abcD4b-3', 'abcD4b-4\x00abcD4b-4-2'])\n".. + '==\n'.. + '=abcD4b-0 =\n'.. + ' \x00\n'.. + ' abcD4b-2\x00\n'.. + ' \x00abcD4b-3\n'.. + ' abcD4b-4\x00abcD4b-4-2') + end) + it('setting lists with NLs with setreg(), part 5', function() + execute('so test_eval_setup.vim') + execute([=[call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')]=]) + expect( + '\n'.. + "{{{2 setreg('e', ['abcE4b10-0', '\x00', 'abcE4b10-2\x00', '\x00abcE4b10-3', 'abcE4b10-4\x00abcE4b10-4-2'], 'b10')\n".. + "e: type \x1610; value: abcE4b10-0\x00\x00\x00abcE4b10-2\x00\x00\x00abcE4b10-3\x00abcE4b10-4\x00abcE4b10-4-2 (['abcE4b10-0', '\x00', 'abcE4b10-2\x00', '\x00abcE4b10-3', 'abcE4b10-4\x00abcE4b10-4-2']), expr: abcE4b10-0\x00\x00\x00abcE4b10-2\x00\x00\x00abcE4b10-3\x00abcE4b10-4\x00abcE4b10-4-2 (['abcE4b10-0', '\x00', 'abcE4b10-2\x00', '\x00abcE4b10-3', 'abcE4b10-4\x00abcE4b10-4-2'])\n".. + '==\n'.. + '=abcE4b10-0=\n'.. + ' \x00\n'.. + ' abcE4b10-2\x00\n'.. + ' \x00abcE4b10-3\n'.. + ' abcE4b10-4\x00abcE4b10-4-2') + end) + + it('search and expressions', function() + execute('so test_eval_setup.vim') + execute([=[call SetReg('/', ['abc/'])]=]) + execute([=[call SetReg('/', ["abc/\n"])]=]) + execute([=[call SetReg('=', ['"abc/"'])]=]) + execute([=[call SetReg('=', ["\"abc/\n\""])]=]) + expect([[ + + {{{2 setreg('/', ['abc/']) + /: type v; value: abc/ (['abc/']), expr: abc/ (['abc/']) + == + =abc/= + {{{2 setreg('/', ['abc/]]..'\x00'..[[']) + /: type v; value: abc/]].."\x00 (['abc/\x00']), expr: abc/\x00 (['abc/\x00"..[[']) + == + =abc/]]..'\x00'..[[= + {{{2 setreg('=', ['"abc/"']) + =: type v; value: abc/ (['abc/']), expr: "abc/" (['"abc/"']) + {{{2 setreg('=', ['"abc/]]..'\x00'..[["']) + =: type v; value: abc/]].."\x00 (['abc/\x00"..[[']), expr: "abc/]]..'\x00'..[[" (['"abc/]]..'\x00'..[["'])]]) + end) + + if has_clipboard() then + it('system clipboard', function() + insert([[ + Some first line (this text was at the top of the old test_eval.in). + + Note: system clipboard is saved, changed and restored. + + clipboard contents + something else]]) + execute('so test_eval_setup.vim') + -- Save and restore system clipboard. + execute("let _clipreg = ['*', getreg('*'), getregtype('*')]") + execute('let _clipopt = &cb') + execute("let &cb='unnamed'") + execute('5y') + execute('AR *') + execute('tabdo :windo :echo "hi"') + execute('6y') + execute('AR *') + execute('let &cb=_clipopt') + execute("call call('setreg', _clipreg)") + expect([[ + Some first line (this text was at the top of the old test_eval.in). + + Note: system clipboard is saved, changed and restored. + + clipboard contents + something else + *: type V; value: clipboard contents]]..'\00'..[[ (['clipboard contents']), expr: clipboard contents]]..'\00'..[[ (['clipboard contents']) + *: type V; value: something else]]..'\00'..[[ (['something else']), expr: something else]]..'\00'..[[ (['something else'])]]) + end) + else + pending('system clipboard not available', function() end) + end + + it('errors', function() + source([[ + fun ErrExe(str) + call append('$', 'Executing '.a:str) + try + execute a:str + catch + $put =v:exception + endtry + endfun]]) + execute([[call ErrExe('call setreg()')]]) + execute([[call ErrExe('call setreg(1)')]]) + execute([[call ErrExe('call setreg(1, 2, 3, 4)')]]) + execute([=[call ErrExe('call setreg([], 2)')]=]) + execute([[call ErrExe('call setreg(1, {})')]]) + execute([=[call ErrExe('call setreg(1, 2, [])')]=]) + execute([=[call ErrExe('call setreg("/", ["1", "2"])')]=]) + execute([=[call ErrExe('call setreg("=", ["1", "2"])')]=]) + execute([=[call ErrExe('call setreg(1, ["", "", [], ""])')]=]) + expect([[ + + Executing call setreg() + Vim(call):E119: Not enough arguments for function: setreg + Executing call setreg(1) + Vim(call):E119: Not enough arguments for function: setreg + Executing call setreg(1, 2, 3, 4) + Vim(call):E118: Too many arguments for function: setreg + Executing call setreg([], 2) + Vim(call):E730: using List as a String + Executing call setreg(1, {}) + Vim(call):E731: using Dictionary as a String + Executing call setreg(1, 2, []) + Vim(call):E730: using List as a String + Executing call setreg("/", ["1", "2"]) + Vim(call):E883: search pattern and expression register may not contain two or more lines + Executing call setreg("=", ["1", "2"]) + Vim(call):E883: search pattern and expression register may not contain two or more lines + Executing call setreg(1, ["", "", [], ""]) + Vim(call):E730: using List as a String]]) + end) + + it('function name not starting with a capital', function() + execute('try') + execute(' func! g:test()') + execute(' echo "test"') + execute(' endfunc') + execute('catch') + execute(' let tmp = v:exception') + execute('endtry') + eq('Vim(function):E128: Function name must start with a capital or "s:": g:test()', eval('tmp')) + end) + + it('Function name followed by #', function() + execute('try') + execute(' func! test2() "#') + execute(' echo "test2"') + execute(' endfunc') + execute('catch') + execute(' let tmp = v:exception') + execute('endtry') + eq('Vim(function):E128: Function name must start with a capital or "s:": test2() "#', eval('tmp')) + end) + + it('function name includes a colon', function() + execute('try') + execute(' func! b:test()') + execute(' echo "test"') + execute(' endfunc') + execute('catch') + execute(' let tmp = v:exception') + execute('endtry') + eq('Vim(function):E128: Function name must start with a capital or "s:": b:test()', eval('tmp')) + end) + + it('function name starting with/without "g:", buffer-local funcref', function() + execute('function! g:Foo(n)') + execute(" $put ='called Foo(' . a:n . ')'") + execute('endfunction') + execute("let b:my_func = function('Foo')") + execute('call b:my_func(1)') + execute('echo g:Foo(2)') + execute('echo Foo(3)') + expect([[ + + called Foo(1) + called Foo(2) + called Foo(3)]]) + end) + + it('script-local function used in Funcref must exist', function() + source([[ + " Vim script used in test_eval.in. Needed for script-local function. + + func! s:Testje() + return "foo" + endfunc + + let Bar = function('s:Testje') + + $put ='s:Testje exists: ' . exists('s:Testje') + $put ='func s:Testje exists: ' . exists('*s:Testje') + $put ='Bar exists: ' . exists('Bar') + $put ='func Bar exists: ' . exists('*Bar') + ]]) + expect([[ + + s:Testje exists: 0 + func s:Testje exists: 1 + Bar exists: 1 + func Bar exists: 1]]) + end) + + it("using $ instead of '$' must give an error", function() + execute('try') + execute(" call append($, 'foobar')") + execute('catch') + execute(' let tmp = v:exception') + execute('endtry') + eq('Vim(call):E116: Invalid arguments for function append', eval('tmp')) + end) + + it('getcurpos/setpos', function() + insert([[ + 012345678 + 012345678 + + start:]]) + execute('/^012345678') + feed('6l') + execute('let sp = getcurpos()') + feed('0') + execute("call setpos('.', sp)") + feed('jyl') + execute('$put') + expect([[ + 012345678 + 012345678 + + start: + 6]]) + end) +end) diff --git a/test/functional/legacy/glob2regpat_spec.lua b/test/functional/legacy/glob2regpat_spec.lua new file mode 100644 index 0000000000..357128bcb6 --- /dev/null +++ b/test/functional/legacy/glob2regpat_spec.lua @@ -0,0 +1,22 @@ +-- Tests for signs + +local helpers = require('test.functional.helpers') +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect +local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval + +describe('glob2regpat()', function() + before_each(clear) + + it('handles invalid input', function() + execute('call glob2regpat(1.33)') + helpers.feed('<cr>') + neq(nil, string.find(eval('v:errmsg'), '^E806:')) + end) + it('returns ^$ for empty input', function() + eq('^$', eval("glob2regpat('')")) + end) + it('handles valid input', function() + eq('^foo\\.', eval("glob2regpat('foo.*')")) + eq('\\.vim$', eval("glob2regpat('*.vim')")) + end) +end) diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua new file mode 100644 index 0000000000..7a9958b949 --- /dev/null +++ b/test/functional/legacy/quickfix_spec.lua @@ -0,0 +1,18 @@ +-- Test for the quickfix commands. + +local helpers = require('test.functional.helpers') +local insert, source = helpers.insert, helpers.source +local clear, expect = helpers.clear, helpers.expect + +describe('helpgrep', function() + before_each(clear) + + it('works', function() + source([[ + helpgrep quickfix + copen + " This wipes out the buffer, make sure that doesn't cause trouble. + cclose + ]]) + end) +end) |