aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.ci/common/build.sh3
-rw-r--r--.ci/common/test.sh2
-rw-r--r--.travis.yml5
-rw-r--r--CMakeLists.txt19
-rw-r--r--Makefile10
-rw-r--r--runtime/autoload/provider/pythonx.vim26
-rw-r--r--runtime/autoload/provider/ruby.vim34
-rw-r--r--runtime/autoload/remote/host.vim69
-rw-r--r--runtime/macros/less.bat4
-rwxr-xr-xruntime/macros/less.sh4
-rw-r--r--runtime/plugin/rplugin.vim15
-rw-r--r--src/nvim/CMakeLists.txt1
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/diff.c4
-rw-r--r--src/nvim/edit.c4
-rw-r--r--src/nvim/ex_cmds.c8
-rw-r--r--src/nvim/ex_eval.c2
-rw-r--r--src/nvim/ex_getln.c27
-rw-r--r--src/nvim/fold.c4
-rw-r--r--src/nvim/globals.h4
-rw-r--r--src/nvim/ops.c37
-rw-r--r--src/nvim/quickfix.c292
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test88.in99
-rw-r--r--src/nvim/testdir/test88.ok29
-rw-r--r--src/nvim/version.c3
-rw-r--r--test/functional/api/vim_spec.lua4
-rw-r--r--test/functional/helpers.lua39
-rw-r--r--test/functional/legacy/036_regexp_character_classes_spec.lua10
-rw-r--r--test/functional/legacy/039_visual_block_mode_commands_spec.lua2
-rw-r--r--test/functional/legacy/061_undo_tree_spec.lua2
-rw-r--r--test/functional/legacy/083_tag_search_with_file_encoding_spec.lua4
-rw-r--r--test/functional/legacy/088_conceal_tabs_spec.lua96
-rw-r--r--test/functional/legacy/eval_spec.lua186
-rw-r--r--test/functional/plugin/msgpack_spec.lua37
-rw-r--r--test/functional/preload.lua1
-rw-r--r--test/functional/server/server_spec.lua4
-rw-r--r--test/functional/terminal/tui_spec.lua36
-rw-r--r--test/functional/viml/completion_spec.lua6
-rw-r--r--third-party/CMakeLists.txt10
-rw-r--r--third-party/cmake/BuildLua.cmake85
42 files changed, 699 insertions, 533 deletions
diff --git a/.ci/common/build.sh b/.ci/common/build.sh
index f635ee4960..06bdab707f 100644
--- a/.ci/common/build.sh
+++ b/.ci/common/build.sh
@@ -5,6 +5,9 @@ build_deps() {
if [[ "${BUILD_MINGW}" == ON ]]; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_MINGW}"
fi
+ if [[ "${FUNCTIONALTEST}" == "functionaltest-lua" ]]; then
+ DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
+ fi
rm -rf "${DEPS_BUILD_DIR}"
diff --git a/.ci/common/test.sh b/.ci/common/test.sh
index c1bbd8dc9a..8c32b63ab2 100644
--- a/.ci/common/test.sh
+++ b/.ci/common/test.sh
@@ -53,7 +53,7 @@ run_unittests() {
}
run_functionaltests() {
- if ! ${MAKE_CMD} -C "${BUILD_DIR}" functionaltest; then
+ if ! ${MAKE_CMD} -C "${BUILD_DIR}" ${FUNCTIONALTEST}; then
asan_check "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
exit 1
diff --git a/.travis.yml b/.travis.yml
index 10219690b3..985a5c5381 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -53,6 +53,8 @@ env:
# if the tests were successful, but don't have this information
# available in before_cache (which is run before after_success).
- SUCCESS_MARKER="$BUILD_DIR/.tests_successful"
+ # default target name for functional tests
+ - FUNCTIONALTEST=functionaltest
matrix:
include:
@@ -61,6 +63,9 @@ matrix:
- os: linux
compiler: gcc-5
- os: linux
+ compiler: gcc-5
+ env: FUNCTIONALTEST=functionaltest-lua
+ - os: linux
# Travis creates a cache per compiler.
# Set a different value here to store 32-bit
# dependencies in a separate cache.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3dbe98ab67..07557c6580 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 2.8.7)
project(nvim)
+if(POLICY CMP0059)
+ cmake_policy(SET CMP0059 OLD) # Needed until cmake 2.8.12. #4389
+endif()
+
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@@ -390,6 +394,7 @@ message(STATUS "Using the Lua interpreter ${LUA_PRG}.")
# Setup busted.
find_program(BUSTED_PRG busted)
+find_program(BUSTED_LUA_PRG busted-lua)
if(NOT BUSTED_OUTPUT_TYPE)
set(BUSTED_OUTPUT_TYPE "utfTerminal")
endif()
@@ -501,6 +506,20 @@ if(BUSTED_PRG)
DEPENDS ${BENCHMARK_PREREQS})
endif()
+if(BUSTED_LUA_PRG)
+ add_custom_target(functionaltest-lua
+ COMMAND ${CMAKE_COMMAND}
+ -DBUSTED_PRG=${BUSTED_LUA_PRG}
+ -DNVIM_PRG=$<TARGET_FILE:nvim>
+ -DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
+ -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
+ -DBUILD_DIR=${CMAKE_BINARY_DIR}
+ -DTEST_TYPE=functional
+ -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
+ DEPENDS ${FUNCTIONALTEST_PREREQS})
+endif()
+
if(LUACHECK_PRG)
add_custom_target(testlint
COMMAND ${CMAKE_COMMAND}
diff --git a/Makefile b/Makefile
index 1fc15e1312..097832748b 100644
--- a/Makefile
+++ b/Makefile
@@ -45,6 +45,11 @@ ifneq (,$(USE_BUNDLED_DEPS))
BUNDLED_CMAKE_FLAG := -DUSE_BUNDLED=$(USE_BUNDLED_DEPS)
endif
+ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS)))
+ BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON
+ $(shell [ -x .deps/usr/bin/lua ] || rm build/.ran-*)
+endif
+
# For use where we want to make sure only a single job is run. This does issue
# a warning, but we need to keep SCRIPTS argument.
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
@@ -74,7 +79,7 @@ build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
mkdir -p .deps
cd .deps && \
- cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) \
+ cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) ../third-party
endif
mkdir -p build
@@ -86,6 +91,9 @@ oldtest: | nvim
functionaltest: | nvim
+$(BUILD_CMD) -C build functionaltest
+functionaltest-lua: | nvim
+ +$(BUILD_CMD) -C build functionaltest-lua
+
testlint: | nvim
$(BUILD_CMD) -C build testlint
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index 022ef19914..05815a4896 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -5,6 +5,32 @@ endif
let s:loaded_pythonx_provider = 1
+function! provider#pythonx#Require(host) abort
+ let ver = (a:host.orig_name ==# 'python') ? 2 : 3
+
+ " Python host arguments
+ let args = ['-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()']
+
+ " Collect registered Python plugins into args
+ let python_plugins = remote#host#PluginsForHost(a:host.name)
+ for plugin in python_plugins
+ call add(args, plugin.path)
+ endfor
+
+ try
+ let channel_id = rpcstart((ver == '2' ?
+ \ provider#python#Prog() : provider#python3#Prog()), args)
+ if rpcrequest(channel_id, 'poll') == 'ok'
+ return channel_id
+ endif
+ catch
+ echomsg v:throwpoint
+ echomsg v:exception
+ endtry
+ throw remote#host#LoadErrorForHost(a:host.orig_name,
+ \ '$NVIM_PYTHON_LOG_FILE')
+endfunction
+
function! provider#pythonx#Detect(major_ver) abort
let host_var = (a:major_ver == 2) ?
\ 'g:python_host_prog' : 'g:python3_host_prog'
diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim
new file mode 100644
index 0000000000..aad8c09d28
--- /dev/null
+++ b/runtime/autoload/provider/ruby.vim
@@ -0,0 +1,34 @@
+" The Ruby provider helper
+if exists('s:loaded_ruby_provider')
+ finish
+endif
+
+let s:loaded_ruby_provider = 1
+
+function! provider#ruby#Require(host) abort
+ " Collect registered Ruby plugins into args
+ let args = []
+ let ruby_plugins = remote#host#PluginsForHost(a:host.name)
+
+ for plugin in ruby_plugins
+ call add(args, plugin.path)
+ endfor
+
+ try
+ let channel_id = rpcstart(provider#ruby#Prog(), args)
+
+ if rpcrequest(channel_id, 'poll') == 'ok'
+ return channel_id
+ endif
+ catch
+ echomsg v:throwpoint
+ echomsg v:exception
+ endtry
+
+ throw remote#host#LoadErrorForHost(a:host.orig_name,
+ \ '$NVIM_RUBY_LOG_FILE')
+endfunction
+
+function! provider#ruby#Prog() abort
+ return 'neovim-ruby-host'
+endfunction
diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim
index 24497b10c2..0b4eef158d 100644
--- a/runtime/autoload/remote/host.vim
+++ b/runtime/autoload/remote/host.vim
@@ -2,6 +2,7 @@ let s:hosts = {}
let s:plugin_patterns = {}
let s:remote_plugins_manifest = fnamemodify(expand($MYVIMRC, 1), ':h')
\.'/.'.fnamemodify($MYVIMRC, ':t').'-rplugin~'
+let s:plugins_for_host = {}
" Register a host by associating it with a factory(funcref)
@@ -35,6 +36,9 @@ endfunction
" Get a host channel, bootstrapping it if necessary
function! remote#host#Require(name) abort
+ if empty(s:hosts)
+ call remote#host#LoadRemotePlugins()
+ endif
if !has_key(s:hosts, a:name)
throw 'No host named "'.a:name.'" is registered'
endif
@@ -123,6 +127,13 @@ function! remote#host#LoadRemotePlugins() abort
endfunction
+function! remote#host#LoadRemotePluginsEvent(event, pattern) abort
+ autocmd! nvim-rplugin
+ call remote#host#LoadRemotePlugins()
+ execute 'silent doautocmd' a:event a:pattern
+endfunction
+
+
function! s:RegistrationCommands(host) abort
" Register a temporary host clone for discovering specs
let host_id = a:host.'-registration-clone'
@@ -138,7 +149,9 @@ function! s:RegistrationCommands(host) abort
endfor
let channel = remote#host#Require(host_id)
let lines = []
+ let registered = []
for path in paths
+ unlet! specs
let specs = rpcrequest(channel, 'specs', path)
if type(specs) != type([])
" host didn't return a spec list, indicates a failure while loading a
@@ -151,9 +164,10 @@ function! s:RegistrationCommands(host) abort
call add(lines, " \\ ".string(spec).",")
endfor
call add(lines, " \\ ])")
+ call add(registered, path)
endfor
echomsg printf("remote/host: %s host registered plugins %s",
- \ a:host, string(map(copy(paths), "fnamemodify(v:val, ':t')")))
+ \ a:host, string(map(registered, "fnamemodify(v:val, ':t')")))
" Delete the temporary host clone
call rpcstop(s:hosts[host_id].channel)
@@ -163,7 +177,7 @@ function! s:RegistrationCommands(host) abort
endfunction
-function! s:UpdateRemotePlugins() abort
+function! remote#host#UpdateRemotePlugins() abort
let commands = []
let hosts = keys(s:hosts)
for host in hosts
@@ -185,10 +199,6 @@ function! s:UpdateRemotePlugins() abort
endfunction
-command! UpdateRemotePlugins call s:UpdateRemotePlugins()
-
-
-let s:plugins_for_host = {}
function! remote#host#PluginsForHost(host) abort
if !has_key(s:plugins_for_host, a:host)
let s:plugins_for_host[a:host] = []
@@ -197,40 +207,25 @@ function! remote#host#PluginsForHost(host) abort
endfunction
-" Registration of standard hosts
-
-" Python/Python3 {{{
-function! s:RequirePythonHost(host) abort
- let ver = (a:host.orig_name ==# 'python') ? 2 : 3
-
- " Python host arguments
- let args = ['-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()']
-
- " Collect registered Python plugins into args
- let python_plugins = remote#host#PluginsForHost(a:host.name)
- for plugin in python_plugins
- call add(args, plugin.path)
- endfor
-
- try
- let channel_id = rpcstart((ver == '2' ?
- \ provider#python#Prog() : provider#python3#Prog()), args)
- if rpcrequest(channel_id, 'poll') == 'ok'
- return channel_id
- endif
- catch
- echomsg v:throwpoint
- echomsg v:exception
- endtry
- throw 'Failed to load '. a:host.orig_name . ' host. '.
+function! remote#host#LoadErrorForHost(host, log) abort
+ return 'Failed to load '. a:host . ' host. '.
\ 'You can try to see what happened '.
\ 'by starting Neovim with the environment variable '.
- \ '$NVIM_PYTHON_LOG_FILE set to a file and opening '.
- \ 'the generated log file. Also, the host stderr will be available '.
+ \ a:log . ' set to a file and opening the generated '.
+ \ 'log file. Also, the host stderr will be available '.
\ 'in Neovim log, so it may contain useful information. '.
\ 'See also ~/.nvimlog.'
endfunction
-call remote#host#Register('python', '*.py', function('s:RequirePythonHost'))
-call remote#host#Register('python3', '*.py', function('s:RequirePythonHost'))
-" }}}
+
+" Registration of standard hosts
+
+" Python/Python3
+call remote#host#Register('python', '*',
+ \ function('provider#pythonx#Require'))
+call remote#host#Register('python3', '*',
+ \ function('provider#pythonx#Require'))
+
+" Ruby
+call remote#host#Register('ruby', '*.rb',
+ \ function('provider#ruby#Require'))
diff --git a/runtime/macros/less.bat b/runtime/macros/less.bat
index bbe619bc92..7395a70003 100644
--- a/runtime/macros/less.bat
+++ b/runtime/macros/less.bat
@@ -4,7 +4,7 @@ rem Read stdin if no arguments were given.
rem Written by Ken Takata.
if "%1"=="" (
- vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" -
+ nvim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" -
) else (
- vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %*
+ nvim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %*
)
diff --git a/runtime/macros/less.sh b/runtime/macros/less.sh
index e29958f7ad..125162f10a 100755
--- a/runtime/macros/less.sh
+++ b/runtime/macros/less.sh
@@ -8,9 +8,9 @@ if test -t 1; then
echo "Missing filename" 1>&2
exit
fi
- vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' -
+ nvim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' -
else
- vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@"
+ nvim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@"
fi
else
# Output is not a terminal, cat arguments or stdin
diff --git a/runtime/plugin/rplugin.vim b/runtime/plugin/rplugin.vim
index 879775ff0e..b4b03032b3 100644
--- a/runtime/plugin/rplugin.vim
+++ b/runtime/plugin/rplugin.vim
@@ -1,5 +1,16 @@
-if exists('g:loaded_remote_plugins') || &cp
+if exists('g:loaded_remote_plugins')
finish
endif
let g:loaded_remote_plugins = 1
-call remote#host#LoadRemotePlugins()
+
+command! UpdateRemotePlugins call remote#host#UpdateRemotePlugins()
+
+augroup nvim-rplugin
+ autocmd!
+ autocmd FuncUndefined *
+ \ call remote#host#LoadRemotePluginsEvent(
+ \ 'FuncUndefined', expand('<amatch>'))
+ autocmd CmdUndefined *
+ \ call remote#host#LoadRemotePluginsEvent(
+ \ 'CmdUndefined', expand('<amatch>'))
+augroup END
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index ef9e11fbef..c54e338fca 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -87,7 +87,6 @@ set(CONV_SOURCES
misc1.c
ops.c
path.c
- quickfix.c
regexp.c
screen.c
search.c
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 62ab7495da..8f5ae3445e 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3014,7 +3014,7 @@ int build_stl_str_hl(
&& item[groupitem[groupdepth]].minwid == 0) {
bool has_normal_items = false;
for (long n = groupitem[groupdepth] + 1; n < curitem; n++) {
- if (item[n].type == Normal) {
+ if (item[n].type == Normal || item[n].type == Highlight) {
has_normal_items = true;
break;
}
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 0be8b3c514..1149ca1e62 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -819,8 +819,8 @@ static void diff_file(char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff)
(diff_flags & DIFF_IWHITE) ? "-b " : "",
(diff_flags & DIFF_ICASE) ? "-i " : "",
tmp_orig, tmp_new);
- append_redir(cmd, (int)len, p_srr, tmp_diff);
- block_autocmds(); /* Avoid ShellCmdPost stuff */
+ append_redir(cmd, len, p_srr, tmp_diff);
+ block_autocmds(); // Avoid ShellCmdPost stuff
(void)call_shell(
cmd,
kShellOptFilter | kShellOptSilent | kShellOptDoOut,
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index beae55b8a8..3729cd5f2d 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -165,10 +165,6 @@ static int compl_restarting = FALSE; /* don't insert match */
* FALSE the word to be completed must be located. */
static int compl_started = FALSE;
-/* Set when doing something for completion that may call edit() recursively,
- * which is not allowed. */
-static int compl_busy = FALSE;
-
static int compl_matches = 0;
static char_u *compl_pattern = NULL;
static int compl_direction = FORWARD;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 96a7c8c5af..decb5e95bc 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1377,9 +1377,9 @@ char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp)
}
}
#endif
- if (otmp != NULL)
- append_redir(buf, (int)len, p_srr, otmp);
-
+ if (otmp != NULL) {
+ append_redir(buf, len, p_srr, otmp);
+ }
return buf;
}
@@ -1390,7 +1390,7 @@ char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp)
* The caller should make sure that there is enough room:
* STRLEN(opt) + STRLEN(fname) + 3
*/
-void append_redir(char_u *buf, int buflen, char_u *opt, char_u *fname)
+void append_redir(char_u *buf, size_t buflen, char_u *opt, char_u *fname)
{
char_u *p;
char_u *end;
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index bf67047ae8..a1e54e74a6 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -378,7 +378,7 @@ char_u *get_exception_string(void *value, int type, char_u *cmdname, int *should
char_u *p, *val;
if (type == ET_ERROR) {
- *should_free = FALSE;
+ *should_free = true;
mesg = ((struct msglist *)value)->throw_msg;
if (cmdname != NULL && *cmdname != NUL) {
size_t cmdlen = STRLEN(cmdname);
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 39bff9b2ad..cffda1ca55 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1130,7 +1130,7 @@ static int command_line_handle_key(CommandLineState *s)
if (!mouse_has(MOUSE_COMMAND)) {
return command_line_not_changed(s); // Ignore mouse
}
- cmdline_paste(0, true, true);
+ cmdline_paste(eval_has_provider("clipboard") ? '*' : 0, true, true);
redrawcmd();
return command_line_changed(s);
@@ -2424,20 +2424,17 @@ void restore_cmdline_alloc(char_u *p)
xfree(p);
}
-/*
- * paste a yank register into the command line.
- * used by CTRL-R command in command-line mode
- * insert_reg() can't be used here, because special characters from the
- * register contents will be interpreted as commands.
- *
- * return FAIL for failure, OK otherwise
- */
-static int
-cmdline_paste (
- int regname,
- int literally, /* Insert text literally instead of "as typed" */
- int remcr /* remove trailing CR */
-)
+/// Paste a yank register into the command line.
+/// Used by CTRL-R command in command-line mode.
+/// insert_reg() can't be used here, because special characters from the
+/// register contents will be interpreted as commands.
+///
+/// @param regname Register name.
+/// @param literally Insert text literally instead of "as typed".
+/// @param remcr When true, remove trailing CR.
+///
+/// @returns FAIL for failure, OK otherwise
+static bool cmdline_paste(int regname, bool literally, bool remcr)
{
long i;
char_u *arg;
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 6c135ef47b..70ab4ced75 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -762,6 +762,10 @@ void clearFolding(win_T *win)
*/
void foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
{
+ if (compl_busy) {
+ return;
+ }
+
fold_T *fp;
if (wp->w_buffer->terminal) {
return;
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 69e65c3208..618245ea23 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -214,6 +214,10 @@ EXTERN int compl_length INIT(= 0);
* stop looking for matches. */
EXTERN int compl_interrupted INIT(= FALSE);
+// Set when doing something for completion that may call edit() recursively,
+// which is not allowed. Also used to disable folding during completion
+EXTERN int compl_busy INIT(= false);
+
/* List of flags for method of completion. */
EXTERN int compl_cont_status INIT(= 0);
# define CONT_ADDING 1 /* "normal" or "adding" expansion */
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 8c7805ba04..5f48fdbf3d 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1261,21 +1261,18 @@ get_spec_reg (
return FALSE;
}
-/*
- * Paste a yank register into the command line.
- * Only for non-special registers.
- * Used by CTRL-R command in command-line mode
- * insert_reg() can't be used here, because special characters from the
- * register contents will be interpreted as commands.
- *
- * return FAIL for failure, OK otherwise
- */
-int
-cmdline_paste_reg (
- int regname,
- int literally, /* Insert text literally instead of "as typed" */
- int remcr /* don't add trailing CR */
-)
+/// Paste a yank register into the command line.
+/// Only for non-special registers.
+/// Used by CTRL-R command in command-line mode
+/// insert_reg() can't be used here, because special characters from the
+/// register contents will be interpreted as commands.
+///
+/// @param regname Register name.
+/// @param literally Insert text literally instead of "as typed".
+/// @param remcr When true, don't add CR characters.
+///
+/// @returns FAIL for failure, OK otherwise
+bool cmdline_paste_reg(int regname, bool literally, bool remcr)
{
long i;
@@ -1286,13 +1283,9 @@ cmdline_paste_reg (
for (i = 0; i < reg->y_size; i++) {
cmdline_paste_str(reg->y_array[i], literally);
- /* Insert ^M between lines and after last line if type is MLINE.
- * Don't do this when "remcr" is TRUE and the next line is empty. */
- if (reg->y_type == MLINE
- || (i < reg->y_size - 1
- && !(remcr
- && i == reg->y_size - 2
- && *reg->y_array[i + 1] == NUL))) {
+ // Insert ^M between lines and after last line if type is MLINE.
+ // Don't do this when "remcr" is true.
+ if ((reg->y_type == MLINE || i < reg->y_size - 1) && !remcr) {
cmdline_paste_str((char_u *)"\r", literally);
}
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 4a8391430b..171b7a825b 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -200,9 +200,8 @@ qf_init_ext (
char_u *pattern;
char_u *fmtstr = NULL;
int col = 0;
- char_u use_viscol = FALSE;
- int type = 0;
- int valid;
+ bool use_viscol = false;
+ char_u type = 0;
linenr_T buflnum = lnumfirst;
long lnum = 0L;
int enr = 0;
@@ -220,16 +219,16 @@ qf_init_ext (
int i;
int round;
int idx = 0;
- int multiline = FALSE;
- int multiignore = FALSE;
- int multiscan = FALSE;
- int retval = -1; /* default: return error flag */
- char_u *directory = NULL;
- char_u *currfile = NULL;
- char_u *tail = NULL;
- char_u *p_str = NULL;
- listitem_T *p_li = NULL;
- struct dir_stack_T *file_stack = NULL;
+ bool multiline = false;
+ bool multiignore = false;
+ bool multiscan = false;
+ int retval = -1; // default: return error flag
+ char_u *directory = NULL;
+ char_u *currfile = NULL;
+ char_u *tail = NULL;
+ char_u *p_str = NULL;
+ listitem_T *p_li = NULL;
+ struct dir_stack_T *file_stack = NULL;
regmatch_T regmatch;
static struct fmtpattern {
char_u convchar;
@@ -278,15 +277,16 @@ qf_init_ext (
/*
* Get some space to modify the format string into.
*/
- i = 3 * FMT_PATTERNS + 4 * (int)STRLEN(efm);
- for (round = FMT_PATTERNS; round > 0; )
- i += (int)STRLEN(fmt_pat[--round].pattern);
+ size_t fmtstr_size = 3 * FMT_PATTERNS + 4 * STRLEN(efm);
+ for (round = FMT_PATTERNS; round > 0; ) {
+ fmtstr_size += STRLEN(fmt_pat[--round].pattern);
+ }
#ifdef COLON_IN_FILENAME
- i += 12; /* "%f" can become twelve chars longer */
+ fmtstr_size += 12; // "%f" can become twelve chars longer
#else
- i += 2; /* "%f" can become two chars longer */
+ fmtstr_size += 2; // "%f" can become two chars longer
#endif
- fmtstr = xmalloc(i);
+ fmtstr = xmalloc(fmtstr_size);
while (efm[0] != NUL) {
/*
@@ -530,11 +530,9 @@ qf_init_ext (
fmt_start = NULL;
}
- /*
- * Try to match each part of 'errorformat' until we find a complete
- * match or no match.
- */
- valid = TRUE;
+ // Try to match each part of 'errorformat' until we find a complete
+ // match or no match.
+ bool valid = true;
restofline:
for (; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next) {
idx = fmt_ptr->prefix;
@@ -546,7 +544,7 @@ restofline:
errmsg[0] = NUL;
lnum = 0;
col = 0;
- use_viscol = FALSE;
+ use_viscol = false;
enr = -1;
type = 0;
tail = NULL;
@@ -555,25 +553,23 @@ restofline:
int r = vim_regexec(&regmatch, IObuff, (colnr_T)0);
fmt_ptr->prog = regmatch.regprog;
if (r) {
- if ((idx == 'C' || idx == 'Z') && !multiline)
+ if ((idx == 'C' || idx == 'Z') && !multiline) {
continue;
- if (vim_strchr((char_u *)"EWI", idx) != NULL)
- type = idx;
- else
+ }
+ if (vim_strchr((char_u *)"EWI", idx) != NULL) {
+ type = (char_u)idx;
+ } else {
type = 0;
- /*
- * Extract error message data from matched line.
- * We check for an actual submatch, because "\[" and "\]" in
- * the 'errorformat' may cause the wrong submatch to be used.
- */
- if ((i = (int)fmt_ptr->addr[0]) > 0) { /* %f */
- int c;
-
- if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
+ }
+ // Extract error message data from matched line.
+ // We check for an actual submatch, because "\[" and "\]" in
+ // the 'errorformat' may cause the wrong submatch to be used.
+ if ((i = (int)fmt_ptr->addr[0]) > 0) { // %f
+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) {
continue;
-
- /* Expand ~/file and $HOME/file to full path. */
- c = *regmatch.endp[i];
+ }
+ // Expand ~/file and $HOME/file to full path.
+ char_u c = *regmatch.endp[i];
*regmatch.endp[i] = NUL;
expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE);
*regmatch.endp[i] = c;
@@ -629,14 +625,14 @@ restofline:
col -= col % 8;
}
}
- ++col;
- use_viscol = TRUE;
+ col++;
+ use_viscol = true;
}
if ((i = (int)fmt_ptr->addr[8]) > 0) { /* %v */
if (regmatch.startp[i] == NULL)
continue;
col = (int)atol((char *)regmatch.startp[i]);
- use_viscol = TRUE;
+ use_viscol = true;
}
if ((i = (int)fmt_ptr->addr[9]) > 0) { /* %s */
if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
@@ -653,7 +649,7 @@ restofline:
break;
}
}
- multiscan = FALSE;
+ multiscan = false;
if (fmt_ptr == NULL || idx == 'D' || idx == 'X') {
if (fmt_ptr != NULL) {
@@ -667,20 +663,21 @@ restofline:
} else if (idx == 'X') /* leave directory */
directory = qf_pop_dir(&dir_stack);
}
- namebuf[0] = NUL; /* no match found, remove file name */
- lnum = 0; /* don't jump to this line */
- valid = FALSE;
- STRCPY(errmsg, IObuff); /* copy whole line to error message */
- if (fmt_ptr == NULL)
- multiline = multiignore = FALSE;
+ namebuf[0] = NUL; // no match found, remove file name
+ lnum = 0; // don't jump to this line
+ valid = false;
+ STRCPY(errmsg, IObuff); // copy whole line to error message
+ if (fmt_ptr == NULL) {
+ multiline = multiignore = false;
+ }
} else if (fmt_ptr != NULL) {
/* honor %> item */
if (fmt_ptr->conthere)
fmt_start = fmt_ptr;
if (vim_strchr((char_u *)"AEWI", idx) != NULL) {
- multiline = TRUE; /* start of a multi-line message */
- multiignore = FALSE; /* reset continuation */
+ multiline = true; // start of a multi-line message
+ multiignore = false; // reset continuation
} else if (vim_strchr((char_u *)"CZ", idx)
!= NULL) { /* continuation of multi-line msg */
if (qfprev == NULL)
@@ -702,15 +699,17 @@ restofline:
qfprev->qf_viscol = use_viscol;
if (!qfprev->qf_fnum)
qfprev->qf_fnum = qf_get_fnum(directory,
- *namebuf || directory ? namebuf
- : currfile && valid ? currfile : 0);
- if (idx == 'Z')
- multiline = multiignore = FALSE;
+ *namebuf
+ || directory ? namebuf : currfile
+ && valid ? currfile : 0);
+ if (idx == 'Z') {
+ multiline = multiignore = false;
+ }
line_breakcheck();
continue;
} else if (vim_strchr((char_u *)"OPQ", idx) != NULL) {
- /* global file names */
- valid = FALSE;
+ // global file names
+ valid = false;
if (*namebuf == NUL || os_file_exists(namebuf)) {
if (*namebuf && idx == 'P')
currfile = qf_push_dir(namebuf, &file_stack);
@@ -719,14 +718,15 @@ restofline:
*namebuf = NUL;
if (tail && *tail) {
STRMOVE(IObuff, skipwhite(tail));
- multiscan = TRUE;
+ multiscan = true;
goto restofline;
}
}
}
- if (fmt_ptr->flags == '-') { /* generally exclude this line */
- if (multiline)
- multiignore = TRUE; /* also exclude continuation lines */
+ if (fmt_ptr->flags == '-') { // generally exclude this line
+ if (multiline) {
+ multiignore = true; // also exclude continuation lines
+ }
continue;
}
}
@@ -867,26 +867,27 @@ void qf_free_all(win_T *wp)
qf_free(qi, i);
}
-/*
- * Add an entry to the end of the list of errors.
- * Returns OK or FAIL.
- */
-static int
-qf_add_entry (
- qf_info_T *qi, /* quickfix list */
- qfline_T **prevp, /* nonnull pointer (to previously added entry or NULL) */
- char_u *dir, /* optional directory name */
- char_u *fname, /* file name or NULL */
- int bufnum, /* buffer number or zero */
- char_u *mesg, /* message */
- long lnum, /* line number */
- int col, /* column */
- int vis_col, /* using visual column */
- char_u *pattern, /* search pattern */
- int nr, /* error number */
- int type, /* type character */
- int valid /* valid entry */
-)
+/// Add an entry to the end of the list of errors.
+///
+/// @param qi quickfix list
+/// @param prevp nonnull pointer (to previously added entry or NULL)
+/// @param dir optional directory name
+/// @param fname file name or NULL
+/// @param bufnum buffer number or zero
+/// @param mesg message
+/// @param lnum line number
+/// @param col column
+/// @param vis_col using visual column
+/// @param pattern search pattern
+/// @param nr error number
+/// @param type type character
+/// @param valid valid entry
+///
+/// @returns OK or FAIL.
+static int qf_add_entry(qf_info_T *qi, qfline_T **prevp, char_u *dir,
+ char_u *fname, int bufnum, char_u *mesg, long lnum,
+ int col, char_u vis_col, char_u *pattern, int nr,
+ char_u type, char_u valid)
{
qfline_T *qfp = xmalloc(sizeof(qfline_T));
@@ -1657,12 +1658,13 @@ win_found:
* flag is present in 'shortmess'; But when not jumping, print the
* whole message. */
i = msg_scroll;
- if (curbuf == old_curbuf && curwin->w_cursor.lnum == old_lnum)
- msg_scroll = TRUE;
- else if (!msg_scrolled && shortmess(SHM_OVERALL))
- msg_scroll = FALSE;
- msg_attr_keep(IObuff, 0, TRUE);
- msg_scroll = i;
+ if (curbuf == old_curbuf && curwin->w_cursor.lnum == old_lnum) {
+ msg_scroll = true;
+ } else if (!msg_scrolled && shortmess(SHM_OVERALL)) {
+ msg_scroll = false;
+ }
+ msg_attr_keep(IObuff, 0, true);
+ msg_scroll = (int)i;
}
} else {
if (opened_window)
@@ -1827,10 +1829,12 @@ void qf_age(exarg_T *eap)
}
}
- if (eap->addr_count != 0)
- count = eap->line2;
- else
+ if (eap->addr_count != 0) {
+ assert(eap->line2 <= INT_MAX);
+ count = (int)eap->line2;
+ } else {
count = 1;
+ }
while (count--) {
if (eap->cmdidx == CMD_colder || eap->cmdidx == CMD_lolder) {
if (qi->qf_curlist == 0) {
@@ -1948,7 +1952,7 @@ static char_u *qf_types(int c, int nr)
p = (char_u *)"";
else {
cc[0] = ' ';
- cc[1] = c;
+ cc[1] = (char_u)c;
cc[2] = NUL;
p = cc;
}
@@ -2036,12 +2040,13 @@ void ex_copen(exarg_T *eap)
}
}
- if (eap->addr_count != 0)
- height = eap->line2;
- else
+ if (eap->addr_count != 0) {
+ assert(eap->line2 <= INT_MAX);
+ height = (int)eap->line2;
+ } else {
height = QF_WINHEIGHT;
-
- reset_VIsual_and_resel(); /* stop Visual mode */
+ }
+ reset_VIsual_and_resel(); // stop Visual mode
/*
* Find existing quickfix window, or open a new one.
@@ -2434,7 +2439,7 @@ void ex_make(exarg_T *eap)
{
char_u *fname;
char_u *cmd;
- unsigned len;
+ size_t len;
win_T *wp = NULL;
qf_info_T *qi = &ql_info;
int res;
@@ -2475,9 +2480,10 @@ void ex_make(exarg_T *eap)
/*
* If 'shellpipe' empty: don't redirect to 'errorfile'.
*/
- len = (unsigned)STRLEN(p_shq) * 2 + (unsigned)STRLEN(eap->arg) + 1;
- if (*p_sp != NUL)
- len += (unsigned)STRLEN(p_sp) + (unsigned)STRLEN(fname) + 3;
+ len = STRLEN(p_shq) * 2 + STRLEN(eap->arg) + 1;
+ if (*p_sp != NUL) {
+ len += STRLEN(p_sp) + STRLEN(fname) + 3;
+ }
cmd = xmalloc(len);
sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)eap->arg,
(char *)p_shq);
@@ -2548,11 +2554,11 @@ static char_u *get_mef_name(void)
/* Keep trying until the name doesn't exist yet. */
for (;; ) {
- if (start == -1)
- start = os_get_pid();
- else
+ if (start == -1) {
+ start = (int)os_get_pid();
+ } else {
off += 19;
-
+ }
name = xmalloc(STRLEN(p_mef) + 30);
STRCPY(name, p_mef);
sprintf((char *)name + (p - p_mef), "%d%d", start, off);
@@ -2899,7 +2905,7 @@ void ex_vimgrep(exarg_T *eap)
int found_match;
buf_T *first_match_buf = NULL;
time_t seconds = 0;
- int save_mls;
+ long save_mls;
char_u *save_ei = NULL;
aco_save_T aco;
int flags = 0;
@@ -3456,18 +3462,12 @@ int get_errorlist(win_T *wp, list_T *list)
*/
int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
{
- listitem_T *li;
- dict_T *d;
- char_u *filename, *pattern, *text, *type;
- int bufnum;
- long lnum;
- int col, nr;
- int vcol;
- qfline_T *prevp = NULL;
- int valid, status;
+ listitem_T *li;
+ dict_T *d;
+ qfline_T *prevp = NULL;
int retval = OK;
- qf_info_T *qi = &ql_info;
- int did_bufnr_emsg = FALSE;
+ qf_info_T *qi = &ql_info;
+ bool did_bufnr_emsg = false;
if (wp != NULL) {
qi = ll_get_or_alloc_list(wp);
@@ -3494,21 +3494,22 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
if (d == NULL)
continue;
- filename = get_dict_string(d, (char_u *)"filename", TRUE);
- bufnum = get_dict_number(d, (char_u *)"bufnr");
- lnum = get_dict_number(d, (char_u *)"lnum");
- col = get_dict_number(d, (char_u *)"col");
- vcol = get_dict_number(d, (char_u *)"vcol");
- nr = get_dict_number(d, (char_u *)"nr");
- type = get_dict_string(d, (char_u *)"type", TRUE);
- pattern = get_dict_string(d, (char_u *)"pattern", TRUE);
- text = get_dict_string(d, (char_u *)"text", TRUE);
- if (text == NULL)
+ char_u *filename = get_dict_string(d, (char_u *)"filename", true);
+ int bufnum = (int)get_dict_number(d, (char_u *)"bufnr");
+ long lnum = get_dict_number(d, (char_u *)"lnum");
+ int col = (int)get_dict_number(d, (char_u *)"col");
+ char_u vcol = (char_u)get_dict_number(d, (char_u *)"vcol");
+ int nr = (int)get_dict_number(d, (char_u *)"nr");
+ char_u *type = get_dict_string(d, (char_u *)"type", true);
+ char_u *pattern = get_dict_string(d, (char_u *)"pattern", true);
+ char_u *text = get_dict_string(d, (char_u *)"text", true);
+ if (text == NULL) {
text = vim_strsave((char_u *)"");
-
- valid = TRUE;
- if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL))
- valid = FALSE;
+ }
+ bool valid = true;
+ if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL)) {
+ valid = false;
+ }
/* Mark entries with non-existing buffer number as not valid. Give the
* error message only once. */
@@ -3517,22 +3518,23 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
did_bufnr_emsg = TRUE;
EMSGN(_("E92: Buffer %" PRId64 " not found"), bufnum);
}
- valid = FALSE;
+ valid = false;
bufnum = 0;
}
- status = qf_add_entry(qi, &prevp,
- NULL, /* dir */
- filename,
- bufnum,
- text,
- lnum,
- col,
- vcol, /* vis_col */
- pattern, /* search pattern */
- nr,
- type == NULL ? NUL : *type,
- valid);
+ int status = qf_add_entry(qi,
+ &prevp,
+ NULL, // dir
+ filename,
+ bufnum,
+ text,
+ lnum,
+ col,
+ vcol, // vis_col
+ pattern, // search pattern
+ nr,
+ (char_u)(type == NULL ? NUL : *type),
+ valid);
xfree(filename);
xfree(pattern);
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 04e28cf5ca..26f0a6c94b 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -6395,7 +6395,7 @@ do_highlight (
HL_TABLE()[idx].sg_cterm_bg = color + 1;
if (is_normal_group) {
cterm_normal_bg_color = color + 1;
- {
+ if (!ui_rgb_attached()) {
must_redraw = CLEAR;
if (color >= 0) {
if (t_colors < 16)
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index 63ca4cf6c4..ec236e72b4 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -32,7 +32,6 @@ SCRIPTS := \
test69.out \
test73.out \
test79.out \
- test88.out \
test_listlbr.out \
test_breakindent.out \
test_close_count.out \
diff --git a/src/nvim/testdir/test88.in b/src/nvim/testdir/test88.in
deleted file mode 100644
index 9e43f703e9..0000000000
--- a/src/nvim/testdir/test88.in
+++ /dev/null
@@ -1,99 +0,0 @@
-vim: set ft=vim
-
-Tests for correct display (cursor column position) with +conceal and
-tabulators.
-
-STARTTEST
-:so small.vim
-:if !has('conceal')
- e! test.ok
- wq! test.out
-:endif
-:" Conceal settings.
-:set conceallevel=2
-:set concealcursor=nc
-:syntax match test /|/ conceal
-:" Save current cursor position. Only works in <expr> mode, can't be used
-:" with :normal because it moves the cursor to the command line. Thanks to ZyX
-:" <zyx.vim@gmail.com> for the idea to use an <expr> mapping.
-:let positions = []
-:nnoremap <expr> GG ":let positions += ['".screenrow().":".screencol()."']\n"
-:" Start test.
-/^start:
-:normal ztj
-GGk
-:" We should end up in the same column when running these commands on the two
-:" lines.
-:normal ft
-GGk
-:normal $
-GGk
-:normal 0j
-GGk
-:normal ft
-GGk
-:normal $
-GGk
-:normal 0j0j
-GGk
-:" Same for next test block.
-:normal ft
-GGk
-:normal $
-GGk
-:normal 0j
-GGk
-:normal ft
-GGk
-:normal $
-GGk
-:normal 0j0j
-GGk
-:" And check W with multiple tabs and conceals in a line.
-:normal W
-GGk
-:normal W
-GGk
-:normal W
-GGk
-:normal $
-GGk
-:normal 0j
-GGk
-:normal W
-GGk
-:normal W
-GGk
-:normal W
-GGk
-:normal $
-GGk
-:set lbr
-:normal $
-GGk
-:set list listchars=tab:>-
-:normal 0
-GGk
-:normal W
-GGk
-:normal W
-GGk
-:normal W
-GGk
-:normal $
-GGk
-:" Display result.
-:call append('$', 'end:')
-:call append('$', positions)
-:/^end/,$wq! test.out
-ENDTEST
-
-start:
-.concealed. text
-|concealed| text
-
- .concealed. text
- |concealed| text
-
-.a. .b. .c. .d.
-|a| |b| |c| |d|
diff --git a/src/nvim/testdir/test88.ok b/src/nvim/testdir/test88.ok
deleted file mode 100644
index 12949f274a..0000000000
--- a/src/nvim/testdir/test88.ok
+++ /dev/null
@@ -1,29 +0,0 @@
-end:
-2:1
-2:17
-2:20
-3:1
-3:17
-3:20
-5:8
-5:25
-5:28
-6:8
-6:25
-6:28
-8:1
-8:9
-8:17
-8:25
-8:27
-9:1
-9:9
-9:17
-9:25
-9:26
-9:26
-9:1
-9:9
-9:17
-9:25
-9:26
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 4e875516c0..b934ac6d47 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -69,6 +69,7 @@ static char *features[] = {
// clang-format off
static int included_patches[] = {
+ 1511,
1366,
// 1219 NA
@@ -317,7 +318,7 @@ static int included_patches[] = {
// 976 NA
975,
974,
- // 973,
+ 973,
972,
// 971 NA
// 970 NA
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 9c9759adf6..99f67fe43a 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')
local Screen = require('test.functional.ui.screen')
local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq
local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed
-local os_is_windows = helpers.os_is_windows
+local os_name = helpers.os_name
describe('vim_* functions', function()
before_each(clear)
@@ -17,7 +17,7 @@ describe('vim_* functions', function()
nvim('command', 'w')
local f = io.open(fname)
ok(f ~= nil)
- if os_is_windows() then
+ if os_name() == 'windows' then
eq('testing\r\napi\r\n', f:read('*a'))
else
eq('testing\napi\n', f:read('*a'))
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 1fba15c2c3..55c97d451b 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -1,5 +1,4 @@
require('coxpcall')
-local ffi = require('ffi')
local lfs = require('lfs')
local assert = require('luassert')
local Loop = require('nvim.loop')
@@ -133,6 +132,22 @@ local function nvim_eval(expr)
return request('vim_eval', expr)
end
+local os_name = (function()
+ local name = nil
+ return (function()
+ if not name then
+ if nvim_eval('has("win32")') == 1 then
+ name = 'windows'
+ elseif nvim_eval('has("macunix")') == 1 then
+ name = 'osx'
+ else
+ name = 'unix'
+ end
+ end
+ return name
+ end)
+end)()
+
local function nvim_call(name, ...)
return request('vim_call_function', name, {...})
end
@@ -247,7 +262,7 @@ end
local function source(code)
local tmpname = os.tmpname()
- if ffi.os == 'OSX' and string.match(tmpname, '^/tmp') then
+ if os_name() == 'osx' and string.match(tmpname, '^/tmp') then
tmpname = '/private'..tmpname
end
write_file(tmpname, code)
@@ -328,24 +343,18 @@ local function expect(contents)
return eq(dedent(contents), curbuf_contents())
end
-local function os_is_windows()
- return nvim_eval('has("win32")') == 1
-end
-
local function rmdir(path)
if lfs.attributes(path, 'mode') ~= 'directory' then
return nil
end
for file in lfs.dir(path) do
- if file == '.' or file == '..' then
- goto continue
- end
- local ret, err = os.remove(path..'/'..file)
- if not ret then
- error('os.remove: '..err)
- return nil
+ if file ~= '.' and file ~= '..' then
+ local ret, err = os.remove(path..'/'..file)
+ if not ret then
+ error('os.remove: '..err)
+ return nil
+ end
end
- ::continue::
end
local ret, err = os.remove(path)
if not ret then
@@ -434,7 +443,7 @@ return {
wait = wait,
set_session = set_session,
write_file = write_file,
- os_is_windows = os_is_windows,
+ os_name = os_name,
rmdir = rmdir,
mkdir = lfs.mkdir,
exc_exec = exc_exec,
diff --git a/test/functional/legacy/036_regexp_character_classes_spec.lua b/test/functional/legacy/036_regexp_character_classes_spec.lua
index 3c264423ff..de080f4b43 100644
--- a/test/functional/legacy/036_regexp_character_classes_spec.lua
+++ b/test/functional/legacy/036_regexp_character_classes_spec.lua
@@ -1,9 +1,9 @@
-- Test character classes in regexp using regexpengine 0, 1, 2.
local helpers = require('test.functional.helpers')
-local ffi = require('ffi')
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
local source, write_file = helpers.source, helpers.write_file
+local os_name = helpers.os_name
local function sixlines(text)
local result = ''
@@ -15,7 +15,7 @@ end
local function diff(text, nodedent)
local tmpname = os.tmpname()
- if ffi.os == 'OSX' and string.match(tmpname, '^/tmp') then
+ if os_name() == 'osx' and string.match(tmpname, '^/tmp') then
tmpname = '/private'..tmpname
end
execute('w! '..tmpname)
@@ -30,7 +30,7 @@ local function diff(text, nodedent)
end
describe('character classes in regexp', function()
- local ctrl1 = '\t\x0c\r'
+ local ctrl1 = '\t\012\r'
local punct1 = " !\"#$%&'()#+'-./"
local digits = '0123456789'
local punct2 = ':;<=>?@'
@@ -38,8 +38,8 @@ describe('character classes in regexp', function()
local punct3 = '[\\]^_`'
local lower = 'abcdefghiwxyz'
local punct4 = '{|}~'
- local ctrl2 = '\x7f\x80\x82\x90\x9b'
- local iso_text = '\xa6\xb1\xbc\xc7\xd3\xe9' -- "¦±¼ÇÓé" in utf-8
+ local ctrl2 = '\127\128\130\144\155'
+ local iso_text = '\166\177\188\199\211\233' -- "¦±¼ÇÓé" in utf-8
setup(function()
-- The original test32.in file was not in utf-8 encoding and did also
-- contain some control characters. We use lua escape sequences to write
diff --git a/test/functional/legacy/039_visual_block_mode_commands_spec.lua b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
index 6e1879035b..7195d7d11d 100644
--- a/test/functional/legacy/039_visual_block_mode_commands_spec.lua
+++ b/test/functional/legacy/039_visual_block_mode_commands_spec.lua
@@ -187,7 +187,7 @@ describe('Visual block mode', function()
98<Nul>65
98<Nul>65]]
expected = expected:gsub('<CR>', '\r')
- expected = expected:gsub('<Nul>', '\x00')
+ expected = expected:gsub('<Nul>', '\000')
expect(expected)
end)
diff --git a/test/functional/legacy/061_undo_tree_spec.lua b/test/functional/legacy/061_undo_tree_spec.lua
index ceb114b2a7..6db37bf1ff 100644
--- a/test/functional/legacy/061_undo_tree_spec.lua
+++ b/test/functional/legacy/061_undo_tree_spec.lua
@@ -191,7 +191,7 @@ describe('undo tree:', function()
end)
it('undo an expression-register', function()
- local normal_commands = 'o1\x1ba2\x12=string(123)\n\x1b'
+ local normal_commands = 'o1\027a2\018=string(123)\n\027'
write_file('Xtest.source', normal_commands)
feed('oa<esc>')
diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
index dc6df007e6..6b5ee60568 100644
--- a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
+++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
@@ -24,7 +24,7 @@ describe('tag search with !_TAG_FILE_ENCODING', function()
]])
write_file('test83-tags2',
'!_TAG_FILE_ENCODING cp932 //\n' ..
- '\x82`\x82a\x82b Xtags2.txt /\x82`\x82a\x82b\n'
+ '\130`\130a\130b Xtags2.txt /\130`\130a\130b\n'
)
-- The last file is very long but repetetive and can be generated on the
-- fly.
@@ -32,7 +32,7 @@ describe('tag search with !_TAG_FILE_ENCODING', function()
!_TAG_FILE_SORTED 1 //
!_TAG_FILE_ENCODING cp932 //
]])
- local line = ' Xtags3.txt /\x82`\x82a\x82b\n'
+ local line = ' Xtags3.txt /\130`\130a\130b\n'
for i = 1, 100 do
text = text .. 'abc' .. i .. line
end
diff --git a/test/functional/legacy/088_conceal_tabs_spec.lua b/test/functional/legacy/088_conceal_tabs_spec.lua
new file mode 100644
index 0000000000..c78f4e5c3e
--- /dev/null
+++ b/test/functional/legacy/088_conceal_tabs_spec.lua
@@ -0,0 +1,96 @@
+-- Tests for correct display (cursor column position) with +conceal and
+-- tabulators.
+
+local helpers = require('test.functional.helpers')
+local feed, insert, clear, execute =
+ helpers.feed, helpers.insert, helpers.clear, helpers.execute
+
+local expect_pos = function(row, col)
+ return helpers.eq({row, col}, helpers.eval('[screenrow(), screencol()]'))
+end
+
+describe('cursor and column position with conceal and tabulators', function()
+ setup(clear)
+
+ it('are working', function()
+ insert([[
+ start:
+ .concealed. text
+ |concealed| text
+
+ .concealed. text
+ |concealed| text
+
+ .a. .b. .c. .d.
+ |a| |b| |c| |d|]])
+
+ -- Conceal settings.
+ execute('set conceallevel=2')
+ execute('set concealcursor=nc')
+ execute('syntax match test /|/ conceal')
+ -- Start test.
+ execute('/^start:')
+ feed('ztj')
+ expect_pos(2, 1)
+ -- We should end up in the same column when running these commands on the
+ -- two lines.
+ feed('ft')
+ expect_pos(2, 17)
+ feed('$')
+ expect_pos(2, 20)
+ feed('0j')
+ expect_pos(3, 1)
+ feed('ft')
+ expect_pos(3, 17)
+ feed('$')
+ expect_pos(3, 20)
+ feed('j0j')
+ expect_pos(5, 8)
+ -- Same for next test block.
+ feed('ft')
+ expect_pos(5, 25)
+ feed('$')
+ expect_pos(5, 28)
+ feed('0j')
+ expect_pos(6, 8)
+ feed('ft')
+ expect_pos(6, 25)
+ feed('$')
+ expect_pos(6, 28)
+ feed('0j0j')
+ expect_pos(8, 1)
+ -- And check W with multiple tabs and conceals in a line.
+ feed('W')
+ expect_pos(8, 9)
+ feed('W')
+ expect_pos(8, 17)
+ feed('W')
+ expect_pos(8, 25)
+ feed('$')
+ expect_pos(8, 27)
+ feed('0j')
+ expect_pos(9, 1)
+ feed('W')
+ expect_pos(9, 9)
+ feed('W')
+ expect_pos(9, 17)
+ feed('W')
+ expect_pos(9, 25)
+ feed('$')
+ expect_pos(9, 26)
+ execute('set lbr')
+ feed('$')
+ expect_pos(9, 26)
+ execute('set list listchars=tab:>-')
+ feed('0')
+ expect_pos(9, 1)
+ feed('W')
+ expect_pos(9, 9)
+ feed('W')
+ expect_pos(9, 17)
+ feed('W')
+ expect_pos(9, 25)
+ feed('$')
+ expect_pos(9, 26)
+ end)
+end)
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index 1c81b47ed6..e0a4e10746 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -54,8 +54,8 @@ describe('eval', function()
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]].."\000 (['abc']), expr: abc\000"..[[ (['abc'])
+ ": type V; value: abc]].."\r\000 (['abc\r']), expr: abc\r\000 (['abc\r"..[['])
=: type v; value: abc (['abc']), expr: "abc" (['"abc"'])]])
end)
@@ -97,29 +97,29 @@ describe('eval', function()
==
=abcB=
{{{2 setreg('c', 'abcC', 'l')
- c: type V; value: abcC]].."\x00 (['abcC']), expr: abcC\x00"..[[ (['abcC'])
+ c: type V; value: abcC]].."\000 (['abcC']), expr: abcC\000"..[[ (['abcC'])
==
abcC
==
{{{2 setreg('d', 'abcD', 'V')
- d: type V; value: abcD]].."\x00 (['abcD']), expr: abcD\x00"..[[ (['abcD'])
+ d: type V; value: abcD]].."\000 (['abcD']), expr: abcD\000"..[[ (['abcD'])
==
abcD
==
{{{2 setreg('e', 'abcE', 'b')
- e: type ]]..'\x16'..[[4; value: abcE (['abcE']), expr: abcE (['abcE'])
+ e: type ]]..'\022'..[[4; value: abcE (['abcE']), expr: abcE (['abcE'])
==
=abcE=
- {{{2 setreg('f', 'abcF', ']]..'\x16'..[[')
- f: type ]]..'\x16'..[[4; value: abcF (['abcF']), expr: abcF (['abcF'])
+ {{{2 setreg('f', 'abcF', ']]..'\022'..[[')
+ f: type ]]..'\022'..[[4; value: abcF (['abcF']), expr: abcF (['abcF'])
==
=abcF=
{{{2 setreg('g', 'abcG', 'b10')
- g: type ]]..'\x16'..[[10; value: abcG (['abcG']), expr: abcG (['abcG'])
+ g: type ]]..'\022'..[[10; value: abcG (['abcG']), expr: abcG (['abcG'])
==
=abcG =
- {{{2 setreg('h', 'abcH', ']]..'\x16'..[[10')
- h: type ]]..'\x16'..[[10; value: abcH (['abcH']), expr: abcH (['abcH'])
+ {{{2 setreg('h', 'abcH', ']]..'\022'..[[10')
+ h: type ]]..'\022'..[[10; value: abcH (['abcH']), expr: abcH (['abcH'])
==
=abcH =
{{{2 setreg('I', 'abcI')
@@ -132,12 +132,12 @@ describe('eval', function()
==
=abcAabcAc=
{{{2 setreg('A', 'abcAl', 'l')
- A: type V; value: abcAabcAcabcAl]].."\x00 (['abcAabcAcabcAl']), expr: abcAabcAcabcAl\x00"..[[ (['abcAabcAcabcAl'])
+ A: type V; value: abcAabcAcabcAl]].."\000 (['abcAabcAcabcAl']), expr: abcAabcAcabcAl\000"..[[ (['abcAabcAcabcAl'])
==
abcAabcAcabcAl
==
{{{2 setreg('A', 'abcAc2', 'c')
- A: type v; value: abcAabcAcabcAl]].."\x00abcAc2 (['abcAabcAcabcAl', 'abcAc2']), expr: abcAabcAcabcAl\x00"..[[abcAc2 (['abcAabcAcabcAl', 'abcAc2'])
+ A: type v; value: abcAabcAcabcAl]].."\000abcAc2 (['abcAabcAcabcAl', 'abcAc2']), expr: abcAabcAcabcAl\000"..[[abcAc2 (['abcAabcAcabcAl', 'abcAc2'])
==
=abcAabcAcabcAl
abcAc2=
@@ -146,50 +146,50 @@ describe('eval', function()
==
=abcBabcBc=
{{{2 setreg('b', 'abcBb', 'ba')
- b: type ]]..'\x16'..[[5; value: abcBabcBcabcBb (['abcBabcBcabcBb']), expr: abcBabcBcabcBb (['abcBabcBcabcBb'])
+ b: type ]]..'\022'..[[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'])
+ b: type v; value: abcBabcBcabcBb]].."\000abcBc2 (['abcBabcBcabcBb', 'abcBc2']), expr: abcBabcBcabcBb\000"..[[abcBc2 (['abcBabcBcabcBb', 'abcBc2'])
==
=abcBabcBcabcBb
abcBc2=
{{{2 setreg('b', 'abcBb2', 'b50a')
- b: type ]].."\x1650; value: abcBabcBcabcBb\x00abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2']), expr: abcBabcBcabcBb\x00"..[[abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2'])
+ b: type ]].."\02250; value: abcBabcBcabcBb\000abcBc2abcBb2 (['abcBabcBcabcBb', 'abcBc2abcBb2']), expr: abcBabcBcabcBb\000"..[[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'])
+ C: type V; value: abcC]].."\000abcCl\000 (['abcC', 'abcCl']), expr: abcC\000abcCl\000"..[[ (['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'])
+ C: type v; value: abcC]].."\000abcCl\000abcCc (['abcC', 'abcCl', 'abcCc']), expr: abcC\000abcCl\000"..[[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'])
+ D: type ]].."\0225; value: abcD\000abcDb (['abcD', 'abcDb']), expr: abcD\000"..[[abcDb (['abcD', 'abcDb'])
==
=abcD =
abcDb
{{{2 setreg('E', 'abcEb', 'b')
- E: type ]].."\x165; value: abcE\x00abcEb (['abcE', 'abcEb']), expr: abcE\x00"..[[abcEb (['abcE', 'abcEb'])
+ E: type ]].."\0225; value: abcE\000abcEb (['abcE', 'abcEb']), expr: abcE\000"..[[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'])
+ E: type V; value: abcE]].."\000abcEb\000abcEl\000 (['abcE', 'abcEb', 'abcEl']), expr: abcE\000abcEb\000abcEl\000"..[[ (['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'])
+ F: type v; value: abcF]].."\000abcFc (['abcF', 'abcFc']), expr: abcF\000"..[[abcFc (['abcF', 'abcFc'])
==
=abcF
abcFc=]])
@@ -219,36 +219,36 @@ describe('eval', function()
execute([[call SetReg('F', "\n", 'b')]])
expect([[
- {{{2 setreg('A', ']]..'\x00'..[[')
- A: type V; value: abcA2]].."\x00 (['abcA2']), expr: abcA2\x00"..[[ (['abcA2'])
+ {{{2 setreg('A', ']]..'\000'..[[')
+ A: type V; value: abcA2]].."\000 (['abcA2']), expr: abcA2\000"..[[ (['abcA2'])
==
abcA2
==
- {{{2 setreg('B', ']]..'\x00'..[[', 'c')
- B: type v; value: abcB2]].."\x00 (['abcB2', '']), expr: abcB2\x00"..[[ (['abcB2', ''])
+ {{{2 setreg('B', ']]..'\000'..[[', 'c')
+ B: type v; value: abcB2]].."\000 (['abcB2', '']), expr: abcB2\000"..[[ (['abcB2', ''])
==
=abcB2
=
- {{{2 setreg('C', ']]..'\x00'..[[')
- C: type V; value: abcC2]].."\x00\x00 (['abcC2', '']), expr: abcC2\x00\x00"..[[ (['abcC2', ''])
+ {{{2 setreg('C', ']]..'\000'..[[')
+ C: type V; value: abcC2]].."\000\000 (['abcC2', '']), expr: abcC2\000\000"..[[ (['abcC2', ''])
==
abcC2
==
- {{{2 setreg('D', ']]..'\x00'..[[', 'l')
- D: type V; value: abcD2]].."\x00\x00 (['abcD2', '']), expr: abcD2\x00\x00"..[[ (['abcD2', ''])
+ {{{2 setreg('D', ']]..'\000'..[[', 'l')
+ D: type V; value: abcD2]].."\000\000 (['abcD2', '']), expr: abcD2\000\000"..[[ (['abcD2', ''])
==
abcD2
==
- {{{2 setreg('E', ']]..'\x00'..[[')
- E: type V; value: abcE2]].."\x00\x00 (['abcE2', '']), expr: abcE2\x00\x00"..[[ (['abcE2', ''])
+ {{{2 setreg('E', ']]..'\000'..[[')
+ E: type V; value: abcE2]].."\000\000 (['abcE2', '']), expr: abcE2\000\000"..[[ (['abcE2', ''])
==
abcE2
==
- {{{2 setreg('F', ']]..'\x00'..[[', 'b')
- F: type ]].."\x160; value: abcF2\x00 (['abcF2', '']), expr: abcF2\x00"..[[ (['abcF2', ''])
+ {{{2 setreg('F', ']]..'\000'..[[', 'b')
+ F: type ]].."\0220; value: abcF2\000 (['abcF2', '']), expr: abcF2\000"..[[ (['abcF2', ''])
==
=abcF2=
]])
@@ -282,21 +282,21 @@ describe('eval', function()
==
=abcA3=
{{{2 setreg('b', ['abcB3'], 'l')
- b: type V; value: abcB3]].."\x00 (['abcB3']), expr: abcB3\x00"..[[ (['abcB3'])
+ b: type V; value: abcB3]].."\000 (['abcB3']), expr: abcB3\000"..[[ (['abcB3'])
==
abcB3
==
{{{2 setreg('c', ['abcC3'], 'b')
- c: type ]]..'\x16'..[[5; value: abcC3 (['abcC3']), expr: abcC3 (['abcC3'])
+ c: type ]]..'\022'..[[5; value: abcC3 (['abcC3']), expr: abcC3 (['abcC3'])
==
=abcC3=
{{{2 setreg('d', ['abcD3'])
- d: type V; value: abcD3]].."\x00 (['abcD3']), expr: abcD3\x00"..[[ (['abcD3'])
+ d: type V; value: abcD3]].."\000 (['abcD3']), expr: abcD3\000"..[[ (['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'])
+ e: type V; value: 1]].."\0002\000abc\0003\000 (['1', '2', 'abc', '3']), expr: 1\0002\000abc\0003\000"..[[ (['1', '2', 'abc', '3'])
==
1
2
@@ -304,7 +304,7 @@ describe('eval', function()
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'])
+ f: type V; value: 1]].."\0002\0003\000 (['1', '2', '3']), expr: 1\0002\0003\000"..[[ (['1', '2', '3'])
==
1
2
@@ -312,49 +312,49 @@ describe('eval', function()
==
{{{1 Appending lists with setreg()
{{{2 setreg('A', ['abcA3c'], 'c')
- A: type v; value: abcA3]].."\x00abcA3c (['abcA3', 'abcA3c']), expr: abcA3\x00"..[[abcA3c (['abcA3', 'abcA3c'])
+ A: type v; value: abcA3]].."\000abcA3c (['abcA3', 'abcA3c']), expr: abcA3\000"..[[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'])
+ b: type V; value: abcB3]].."\000abcB3l\000 (['abcB3', 'abcB3l']), expr: abcB3\000abcB3l\000"..[[ (['abcB3', 'abcB3l'])
==
abcB3
abcB3l
==
{{{2 setreg('C', ['abcC3b'], 'lb')
- C: type ]].."\x166; value: abcC3\x00abcC3b (['abcC3', 'abcC3b']), expr: abcC3\x00"..[[abcC3b (['abcC3', 'abcC3b'])
+ C: type ]].."\0226; value: abcC3\000abcC3b (['abcC3', 'abcC3b']), expr: abcC3\000"..[[abcC3b (['abcC3', 'abcC3b'])
==
=abcC3 =
abcC3b
{{{2 setreg('D', ['abcD32'])
- D: type V; value: abcD3]].."\x00abcD32\x00 (['abcD3', 'abcD32']), expr: abcD3\x00abcD32\x00"..[[ (['abcD3', 'abcD32'])
+ D: type V; value: abcD3]].."\000abcD32\000 (['abcD3', 'abcD32']), expr: abcD3\000abcD32\000"..[[ (['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'])
+ A: type V; value: abcA3]].."\000abcA3c\000abcA32\000 (['abcA3', 'abcA3c', 'abcA32']), expr: abcA3\000abcA3c\000abcA32\000"..[[ (['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'])
+ B: type v; value: abcB3]].."\000abcB3l\000abcB3c (['abcB3', 'abcB3l', 'abcB3c']), expr: abcB3\000abcB3l\000"..[[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'])
+ C: type V; value: abcC3]].."\000abcC3b\000abcC3l\000 (['abcC3', 'abcC3b', 'abcC3l']), expr: abcC3\000abcC3b\000abcC3l\000"..[[ (['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'])
+ D: type ]].."\0226; value: abcD3\000abcD32\000abcD3b (['abcD3', 'abcD32', 'abcD3b']), expr: abcD3\000abcD32\000"..[[abcD3b (['abcD3', 'abcD32', 'abcD3b'])
==
=abcD3 =
abcD32
@@ -370,50 +370,50 @@ describe('eval', function()
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"..
+ "{{{2 setreg('A', ['\000', 'abcA3l2'], 'l')\n"..
+ "A: type V; value: abcA3\000abcA3c\000abcA32\000\000\000abcA3l2\000 (['abcA3', 'abcA3c', 'abcA32', '\000', 'abcA3l2']), expr: abcA3\000abcA3c\000abcA32\000\000\000abcA3l2\000 (['abcA3', 'abcA3c', 'abcA32', '\000', 'abcA3l2'])\n"..
'==\n'..
'abcA3\n'..
'abcA3c\n'..
'abcA32\n'..
- '\x00\n'..
+ '\000\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"..
+ "{{{2 setreg('B', ['\000', 'abcB3c2'], 'c')\n"..
+ "B: type v; value: abcB3\000abcB3l\000abcB3c\000\000\000abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\000', 'abcB3c2']), expr: abcB3\000abcB3l\000abcB3c\000\000\000abcB3c2 (['abcB3', 'abcB3l', 'abcB3c', '\000', 'abcB3c2'])\n"..
'==\n'..
'=abcB3\n'..
'abcB3l\n'..
'abcB3c\n'..
- '\x00\n'..
+ '\000\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"..
+ "{{{2 setreg('C', ['\000', 'abcC3b2'], 'b')\n"..
+ "C: type \0227; value: abcC3\000abcC3b\000abcC3l\000\000\000abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\000', 'abcC3b2']), expr: abcC3\000abcC3b\000abcC3l\000\000\000abcC3b2 (['abcC3', 'abcC3b', 'abcC3l', '\000', 'abcC3b2'])\n"..
'==\n'..
'=abcC3 =\n'..
' abcC3b\n'..
' abcC3l\n'..
- ' \x00\n'..
+ ' \000\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"..
+ "{{{2 setreg('D', ['\000', 'abcD3b50'], 'b50')\n"..
+ "D: type \02250; value: abcD3\000abcD32\000abcD3b\000\000\000abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\000', 'abcD3b50']), expr: abcD3\000abcD32\000abcD3b\000\000\000abcD3b50 (['abcD3', 'abcD32', 'abcD3b', '\000', 'abcD3b50'])\n"..
'==\n'..
'=abcD3 =\n'..
' abcD32\n'..
' abcD3b\n'..
- ' \x00\n'..
+ ' \000\n'..
' abcD3b50')
end)
@@ -425,14 +425,14 @@ describe('eval', function()
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"..
+ "{{{2 setreg('a', ['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2'])\n"..
+ "a: type V; value: abcA4-0\000\000\000abcA4-2\000\000\000abcA4-3\000abcA4-4\000abcA4-4-2\000 (['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2']), expr: abcA4-0\000\000\000abcA4-2\000\000\000abcA4-3\000abcA4-4\000abcA4-4-2\000 (['abcA4-0', '\000', 'abcA4-2\000', '\000abcA4-3', 'abcA4-4\000abcA4-4-2'])\n"..
'==\n'..
'abcA4-0\n'..
- '\x00\n'..
- 'abcA4-2\x00\n'..
- '\x00abcA4-3\n'..
- 'abcA4-4\x00abcA4-4-2\n'..
+ '\000\n'..
+ 'abcA4-2\000\n'..
+ '\000abcA4-3\n'..
+ 'abcA4-4\000abcA4-4-2\n'..
'==')
end)
@@ -441,14 +441,14 @@ describe('eval', function()
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"..
+ "{{{2 setreg('b', ['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2'], 'c')\n"..
+ "b: type v; value: abcB4c-0\000\000\000abcB4c-2\000\000\000abcB4c-3\000abcB4c-4\000abcB4c-4-2 (['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2']), expr: abcB4c-0\000\000\000abcB4c-2\000\000\000abcB4c-3\000abcB4c-4\000abcB4c-4-2 (['abcB4c-0', '\000', 'abcB4c-2\000', '\000abcB4c-3', 'abcB4c-4\000abcB4c-4-2'])\n"..
'==\n'..
'=abcB4c-0\n'..
- '\x00\n'..
- 'abcB4c-2\x00\n'..
- '\x00abcB4c-3\n'..
- 'abcB4c-4\x00abcB4c-4-2=')
+ '\000\n'..
+ 'abcB4c-2\000\n'..
+ '\000abcB4c-3\n'..
+ 'abcB4c-4\000abcB4c-4-2=')
end)
it('setting lists with NLs with setreg(), part 3', function()
@@ -456,14 +456,14 @@ describe('eval', function()
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"..
+ "{{{2 setreg('c', ['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2'], 'l')\n"..
+ "c: type V; value: abcC4l-0\000\000\000abcC4l-2\000\000\000abcC4l-3\000abcC4l-4\000abcC4l-4-2\000 (['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2']), expr: abcC4l-0\000\000\000abcC4l-2\000\000\000abcC4l-3\000abcC4l-4\000abcC4l-4-2\000 (['abcC4l-0', '\000', 'abcC4l-2\000', '\000abcC4l-3', 'abcC4l-4\000abcC4l-4-2'])\n"..
'==\n'..
'abcC4l-0\n'..
- '\x00\n'..
- 'abcC4l-2\x00\n'..
- '\x00abcC4l-3\n'..
- 'abcC4l-4\x00abcC4l-4-2\n'..
+ '\000\n'..
+ 'abcC4l-2\000\n'..
+ '\000abcC4l-3\n'..
+ 'abcC4l-4\000abcC4l-4-2\n'..
'==')
end)
it('setting lists with NLs with setreg(), part 4', function()
@@ -471,28 +471,28 @@ describe('eval', function()
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"..
+ "{{{2 setreg('d', ['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2'], 'b')\n"..
+ "d: type \02219; value: abcD4b-0\000\000\000abcD4b-2\000\000\000abcD4b-3\000abcD4b-4\000abcD4b-4-2 (['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2']), expr: abcD4b-0\000\000\000abcD4b-2\000\000\000abcD4b-3\000abcD4b-4\000abcD4b-4-2 (['abcD4b-0', '\000', 'abcD4b-2\000', '\000abcD4b-3', 'abcD4b-4\000abcD4b-4-2'])\n"..
'==\n'..
'=abcD4b-0 =\n'..
- ' \x00\n'..
- ' abcD4b-2\x00\n'..
- ' \x00abcD4b-3\n'..
- ' abcD4b-4\x00abcD4b-4-2')
+ ' \000\n'..
+ ' abcD4b-2\000\n'..
+ ' \000abcD4b-3\n'..
+ ' abcD4b-4\000abcD4b-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"..
+ "{{{2 setreg('e', ['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2'], 'b10')\n"..
+ "e: type \02210; value: abcE4b10-0\000\000\000abcE4b10-2\000\000\000abcE4b10-3\000abcE4b10-4\000abcE4b10-4-2 (['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2']), expr: abcE4b10-0\000\000\000abcE4b10-2\000\000\000abcE4b10-3\000abcE4b10-4\000abcE4b10-4-2 (['abcE4b10-0', '\000', 'abcE4b10-2\000', '\000abcE4b10-3', 'abcE4b10-4\000abcE4b10-4-2'])\n"..
'==\n'..
'=abcE4b10-0=\n'..
- ' \x00\n'..
- ' abcE4b10-2\x00\n'..
- ' \x00abcE4b10-3\n'..
- ' abcE4b10-4\x00abcE4b10-4-2')
+ ' \000\n'..
+ ' abcE4b10-2\000\n'..
+ ' \000abcE4b10-3\n'..
+ ' abcE4b10-4\000abcE4b10-4-2')
end)
it('search and expressions', function()
@@ -507,14 +507,14 @@ describe('eval', function()
/: 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"..[['])
+ {{{2 setreg('/', ['abc/]]..'\000'..[['])
+ /: type v; value: abc/]].."\000 (['abc/\000']), expr: abc/\000 (['abc/\000"..[['])
==
- =abc/]]..'\x00'..[[=
+ =abc/]]..'\000'..[[=
{{{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'..[["'])]])
+ {{{2 setreg('=', ['"abc/]]..'\000'..[["'])
+ =: type v; value: abc/]].."\000 (['abc/\000"..[[']), expr: "abc/]]..'\000'..[[" (['"abc/]]..'\000'..[["'])]])
end)
if has_clipboard() then
diff --git a/test/functional/plugin/msgpack_spec.lua b/test/functional/plugin/msgpack_spec.lua
index 18ff0f5156..90cc2af9c0 100644
--- a/test/functional/plugin/msgpack_spec.lua
+++ b/test/functional/plugin/msgpack_spec.lua
@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')
local eq, nvim_eval, nvim_command, exc_exec =
helpers.eq, helpers.eval, helpers.command, helpers.exc_exec
+local ok = helpers.ok
local plugin_helpers = require('test.functional.plugin.helpers')
local reset = plugin_helpers.reset
@@ -21,10 +22,8 @@ describe('In autoload/msgpack.vim', function()
end
local nan = -(1.0/0.0-1.0/0.0)
- local minus_nan = 1.0/0.0-1.0/0.0
local inf = 1.0/0.0
local minus_inf = -(1.0/0.0)
- local has_minus_nan = tostring(nan) ~= tostring(minus_nan)
describe('function msgpack#equal', function()
local msgpack_eq = function(expected, a, b)
@@ -160,9 +159,9 @@ describe('In autoload/msgpack.vim', function()
it('compares raw floats correctly', function()
msgpack_eq(1, '0.0', '0.0')
msgpack_eq(1, '(1.0/0.0-1.0/0.0)', '(1.0/0.0-1.0/0.0)')
- if has_minus_nan then
- msgpack_eq(0, '(1.0/0.0-1.0/0.0)', '-(1.0/0.0-1.0/0.0)')
- end
+ -- both (1.0/0.0-1.0/0.0) and -(1.0/0.0-1.0/0.0) now return
+ -- str2float('nan'). ref: @18d1ba3422d
+ msgpack_eq(1, '(1.0/0.0-1.0/0.0)', '-(1.0/0.0-1.0/0.0)')
msgpack_eq(1, '-(1.0/0.0-1.0/0.0)', '-(1.0/0.0-1.0/0.0)')
msgpack_eq(1, '1.0/0.0', '1.0/0.0')
msgpack_eq(1, '-(1.0/0.0)', '-(1.0/0.0)')
@@ -178,10 +177,8 @@ describe('In autoload/msgpack.vim', function()
it('compares float specials with raw floats correctly', function()
msgpack_eq(1, sp('float', '0.0'), '0.0')
msgpack_eq(1, sp('float', '(1.0/0.0-1.0/0.0)'), '(1.0/0.0-1.0/0.0)')
- if has_minus_nan then
- msgpack_eq(0, sp('float', '(1.0/0.0-1.0/0.0)'), '-(1.0/0.0-1.0/0.0)')
- msgpack_eq(0, sp('float', '-(1.0/0.0-1.0/0.0)'), '(1.0/0.0-1.0/0.0)')
- end
+ msgpack_eq(1, sp('float', '(1.0/0.0-1.0/0.0)'), '-(1.0/0.0-1.0/0.0)')
+ msgpack_eq(1, sp('float', '-(1.0/0.0-1.0/0.0)'), '(1.0/0.0-1.0/0.0)')
msgpack_eq(1, sp('float', '-(1.0/0.0-1.0/0.0)'), '-(1.0/0.0-1.0/0.0)')
msgpack_eq(1, sp('float', '1.0/0.0'), '1.0/0.0')
msgpack_eq(1, sp('float', '-(1.0/0.0)'), '-(1.0/0.0)')
@@ -207,10 +204,8 @@ describe('In autoload/msgpack.vim', function()
msgpack_eq(0, sp('float', '0.0'), sp('float', '-(1.0/0.0)'))
msgpack_eq(0, sp('float', '1.0/0.0'), sp('float', '-(1.0/0.0)'))
msgpack_eq(0, sp('float', '(1.0/0.0-1.0/0.0)'), sp('float', '-(1.0/0.0)'))
- if has_minus_nan then
- msgpack_eq(0, sp('float', '(1.0/0.0-1.0/0.0)'),
- sp('float', '-(1.0/0.0-1.0/0.0)'))
- end
+ msgpack_eq(1, sp('float', '(1.0/0.0-1.0/0.0)'),
+ sp('float', '-(1.0/0.0-1.0/0.0)'))
msgpack_eq(1, sp('float', '-(1.0/0.0-1.0/0.0)'),
sp('float', '-(1.0/0.0-1.0/0.0)'))
msgpack_eq(0, sp('float', '(1.0/0.0-1.0/0.0)'), sp('float', '1.0/0.0'))
@@ -392,9 +387,7 @@ describe('In autoload/msgpack.vim', function()
string_eq('0.0', sp('float', '0.0'))
string_eq('inf', sp('float', '(1.0/0.0)'))
string_eq('-inf', sp('float', '-(1.0/0.0)'))
- if has_minus_nan then
- string_eq('-nan', sp('float', '(1.0/0.0-1.0/0.0)'))
- end
+ string_eq('nan', sp('float', '(1.0/0.0-1.0/0.0)'))
string_eq('nan', sp('float', '-(1.0/0.0-1.0/0.0)'))
string_eq('FALSE', sp('boolean', '0'))
string_eq('TRUE', sp('boolean', '1'))
@@ -413,9 +406,7 @@ describe('In autoload/msgpack.vim', function()
string_eq('0.0', '0.0')
string_eq('inf', '(1.0/0.0)')
string_eq('-inf', '-(1.0/0.0)')
- if has_minus_nan then
- string_eq('-nan', '(1.0/0.0-1.0/0.0)')
- end
+ string_eq('nan', '(1.0/0.0-1.0/0.0)')
string_eq('nan', '-(1.0/0.0-1.0/0.0)')
end)
end)
@@ -547,8 +538,11 @@ describe('In autoload/msgpack.vim', function()
end
if expected_val_full == expected_val_full then
eq(expected_val_full, nvim_eval('g:__val'))
- else
- eq(tostring(expected_val_full), tostring(nvim_eval('g:__val')))
+ else -- NaN
+ local nvim_nan = tostring(nvim_eval('g:__val'))
+ -- -NaN is a hardware-specific detail, there's no need to test for it.
+ -- Accept ether 'nan' or '-nan' as the response.
+ ok(nvim_nan == 'nan' or nvim_nan == '-nan')
end
nvim_command('unlet g:__val')
end
@@ -615,7 +609,6 @@ describe('In autoload/msgpack.vim', function()
eval_eq('float', inf, 'inf')
eval_eq('float', minus_inf, '-inf')
eval_eq('float', nan, 'nan')
- eval_eq('float', minus_nan, '-nan')
eval_eq('float', 1.0e10, '1.0e10')
eval_eq('float', 1.0e10, '1.0e+10')
eval_eq('float', -1.0e10, '-1.0e+10')
diff --git a/test/functional/preload.lua b/test/functional/preload.lua
index 5f34f7fa6e..1971ef77cc 100644
--- a/test/functional/preload.lua
+++ b/test/functional/preload.lua
@@ -1,5 +1,4 @@
-- Modules loaded here will not be cleared and reloaded by Busted.
-- Busted started doing this to help provide more isolation. See issue #62
-- for more information about this.
-local ffi = require('ffi')
local helpers = require('test.functional.helpers')
diff --git a/test/functional/server/server_spec.lua b/test/functional/server/server_spec.lua
index 649e9dbabe..7f53522c08 100644
--- a/test/functional/server/server_spec.lua
+++ b/test/functional/server/server_spec.lua
@@ -2,7 +2,7 @@
local helpers = require('test.functional.helpers')
local nvim, eq, neq, eval = helpers.nvim, helpers.eq, helpers.neq, helpers.eval
local clear, funcs, meths = helpers.clear, helpers.funcs, helpers.meths
-local os_is_windows = helpers.os_is_windows
+local os_name = helpers.os_name
describe('serverstart(), serverstop()', function()
before_each(clear)
@@ -39,7 +39,7 @@ describe('serverstart(), serverstop()', function()
eq('', meths.get_vvar('servername'))
-- v:servername will take the next available server.
- local servername = (os_is_windows()
+ local servername = (os_name() == 'windows'
and [[\\.\pipe\Xtest-functional-server-server-pipe]]
or 'Xtest-functional-server-server-socket')
funcs.serverstart(servername)
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 838d05a6df..48376a344f 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -41,7 +41,7 @@ describe('tui', function()
-- INSERT -- |
-- TERMINAL -- |
]])
- feed('\x1b')
+ feed('\027')
screen:expect([[
abc |
test1 |
@@ -57,7 +57,7 @@ describe('tui', function()
local keys = 'dfghjkl'
for c in keys:gmatch('.') do
execute('nnoremap <a-'..c..'> ialt-'..c..'<cr><esc>')
- feed('\x1b'..c)
+ feed('\027'..c)
end
screen:expect([[
alt-j |
@@ -87,7 +87,7 @@ describe('tui', function()
-- Example: for input ALT+j:
-- * Vim (Nvim prior to #3982) sets high-bit, inserts "ê".
-- * Nvim (after #3982) inserts "j".
- feed('i\x1bj')
+ feed('i\027j')
screen:expect([[
j{1: } |
~ |
@@ -101,9 +101,9 @@ describe('tui', function()
it('accepts ascii control sequences', function()
feed('i')
- feed('\x16\x07') -- ctrl+g
- feed('\x16\x16') -- ctrl+v
- feed('\x16\x0d') -- ctrl+m
+ feed('\022\007') -- ctrl+g
+ feed('\022\022') -- ctrl+v
+ feed('\022\013') -- ctrl+m
screen:expect([[
{3:^G^V^M}{1: } |
~ |
@@ -116,7 +116,7 @@ describe('tui', function()
end)
it('automatically sends <Paste> for bracketed paste sequences', function()
- feed('i\x1b[200~')
+ feed('i\027[200~')
screen:expect([[
{1: } |
~ |
@@ -136,7 +136,7 @@ describe('tui', function()
-- INSERT (paste) -- |
-- TERMINAL -- |
]])
- feed('\x1b[201~')
+ feed('\027[201~')
screen:expect([[
pasted from terminal{1: } |
~ |
@@ -154,9 +154,9 @@ describe('tui', function()
for i = 1, 3000 do
t[i] = 'item ' .. tostring(i)
end
- feed('i\x1b[200~')
+ feed('i\027[200~')
feed(table.concat(t, '\n'))
- feed('\x1b[201~')
+ feed('\027[201~')
screen:expect([[
item 2997 |
item 2998 |
@@ -204,7 +204,7 @@ describe('tui focus event handling', function()
end)
it('can handle focus events in normal mode', function()
- feed('\x1b[I')
+ feed('\027[I')
screen:expect([[
{1: } |
~ |
@@ -215,7 +215,7 @@ describe('tui focus event handling', function()
-- TERMINAL -- |
]])
- feed('\x1b[O')
+ feed('\027[O')
screen:expect([[
{1: } |
~ |
@@ -230,7 +230,7 @@ describe('tui focus event handling', function()
it('can handle focus events in insert mode', function()
execute('set noshowmode')
feed('i')
- feed('\x1b[I')
+ feed('\027[I')
screen:expect([[
{1: } |
~ |
@@ -240,7 +240,7 @@ describe('tui focus event handling', function()
gained |
-- TERMINAL -- |
]])
- feed('\x1b[O')
+ feed('\027[O')
screen:expect([[
{1: } |
~ |
@@ -254,7 +254,7 @@ describe('tui focus event handling', function()
it('can handle focus events in cmdline mode', function()
feed(':')
- feed('\x1b[I')
+ feed('\027[I')
screen:expect([[
|
~ |
@@ -264,7 +264,7 @@ describe('tui focus event handling', function()
g{1:a}ined |
-- TERMINAL -- |
]])
- feed('\x1b[O')
+ feed('\027[O')
screen:expect([[
|
~ |
@@ -281,7 +281,7 @@ describe('tui focus event handling', function()
execute('set laststatus=0')
execute('set noshowmode')
execute('terminal')
- feed('\x1b[I')
+ feed('\027[I')
screen:expect([[
ready $ |
[Process exited 0]{1: } |
@@ -291,7 +291,7 @@ describe('tui focus event handling', function()
gained |
-- TERMINAL -- |
]])
- feed('\x1b[O')
+ feed('\027[O')
screen:expect([[
ready $ |
[Process exited 0]{1: } |
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua
index 4bb9707cda..45dbbdb7c7 100644
--- a/test/functional/viml/completion_spec.lua
+++ b/test/functional/viml/completion_spec.lua
@@ -141,4 +141,10 @@ describe('completion', function()
June]])
end)
end)
+
+ it('disables folding during completion', function ()
+ execute("set foldmethod=indent")
+ feed('i<Tab>foo<CR><Tab>bar<Esc>ggA<C-x><C-l>')
+ eq(-1, eval('foldclosed(1)'))
+ end)
end)
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index 468360b9d3..6f5a5f44dc 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -21,6 +21,9 @@ option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED})
option(USE_BUNDLED_MSGPACK "Use the bundled msgpack." ${USE_BUNDLED})
option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED})
option(USE_BUNDLED_LUAROCKS "Use the bundled version of luarocks." ${USE_BUNDLED})
+#XXX(tarruda): Lua is only used for debugging the functional test client, no
+# build it unless explicitly requested
+option(USE_BUNDLED_LUA "Use the bundled version of lua." OFF)
option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF)
@@ -80,6 +83,9 @@ set(MSGPACK_SHA256 afda64ca445203bb7092372b822bae8b2539fdcebbfc3f753f393628c2bcf
set(LUAJIT_URL https://github.com/neovim/deps/raw/master/opt/LuaJIT-2.0.4.tar.gz)
set(LUAJIT_SHA256 620fa4eb12375021bef6e4f237cbd2dd5d49e56beb414bee052c746beef1807d)
+set(LUA_URL https://github.com/lua/lua/archive/5.1.5.tar.gz)
+set(LUA_SHA256 1cd642c4c39778306a14e62ccddace5c7a4fb2257b0b06f43bc81cf305c7415f)
+
set(LUAROCKS_URL https://github.com/keplerproject/luarocks/archive/5d8a16526573b36d5b22aa74866120c998466697.tar.gz)
set(LUAROCKS_SHA256 cae709111c5701235770047dfd7169f66b82ae1c7b9b79207f9df0afb722bfd9)
@@ -119,6 +125,10 @@ if(USE_BUNDLED_LUAJIT)
include(BuildLuajit)
endif()
+if(USE_BUNDLED_LUA AND NOT CMAKE_CROSSCOMPILING)
+ include(BuildLua)
+endif()
+
if(USE_BUNDLED_LUAROCKS)
include(BuildLuarocks)
endif()
diff --git a/third-party/cmake/BuildLua.cmake b/third-party/cmake/BuildLua.cmake
new file mode 100644
index 0000000000..b24ef089de
--- /dev/null
+++ b/third-party/cmake/BuildLua.cmake
@@ -0,0 +1,85 @@
+include(CMakeParseArguments)
+
+# BuildLua(CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
+# Reusable function to build lua, wraps ExternalProject_Add.
+# Failing to pass a command argument will result in no command being run
+function(BuildLua)
+ cmake_parse_arguments(_lua
+ ""
+ ""
+ "CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
+ ${ARGN})
+
+ if(NOT _lua_CONFIGURE_COMMAND AND NOT _lua_BUILD_COMMAND
+ AND NOT _lua_INSTALL_COMMAND)
+ message(FATAL_ERROR "Must pass at least one of CONFIGURE_COMMAND, BUILD_COMMAND, INSTALL_COMMAND")
+ endif()
+
+ ExternalProject_Add(lua
+ PREFIX ${DEPS_BUILD_DIR}
+ URL ${LUA_URL}
+ DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua
+ DOWNLOAD_COMMAND ${CMAKE_COMMAND}
+ -DPREFIX=${DEPS_BUILD_DIR}
+ -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/lua
+ -DURL=${LUA_URL}
+ -DEXPECTED_SHA256=${LUA_SHA256}
+ -DTARGET=lua
+ -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ CONFIGURE_COMMAND "${_lua_CONFIGURE_COMMAND}"
+ BUILD_IN_SOURCE 1
+ BUILD_COMMAND "${_lua_BUILD_COMMAND}"
+ INSTALL_COMMAND "${_lua_INSTALL_COMMAND}")
+endfunction()
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(LUA_TARGET linux)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(LUA_TARGET macosx)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+ set(LUA_TARGET freebsd)
+elseif(CMAKE_SYSTEM_NAME MATCHES "BSD")
+ set(CMAKE_LUA_TARGET bsd)
+elseif(SYSTEM_NAME MATCHES "^MINGW")
+ set(CMAKE_LUA_TARGET mingw)
+else()
+ if(UNIX)
+ set(LUA_TARGET posix)
+ else()
+ set(LUA_TARGET generic)
+ endif()
+endif()
+
+set(LUA_CONFIGURE_COMMAND
+ sed -e "/^CC/s@gcc@${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}@"
+ -e "/^CFLAGS/s@-O2@-g3@"
+ -e "s@-lreadline@@g"
+ -e "s@-lhistory@@g"
+ -e "s@-lncurses@@g"
+ -i ${DEPS_BUILD_DIR}/src/lua/src/Makefile &&
+ sed -e "/#define LUA_USE_READLINE/d"
+ -i ${DEPS_BUILD_DIR}/src/lua/src/luaconf.h)
+set(LUA_BUILD_COMMAND
+ ${MAKE_PRG} ${LUA_TARGET})
+set(LUA_INSTALL_COMMAND
+ ${MAKE_PRG} INSTALL_TOP=${DEPS_INSTALL_DIR} install)
+
+message(STATUS "Lua target is ${LUA_TARGET}")
+
+BuildLua(CONFIGURE_COMMAND ${LUA_CONFIGURE_COMMAND}
+ BUILD_COMMAND ${LUA_BUILD_COMMAND}
+ INSTALL_COMMAND ${LUA_INSTALL_COMMAND})
+list(APPEND THIRD_PARTY_DEPS lua)
+add_dependencies(lua busted)
+
+set(BUSTED ${DEPS_INSTALL_DIR}/bin/busted)
+set(BUSTED_LUA ${BUSTED}-lua)
+
+add_custom_command(OUTPUT ${BUSTED_LUA}
+ COMMAND sed -e 's/jit//g' < ${BUSTED} > ${BUSTED_LUA} && chmod +x ${BUSTED_LUA}
+ DEPENDS lua)
+add_custom_target(busted-lua
+ DEPENDS ${DEPS_INSTALL_DIR}/bin/busted-lua)
+
+list(APPEND THIRD_PARTY_DEPS busted-lua)