aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/eval.txt25
-rw-r--r--src/nvim/CMakeLists.txt5
-rw-r--r--src/nvim/eval.c8
-rw-r--r--src/nvim/ex_cmds.lua2
-rw-r--r--src/nvim/testdir/test_syntax.vim39
-rw-r--r--src/nvim/testdir/test_vimscript.vim56
-rw-r--r--src/nvim/version.c1
-rw-r--r--test/functional/ui/inccommand_spec.lua18
8 files changed, 134 insertions, 20 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7820b85bf4..8771604c89 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -7602,17 +7602,20 @@ synIDtrans({synID}) *synIDtrans()*
":highlight link" are followed.
synconcealed({lnum}, {col}) *synconcealed()*
- The result is a List. The first item in the list is 0 if the
- character at the position {lnum} and {col} is not part of a
- concealable region, 1 if it is. The second item in the list is
- a string. If the first item is 1, the second item contains the
- text which will be displayed in place of the concealed text,
- depending on the current setting of 'conceallevel'. The third
- and final item in the list is a unique number representing the
- specific syntax region matched. This allows detection of the
- beginning of a new concealable region if there are two
- consecutive regions with the same replacement character.
- For an example use see $VIMRUNTIME/syntax/2html.vim .
+ The result is a List with currently three items:
+ 1. The first item in the list is 0 if the character at the
+ position {lnum} and {col} is not part of a concealable
+ region, 1 if it is.
+ 2. The second item in the list is a string. If the first item
+ is 1, the second item contains the text which will be
+ displayed in place of the concealed text, depending on the
+ current setting of 'conceallevel' and 'listchars'.
+ 3. The third and final item in the list is a unique number
+ representing the specific syntax region matched. This
+ allows detection of the beginning of a new concealable
+ region if there are two consecutive regions with the same
+ replacement character. For an example use see
+ $VIMRUNTIME/syntax/2html.vim .
synstack({lnum}, {col}) *synstack()*
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 7eb1afa135..b14f93f90a 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -14,6 +14,7 @@ if(WIN32)
# tell MinGW compiler to enable wmain
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -municode")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -iframework CoreFoundation")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreFoundation")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -framework CoreFoundation")
endif()
@@ -187,6 +188,10 @@ get_directory_property(gen_includes INCLUDE_DIRECTORIES)
foreach(gen_include ${gen_includes} ${LUA_PREFERRED_INCLUDE_DIRS})
list(APPEND gen_cflags "-I${gen_include}")
endforeach()
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT)
+ list(APPEND gen_cflags "-isysroot")
+ list(APPEND gen_cflags "${CMAKE_OSX_SYSROOT}")
+endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
separate_arguments(C_FLAGS_ARRAY UNIX_COMMAND ${CMAKE_C_FLAGS})
separate_arguments(C_FLAGS_${build_type}_ARRAY UNIX_COMMAND ${CMAKE_C_FLAGS_${build_type}})
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 28c590c0b4..f663d13c55 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -16274,8 +16274,8 @@ static void f_synconcealed(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// get the conceal character
if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3) {
cchar = syn_get_sub_char();
- if (cchar == NUL && curwin->w_p_cole == 1 && lcs_conceal != NUL) {
- cchar = lcs_conceal;
+ if (cchar == NUL && curwin->w_p_cole == 1) {
+ cchar = (lcs_conceal == NUL) ? ' ' : lcs_conceal;
}
if (cchar != NUL) {
utf_char2bytes(cchar, str);
@@ -20863,7 +20863,9 @@ void ex_delfunction(exarg_T *eap)
if (!eap->skip) {
if (fp == NULL) {
- EMSG2(_(e_nofunc), eap->arg);
+ if (!eap->forceit) {
+ EMSG2(_(e_nofunc), eap->arg);
+ }
return;
}
if (fp->uf_calls > 0) {
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
index e57e662039..c8593f7460 100644
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -692,7 +692,7 @@ return {
},
{
command='delcommand',
- flags=bit.bor(NEEDARG, WORD1, TRLBAR, CMDWIN),
+ flags=bit.bor(BANG, NEEDARG, WORD1, TRLBAR, CMDWIN),
addr_type=ADDR_LINES,
func='ex_delcommand',
},
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
index 6456ca2b23..366a6ee1e2 100644
--- a/src/nvim/testdir/test_syntax.vim
+++ b/src/nvim/testdir/test_syntax.vim
@@ -1,5 +1,7 @@
" Test for syntax and syntax iskeyword option
+source view_util.vim
+
func GetSyntaxItem(pat)
let c = ''
let a = ['a', getreg('a'), getregtype('a')]
@@ -340,3 +342,40 @@ func Test_invalid_name()
hi clear Nop
hi clear @Wrong
endfunc
+
+
+func Test_conceal()
+ if !has('conceal')
+ return
+ endif
+
+ new
+ call setline(1, ['', '123456'])
+ syn match test23 "23" conceal cchar=X
+ syn match test45 "45" conceal
+
+ set conceallevel=0
+ call assert_equal('123456 ', ScreenLines(2, 7)[0])
+ call assert_equal([[0, ''], [0, ''], [0, ''], [0, ''], [0, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
+
+ set conceallevel=1
+ call assert_equal('1X 6 ', ScreenLines(2, 7)[0])
+ call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ' '], [1, ' '], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
+
+ set conceallevel=1
+ set listchars=conceal:Y
+ call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, 'Y'], [1, 'Y'], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
+ call assert_equal('1XY6 ', ScreenLines(2, 7)[0])
+
+ set conceallevel=2
+ call assert_match('1X6 ', ScreenLines(2, 7)[0])
+ call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
+
+ set conceallevel=3
+ call assert_match('16 ', ScreenLines(2, 7)[0])
+ call assert_equal([[0, ''], [1, ''], [1, ''], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
+
+ syn clear
+ set conceallevel&
+ bw!
+endfunc
diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim
index 4e0f1bbd2f..c449fc91b0 100644
--- a/src/nvim/testdir/test_vimscript.vim
+++ b/src/nvim/testdir/test_vimscript.vim
@@ -1215,6 +1215,62 @@ func Test_bitwise_functions()
call assert_fails("call invert({})", 'E728:')
endfunc
+" Test trailing text after :endfunction {{{1
+func Test_endfunction_trailing()
+ call assert_false(exists('*Xtest'))
+
+ exe "func Xtest()\necho 'hello'\nendfunc\nlet done = 'yes'"
+ call assert_true(exists('*Xtest'))
+ call assert_equal('yes', done)
+ delfunc Xtest
+ unlet done
+
+ exe "func Xtest()\necho 'hello'\nendfunc|let done = 'yes'"
+ call assert_true(exists('*Xtest'))
+ call assert_equal('yes', done)
+ delfunc Xtest
+ unlet done
+
+ " trailing line break
+ exe "func Xtest()\necho 'hello'\nendfunc\n"
+ call assert_true(exists('*Xtest'))
+ delfunc Xtest
+
+ set verbose=1
+ exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
+ call assert_true(exists('*Xtest'))
+ delfunc Xtest
+
+ call assert_fails("func Xtest()\necho 'hello'\nendfunc garbage", 'E946')
+ call assert_true(exists('*Xtest'))
+ delfunc Xtest
+ set verbose=0
+
+ function Foo()
+ echo 'hello'
+ endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
+ delfunc Foo
+endfunc
+
+func Test_delfunction_force()
+ delfunc! Xtest
+ delfunc! Xtest
+ func Xtest()
+ echo 'nothing'
+ endfunc
+ delfunc! Xtest
+ delfunc! Xtest
+endfunc
+
+" Test using bang after user command {{{1
+func Test_user_command_with_bang()
+ command -bang Nieuw let nieuw = 1
+ Ni!
+ call assert_equal(1, nieuw)
+ unlet nieuw
+ delcommand Nieuw
+endfunc
+
"-------------------------------------------------------------------------------
" Modelines {{{1
" vim: ts=8 sw=4 tw=80 fdm=marker
diff --git a/src/nvim/version.c b/src/nvim/version.c
index fd6347282d..ed6dc0fb2a 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -1498,6 +1498,7 @@ static const int included_patches[] = {
2,
1,
0,
+
};
// clang-format on
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 4a8ebf6212..74ab9864f0 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -12,6 +12,7 @@ local insert = helpers.insert
local meths = helpers.meths
local neq = helpers.neq
local ok = helpers.ok
+local retry = helpers.retry
local source = helpers.source
local wait = helpers.wait
local nvim = helpers.nvim
@@ -91,22 +92,30 @@ local function common_setup(screen, inccommand, text)
end
end
-describe(":substitute, inccommand=split does not trigger preview", function()
+describe(":substitute, inccommand=split", function()
before_each(function()
clear()
common_setup(nil, "split", default_text)
end)
- it("if invoked by a script ", function()
+ -- Test the tests: verify that the `1==bufnr('$')` assertion
+ -- in the "no preview" tests (below) actually means something.
+ it("previews interactive cmdline", function()
+ feed(':%s/tw/MO/g')
+ retry(nil, 1000, function()
+ eq(2, eval("bufnr('$')"))
+ end)
+ end)
+
+ it("no preview if invoked by a script", function()
source('%s/tw/MO/g')
wait()
eq(1, eval("bufnr('$')"))
-
-- sanity check: assert the buffer state
expect(default_text:gsub("tw", "MO"))
end)
- it("if invoked by feedkeys()", function()
+ it("no preview if invoked by feedkeys()", function()
-- in a script...
source([[:call feedkeys(":%s/tw/MO/g\<CR>")]])
wait()
@@ -114,7 +123,6 @@ describe(":substitute, inccommand=split does not trigger preview", function()
feed([[:call feedkeys(":%s/tw/MO/g\<CR>")<CR>]])
wait()
eq(1, eval("bufnr('$')"))
-
-- sanity check: assert the buffer state
expect(default_text:gsub("tw", "MO"))
end)