diff options
60 files changed, 563 insertions, 518 deletions
diff --git a/.clang-format b/.clang-format index 5e31777265..a37e2fdbd1 100644 --- a/.clang-format +++ b/.clang-format @@ -36,8 +36,16 @@ BraceWrapping: BeforeElse: false IndentBraces: false PointerAlignment: Right -SortIncludes: false +SortIncludes: true Cpp11BracedListStyle: false +IncludeCategories: + - Regex: '<[/[:alnum:].]+>' + Priority: 0 + - Regex: '^"(nvim|vim)/' + Priority: 1 + SortPriority: 1 + CaseSensitive: false +IndentPPDirectives: AfterHash SpaceBeforeParens: ControlStatementsExceptControlMacros ForEachMacros: - FOR_ALL_AUEVENTS @@ -54,4 +62,4 @@ ForEachMacros: - RBUFFER_EACH_REVERSE - RBUFFER_UNTIL_EMPTY - RBUFFER_UNTIL_FULL - - kl_iter + - kl_iter
\ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 07c0f5a7af..82d9a42db2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,9 +144,9 @@ set(NVIM_VERSION_PATCH 0) set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers # API level -set(NVIM_API_LEVEL 9) # Bump this after any API change. +set(NVIM_API_LEVEL 10) # Bump this after any API change. set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change. -set(NVIM_API_PRERELEASE false) +set(NVIM_API_PRERELEASE true) set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}") # NVIM_VERSION_CFLAGS set further below. @@ -509,11 +509,6 @@ endif() find_package(LIBVTERM 0.1 REQUIRED) include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS}) -if(WIN32) - find_package(Winpty 0.4.3 REQUIRED) - include_directories(SYSTEM ${WINPTY_INCLUDE_DIRS}) -endif() - option(CLANG_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF) option(CLANG_MSAN "Enable Clang memory sanitizer for nvim binary." OFF) option(CLANG_TSAN "Enable Clang thread sanitizer for nvim binary." OFF) diff --git a/cmake/FindWinpty.cmake b/cmake/FindWinpty.cmake deleted file mode 100644 index 8feafc58a8..0000000000 --- a/cmake/FindWinpty.cmake +++ /dev/null @@ -1,10 +0,0 @@ -include(LibFindMacros) - -find_path(WINPTY_INCLUDE_DIR winpty.h) -set(WINPTY_INCLUDE_DIRS ${WINPTY_INCLUDE_DIR}) - -find_library(WINPTY_LIBRARY winpty) -find_program(WINPTY_AGENT_EXE winpty-agent.exe) -set(WINPTY_LIBRARIES ${WINPTY_LIBRARY}) - -find_package_handle_standard_args(Winpty DEFAULT_MSG WINPTY_LIBRARY WINPTY_INCLUDE_DIR) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 8f93e1eb27..abc6dde008 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -5,12 +5,12 @@ include(CheckIncludeFiles) include(CheckCSourceRuns) include(CheckCSourceCompiles) -check_type_size("int" SIZEOF_INT) -check_type_size("long" SIZEOF_LONG) -check_type_size("intmax_t" SIZEOF_INTMAX_T) -check_type_size("size_t" SIZEOF_SIZE_T) -check_type_size("long long" SIZEOF_LONG_LONG) -check_type_size("void *" SIZEOF_VOID_PTR) +check_type_size("int" SIZEOF_INT LANGUAGE C) +check_type_size("long" SIZEOF_LONG LANGUAGE C) +check_type_size("intmax_t" SIZEOF_INTMAX_T LANGUAGE C) +check_type_size("size_t" SIZEOF_SIZE_T LANGUAGE C) +check_type_size("long long" SIZEOF_LONG_LONG LANGUAGE C) +check_type_size("void *" SIZEOF_VOID_PTR LANGUAGE C) check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON) diff --git a/config/config.h.in b/config/config.h.in index b44b7238d2..72ac87bbb3 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -3,8 +3,11 @@ #cmakedefine DEBUG -#define SIZEOF_INT @SIZEOF_INT@ -#define SIZEOF_LONG @SIZEOF_LONG@ +#cmakedefine SIZEOF_INT @SIZEOF_INT@ +#cmakedefine SIZEOF_INTMAX_T @SIZEOF_INTMAX_T@ +#cmakedefine SIZEOF_LONG @SIZEOF_LONG@ +#cmakedefine SIZEOF_LONG_LONG @SIZEOF_LONG_LONG@ +#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@ #if @SIZEOF_VOID_PTR@ == 8 #define ARCH_64 @@ -12,7 +15,7 @@ #define ARCH_32 #endif -#define PROJECT_NAME "@PROJECT_NAME@" +#cmakedefine PROJECT_NAME "@PROJECT_NAME@" #cmakedefine HAVE__NSGETENVIRON #cmakedefine HAVE_FD_CLOEXEC diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim index 961f83d926..f3732e012f 100644 --- a/runtime/autoload/health/nvim.vim +++ b/runtime/autoload/health/nvim.vim @@ -144,6 +144,16 @@ function! s:check_performance() abort \ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.', \ s:suggest_faq]) endif + + " check for slow shell invocation + let slow_cmd_time = 1.5 + let start_time = reltime() + call system('echo') + let elapsed_time = reltimefloat(reltime(start_time)) + if elapsed_time > slow_cmd_time + call health#report_warn( + \ 'Slow shell invocation (took '.printf('%.2f', elapsed_time).' seconds).') + endif endfunction function! s:get_tmux_option(option) abort diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim index b28170b7a1..4d6a1f78dc 100644 --- a/runtime/autoload/man.vim +++ b/runtime/autoload/man.vim @@ -123,12 +123,12 @@ function! s:system(cmd, ...) abort endfunction function! s:set_options(pager) abort - setlocal filetype=man setlocal noswapfile buftype=nofile bufhidden=hide setlocal nomodified readonly nomodifiable if a:pager nnoremap <silent> <buffer> <nowait> q :lclose<CR>:q<CR> endif + setlocal filetype=man endfunction function! s:get_page(path) abort @@ -473,10 +473,6 @@ endfunction " Called when Nvim is invoked as $MANPAGER. function! man#init_pager() abort - " https://github.com/neovim/neovim/issues/6828 - let og_modifiable = &modifiable - setlocal modifiable - if getline(1) =~# '^\s*$' silent keepjumps 1delete _ else @@ -496,7 +492,6 @@ function! man#init_pager() abort endif call s:set_options(v:true) - let &l:modifiable = og_modifiable endfunction function! man#goto_tag(pattern, flags, info) abort diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index f4942d7f26..8e33e7a67b 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -929,7 +929,7 @@ nvim_get_chan_info({chan}) *nvim_get_chan_info()* • "pty" (optional) Name of pseudoterminal. On a POSIX system this is a device path like "/dev/pts/1". If the name is unknown, the key will still be present if a pty - is used (e.g. for winpty on Windows). + is used (e.g. for conpty on Windows). • "buffer" (optional) Buffer with connected |terminal| instance. • "client" (optional) Info about the peer (client on the diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 81d7f4b83a..3e75914743 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -4975,7 +4975,7 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()* If {list} is a list of dictionaries, then the optional {dict} argument supports the following additional items: - key key of the item which is fuzzy matched against + key Key of the item which is fuzzy matched against {str}. The value of this item should be a string. text_cb |Funcref| that will be called for every item @@ -4983,6 +4983,8 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()* This should accept a dictionary item as the argument and return the text for that item to use for fuzzy matching. + limit Maximum number of matches in {list} to be + returned. Zero means no limit. {str} is treated as a literal string and regular expression matching is NOT supported. The maximum supported {str} length @@ -4995,6 +4997,9 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()* empty list is returned. If length of {str} is greater than 256, then returns an empty list. + When {limit} is given, matchfuzzy() will find up to this + number of matches in {list} and return them in sorted order. + Refer to |fuzzy-matching| for more information about fuzzy matching strings. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 1966a344b2..b6f9c007ef 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5532,8 +5532,7 @@ A jump table for the options with a short description can be found at |Q_op|. "Pattern not found", "Back at original", etc. q use "recording" instead of "recording @a" F don't give the file info when editing a file, like `:silent` - was used for the command; note that this also affects messages - from autocommands + was used for the command S do not show search count message when searching, e.g. "[1/5]" diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index bdf0094721..9969fc0a79 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -117,6 +117,43 @@ go to the window below: > tmux send-keys 'Escape' [ 2 7 u 'C-W' j Where `'Escape' [ 2 7 u` is an unambiguous `CSI u` sequence for the <Esc> key. + *tui-modifyOtherKeys* *tui-csiu* +Historically, terminal emulators could not distinguish between certain control +key modifiers and other keys. For example, <C-I> and <Tab> are represented the +same way, as are <Esc> and <C-[>, <CR> and <C-M>, and <NL> and <C-J>. This +meant that Nvim also could not map these keys separately. + +Modern terminal emulators are able to distinguish between these pairs of keys +by encoding control modifiers differently. There are two common but distinct +ways of doing this, known as "modifyOtherKeys" and "CSI u". Nvim supports both +encoding methods and at startup will tell the terminal emulator that it +understands these key encodings. If your terminal emulator supports it then +this will allow you to map the key pairs listed above separately. + +At startup Nvim will query your terminal to see if it supports the CSI u +encoding by writing the sequence > + + CSI ? u CSI c + +If your terminal emulator responds with > + + CSI ? <flags> u + +this means your terminal supports the CSI u encoding and Nvim will tell your +terminal to enable it by writing the sequence > + + CSI > 1 u + +If your terminal does not support CSI u then Nvim will instead enable the +"modifyOtherKeys" encoding by writing the sequence > + + CSI > 4 ; 2 m + +When Nvim exits cleanly it will send the corresponding sequence to disable the +special key encoding. If Nvim does not exit cleanly then your terminal +emulator could be in a bad state. If this happens, simply run "reset". + + *tui-colors* Nvim uses 256 colours by default, ignoring |terminfo| for most terminal types, including "linux" (whose virtual terminals have had 256-colour support since diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index f5cd24b734..540043f52d 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -375,6 +375,7 @@ Normal commands: Options: 'ttimeout', 'ttimeoutlen' behavior was simplified |jumpoptions| "stack" behavior + 'shortmess' the "F" flag does not affect output from autocommands Shell: Shell output (|:!|, |:make|, …) is always routed through the UI, so it diff --git a/runtime/filetype.vim b/runtime/filetype.vim index e72d6fc0c0..5fee083977 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -817,6 +817,7 @@ au BufNewFile,BufRead *.t.html setf tilde " HTML (.shtml and .stm for server side) au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call dist#ft#FThtml() +au BufNewFile,BufRead *.cshtml setf html " HTML with Ruby - eRuby au BufNewFile,BufRead *.erb,*.rhtml setf eruby diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 420d343a8a..1297ef6241 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -142,6 +142,7 @@ local extension = { cs = "cs", csc = "csc", csdl = "csdl", + cshtml = "html", fdr = "csp", csp = "csp", css = "css", diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 614d83f565..6a8d6dcad7 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -185,7 +185,12 @@ end function M.on_publish_diagnostics(_, result, ctx, config) local client_id = ctx.client_id local uri = result.uri - local bufnr = vim.uri_to_bufnr(uri) + local fname = vim.uri_to_fname(uri) + local diagnostics = result.diagnostics + if #diagnostics == 0 and vim.fn.bufexists(fname) == 0 then + return + end + local bufnr = vim.fn.bufadd(fname) if not bufnr then return @@ -193,7 +198,6 @@ function M.on_publish_diagnostics(_, result, ctx, config) client_id = get_client_id(client_id) local namespace = M.get_namespace(client_id) - local diagnostics = result.diagnostics if config then for _, opt in pairs(config) do diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index aef7df95dc..64de2ec7e0 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -159,10 +159,7 @@ list(REMOVE_ITEM NVIM_SOURCES ${to_remove}) set(CONV_SOURCES edit.c eval.c - eval/funcs.c - eval/userfunc.c ex_cmds.c - ex_docmd.c fileio.c lua/treesitter.c mbyte.c @@ -174,7 +171,6 @@ set(CONV_SOURCES spell.c spellfile.c syntax.c - tag.c window.c) foreach(sfile ${CONV_SOURCES}) if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/${sfile}") @@ -468,7 +464,6 @@ endif() if(WIN32) list(APPEND NVIM_LINK_LIBRARIES netapi32) - list(APPEND NVIM_LINK_LIBRARIES ${WINPTY_LIBRARIES}) endif() # Use "luv" as imported library, to work around CMake using "-lluv" for @@ -555,8 +550,6 @@ if(WIN32) diff.exe tee.exe win32yank.exe - winpty-agent.exe - winpty.dll xxd.exe # Dependencies for neovim-qt diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 7a966777af..0f9a4a0e0d 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1740,7 +1740,7 @@ void nvim_set_client_info(uint64_t channel_id, String name, Dictionary version, /// - "pty" (optional) Name of pseudoterminal. On a POSIX system this /// is a device path like "/dev/pts/1". If the name is unknown, /// the key will still be present if a pty is used (e.g. for -/// winpty on Windows). +/// conpty on Windows). /// - "buffer" (optional) Buffer with connected |terminal| instance. /// - "client" (optional) Info about the peer (client on the other end of /// the RPC channel), if provided by it via diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 3dc3d3d7a9..783cec4d60 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -4,7 +4,6 @@ // autocmd.c: Autocommand related functions #include <signal.h> -#include "lauxlib.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii.h" #include "nvim/autocmd.h" @@ -27,6 +26,9 @@ #include "nvim/state.h" #include "nvim/ui_compositor.h" #include "nvim/vim.h" +#include "nvim/window.h" + +#include "lauxlib.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "auevents_name_map.generated.h" diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 5d2d1cebde..99a24464a8 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -25,7 +25,6 @@ #include <string.h> #include "nvim/api/private/helpers.h" -#include "nvim/api/vim.h" #include "nvim/ascii.h" #include "nvim/assert.h" #include "nvim/buffer.h" @@ -50,7 +49,6 @@ #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/hashtab.h" -#include "nvim/highlight.h" #include "nvim/highlight_group.h" #include "nvim/indent.h" #include "nvim/indent_c.h" @@ -64,13 +62,11 @@ #include "nvim/os/input.h" #include "nvim/os/os.h" #include "nvim/os/time.h" -#include "nvim/os_unix.h" #include "nvim/path.h" #include "nvim/plines.h" #include "nvim/quickfix.h" #include "nvim/regexp.h" #include "nvim/screen.h" -#include "nvim/shada.h" #include "nvim/sign.h" #include "nvim/spell.h" #include "nvim/strings.h" @@ -109,6 +105,7 @@ static int read_buffer(int read_stdin, exarg_T *eap, int flags) { int retval = OK; linenr_T line_count; + bool silent = shortmess(SHM_FILEINFO); // Read from the buffer which the text is already filled in and append at // the end. This makes it possible to retry when 'fileformat' or @@ -117,7 +114,7 @@ static int read_buffer(int read_stdin, exarg_T *eap, int flags) retval = readfile(read_stdin ? NULL : curbuf->b_ffname, read_stdin ? NULL : curbuf->b_fname, line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap, - flags | READ_BUFFER); + flags | READ_BUFFER, silent); if (retval == OK) { // Delete the binary lines. while (--line_count >= 0) { @@ -162,6 +159,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) bufref_T old_curbuf; long old_tw = curbuf->b_p_tw; int read_fifo = false; + bool silent = shortmess(SHM_FILEINFO); // The 'readonly' flag is only set when BF_NEVERLOADED is being reset. // When re-entering the same buffer, it should not change, because the @@ -212,7 +210,6 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) curwin->w_valid = 0; if (curbuf->b_ffname != NULL) { - int old_msg_silent = msg_silent; #ifdef UNIX int save_bin = curbuf->b_p_bin; int perm; @@ -231,13 +228,10 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) curbuf->b_p_bin = true; } #endif - if (shortmess(SHM_FILEINFO)) { - msg_silent = 1; - } retval = readfile(curbuf->b_ffname, curbuf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap, - flags | READ_NEW | (read_fifo ? READ_FIFO : 0)); + flags | READ_NEW | (read_fifo ? READ_FIFO : 0), silent); #ifdef UNIX if (read_fifo) { curbuf->b_p_bin = save_bin; @@ -246,7 +240,6 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) } } #endif - msg_silent = old_msg_silent; // Help buffer is filtered. if (bt_help(curbuf)) { @@ -262,7 +255,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) curbuf->b_p_bin = true; retval = readfile(NULL, NULL, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, NULL, - flags | (READ_NEW + READ_STDIN)); + flags | (READ_NEW + READ_STDIN), silent); curbuf->b_p_bin = save_bin; if (retval == OK) { retval = read_buffer(true, eap, flags); @@ -903,14 +896,7 @@ void handle_swap_exists(bufref_T *old_curbuf) buf = old_curbuf->br_buf; } if (buf != NULL) { - int old_msg_silent = msg_silent; - - if (shortmess(SHM_FILEINFO)) { - msg_silent = 1; // prevent fileinfo message - } enter_buffer(buf); - // restore msg_silent, so that the command line will be shown - msg_silent = old_msg_silent; if (old_tw != curbuf->b_p_tw) { check_colorcolumn(curwin); @@ -5611,7 +5597,7 @@ bool buf_contents_changed(buf_T *buf) if (ml_open(curbuf) == OK && readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, - &ea, READ_NEW | READ_DUMMY) == OK) { + &ea, READ_NEW | READ_DUMMY, false) == OK) { // compare the two files line by line if (buf->b_ml.ml_line_count == curbuf->b_ml.ml_line_count) { differ = false; diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h index 7f4bbcc9e5..b452eb227e 100644 --- a/src/nvim/buffer.h +++ b/src/nvim/buffer.h @@ -2,14 +2,11 @@ #define NVIM_BUFFER_H #include "nvim/eval.h" -#include "nvim/ex_cmds_defs.h" // for exarg_T #include "nvim/func_attr.h" #include "nvim/macros.h" #include "nvim/memline.h" #include "nvim/pos.h" // for linenr_T #include "nvim/screen.h" // for StlClickRecord -#include "nvim/vim.h" -#include "nvim/window.h" // Values for buflist_getfile() enum getf_values { diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index d6d5ecc907..8d2f7c4545 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -102,8 +102,6 @@ typedef uint64_t disptick_T; // display tick type // for struct memline (it needs memfile_T) #include "nvim/memline_defs.h" -// for struct memfile, bhdr_T, blocknr_T... (it needs buf_T) -#include "nvim/memfile_defs.h" // for regprog_T. Needs win_T and buf_T. #include "nvim/regexp_defs.h" diff --git a/src/nvim/buffer_updates.h b/src/nvim/buffer_updates.h index 961fec879b..3c2635be71 100644 --- a/src/nvim/buffer_updates.h +++ b/src/nvim/buffer_updates.h @@ -1,8 +1,8 @@ #ifndef NVIM_BUFFER_UPDATES_H #define NVIM_BUFFER_UPDATES_H -#include "nvim/buffer_defs.h" -#include "nvim/extmark.h" +#include "nvim/buffer_defs.h" // for buf_T +#include "nvim/extmark.h" // for bcount_t #ifdef INCLUDE_GENERATED_DECLARATIONS # include "buffer_updates.h.generated.h" diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 01ebbafe3c..f97ceedeb7 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -25,7 +25,6 @@ #include "nvim/eval/funcs.h" #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" -#include "nvim/ex_cmds2.h" #include "nvim/ex_docmd.h" #include "nvim/ex_getln.h" #include "nvim/file_search.h" @@ -70,7 +69,7 @@ #include "nvim/undo.h" #include "nvim/version.h" #include "nvim/vim.h" - +#include "nvim/window.h" /// Describe data to return from find_some_match() typedef enum { @@ -4278,6 +4277,8 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr) "nvim", }; + // XXX: eval_has_provider() may shell out :( + const int save_shell_error = get_vim_var_nr(VV_SHELL_ERROR); bool n = false; const char *const name = tv_get_string(&argvars[0]); for (size_t i = 0; i < ARRAY_SIZE(has_list); i++) { @@ -4334,6 +4335,7 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr) n = true; } + set_vim_var_nr(VV_SHELL_ERROR, save_shell_error); rettv->vval.v_number = n; } diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 340b731312..11ca93cff9 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -70,7 +70,7 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs, i bool mustend = false; char_u *arg = *argp; char_u *p = arg; - int c; + char_u c; int i; if (newargs != NULL) { @@ -265,7 +265,7 @@ int get_lambda_tv(char_u **arg, typval_T *rettv, bool evaluate) (*arg)++; if (evaluate) { - int len, flags = 0; + int flags = 0; char_u *p; garray_T newlines; @@ -278,7 +278,7 @@ int get_lambda_tv(char_u **arg, typval_T *rettv, bool evaluate) ga_grow(&newlines, 1); // Add "return " before the expression. - len = 7 + e - s + 1; + size_t len = (size_t)(7 + e - s + 1); p = (char_u *)xmalloc(len); ((char_u **)(newlines.ga_data))[newlines.ga_len++] = p; STRCPY(p, "return "); @@ -522,16 +522,16 @@ static char_u *fname_trans_sid(const char_u *const name, char_u *const fname_buf if (current_sctx.sc_sid <= 0) { *error = ERROR_SCRIPT; } else { - snprintf((char *)fname_buf + i, FLEN_FIXED + 1 - i, "%" PRId64 "_", + snprintf((char *)fname_buf + i, (size_t)(FLEN_FIXED + 1 - i), "%" PRId64 "_", (int64_t)current_sctx.sc_sid); i = (int)STRLEN(fname_buf); } } - if (i + STRLEN(name + llen) < FLEN_FIXED) { + if ((size_t)i + STRLEN(name + llen) < FLEN_FIXED) { STRCPY(fname_buf + i, name + llen); fname = fname_buf; } else { - fname = xmalloc(i + STRLEN(name + llen) + 1); + fname = xmalloc((size_t)i + STRLEN(name + llen) + 1); *tofree = fname; memmove(fname, fname_buf, (size_t)i); STRCPY(fname + i, name + llen); @@ -1422,7 +1422,7 @@ static void argv_add_base(typval_T *const basetv, typval_T **const argvars, int { if (basetv != NULL) { // Method call: base->Method() - memmove(&new_argvars[1], *argvars, sizeof(typval_T) * (*argcount)); + memmove(&new_argvars[1], *argvars, sizeof(typval_T) * (size_t)(*argcount)); new_argvars[0] = *basetv; (*argcount)++; *argvars = new_argvars; @@ -1475,7 +1475,7 @@ int call_func(const char_u *funcname, int len, typval_T *rettv, int argcount_in, if (fp == NULL) { // Make a copy of the name, if it comes from a funcref variable it could // be changed or deleted in the called function. - name = vim_strnsave(funcname, len); + name = vim_strnsave(funcname, (size_t)len); fname = fname_trans_sid(name, fname_buf, &tofree, &error); } @@ -1522,7 +1522,7 @@ int call_func(const char_u *funcname, int len, typval_T *rettv, int argcount_in, if (len > 0) { error = ERROR_NONE; argv_add_base(funcexe->basetv, &argvars, &argcount, argv, &argv_base); - nlua_typval_call((const char *)funcname, len, argvars, argcount, rettv); + nlua_typval_call((const char *)funcname, (size_t)len, argvars, argcount, rettv); } else { // v:lua was called directly; show its name in the emsg XFREE_CLEAR(name); @@ -1713,7 +1713,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp, && (*pp)[2] == KE_SNR) { *pp += 3; len = get_id_len((const char **)pp) + 3; - return (char_u *)xmemdupz(start, len); + return (char_u *)xmemdupz(start, (size_t)len); } // A name starting with "<SID>" or "<SNR>" is local to a script. But @@ -1766,8 +1766,8 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp, semsg(e_invexpr2, "v:lua"); goto theend; } - name = xmallocz(len); - memcpy(name, end+1, len); + name = xmallocz((size_t)len); + memcpy(name, end+1, (size_t)len); *pp = (char_u *)end+1+len; } else { name = vim_strsave(partial_name(lv.ll_tv->vval.v_partial)); @@ -1861,12 +1861,11 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp, emsg(_(e_usingsid)); goto theend; } - sid_buf_len = snprintf(sid_buf, sizeof(sid_buf), - "%" PRIdSCID "_", current_sctx.sc_sid); - lead += sid_buf_len; + sid_buf_len = + (size_t)snprintf(sid_buf, sizeof(sid_buf), "%" PRIdSCID "_", current_sctx.sc_sid); + lead += (int)sid_buf_len; } - } else if (!(flags & TFN_INT) - && builtin_function(lv.ll_name, lv.ll_name_len)) { + } else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, (int)lv.ll_name_len)) { semsg(_("E128: Function name must start with a capital or \"s:\": %s"), start); goto theend; @@ -1881,7 +1880,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp, } } - name = xmalloc(len + lead + 1); + name = xmalloc((size_t)len + (size_t)lead + 1); if (!skip && lead > 0) { name[0] = K_SPECIAL; name[1] = KS_EXTRA; @@ -1890,7 +1889,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp, memcpy(name + 3, sid_buf, sid_buf_len); } } - memmove(name + lead, lv.ll_name, len); + memmove(name + lead, lv.ll_name, (size_t)len); name[lead + len] = NUL; *pp = (char_u *)end; @@ -1904,7 +1903,7 @@ void ex_function(exarg_T *eap) { char_u *theline; char_u *line_to_free = NULL; - int c; + char_u c; int saved_did_emsg; bool saved_wait_return = need_wait_return; char_u *name = NULL; @@ -2387,9 +2386,9 @@ void ex_function(exarg_T *eap) // Ignore leading white space. p = skipwhite(p + 4); heredoc_trimmed = - vim_strnsave(theline, skipwhite(theline) - theline); + vim_strnsave(theline, (size_t)(skipwhite(theline) - theline)); } - skip_until = vim_strnsave(p, skiptowhite(p) - p); + skip_until = vim_strnsave(p, (size_t)(skiptowhite(p) - p)); do_concat = false; is_heredoc = true; } @@ -2397,7 +2396,7 @@ void ex_function(exarg_T *eap) } // Add the line to the function. - ga_grow(&newlines, 1 + sourcing_lnum_off); + ga_grow(&newlines, 1 + (int)sourcing_lnum_off); // Copy the line to newly allocated memory. get_one_sourceline() // allocates 250 bytes per line, this saves 80% on average. The cost @@ -3254,7 +3253,7 @@ void make_partial(dict_T *const selfdict, typval_T *const rettv) func_ptr_ref(pt->pt_func); } if (ret_pt->pt_argc > 0) { - size_t arg_size = sizeof(typval_T) * ret_pt->pt_argc; + size_t arg_size = sizeof(typval_T) * (size_t)ret_pt->pt_argc; pt->pt_argv = (typval_T *)xmalloc(arg_size); pt->pt_argc = ret_pt->pt_argc; for (i = 0; i < pt->pt_argc; i++) { @@ -3417,7 +3416,7 @@ hashitem_T *find_hi_in_scoped_ht(const char *name, hashtab_T **pht) while (current_funccal != NULL) { hashtab_T *ht = find_var_ht(name, namelen, &varname); if (ht != NULL && *varname != NUL) { - hi = hash_find_len(ht, varname, namelen - (varname - name)); + hi = hash_find_len(ht, varname, namelen - (size_t)(varname - name)); if (!HASHITEM_EMPTY(hi)) { *pht = ht; break; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index d4c21bb33f..7564b9326b 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1387,7 +1387,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, if (do_out) { if (otmp != NULL) { if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, - READ_FILTER) != OK) { + READ_FILTER, false) != OK) { if (!aborting()) { msg_putchar('\n'); semsg(_(e_notread), otmp); diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 2311e80de4..4562f6c751 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -184,7 +184,7 @@ void do_exmode(void) int save_msg_scroll; int prev_msg_row; linenr_T prev_line; - int changedtick; + varnumber_T changedtick; exmode_active = true; State = NORMAL; @@ -812,7 +812,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags) if (current_exception) { char *p = NULL; char_u *saved_sourcing_name; - int saved_sourcing_lnum; + linenr_T saved_sourcing_lnum; struct msglist *messages = NULL; struct msglist *next; @@ -1039,11 +1039,11 @@ void *getline_cookie(LineGetter fgetline, void *cookie) /// ":bwipeout", etc. /// /// @return the buffer number. -static int compute_buffer_local_count(int addr_type, int lnum, int offset) +static int compute_buffer_local_count(cmd_addr_T addr_type, linenr_T lnum, long offset) { buf_T *buf; buf_T *nextbuf; - int count = offset; + long count = offset; buf = firstbuf; while (buf->b_next != NULL && buf->b_fnum < lnum) { @@ -1445,7 +1445,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe while (ASCII_ISALNUM(*p)) { ++p; } - p = vim_strnsave(ea.cmd, p - ea.cmd); + p = vim_strnsave(ea.cmd, (size_t)(p - ea.cmd)); int ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, true, NULL); xfree(p); // If the autocommands did something and didn't cause an error, try @@ -1735,7 +1735,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe } break; case ADDR_QUICKFIX_VALID: - ea.line2 = qf_get_valid_size(&ea); + ea.line2 = (linenr_T)qf_get_valid_size(&ea); if (ea.line2 == 0) { ea.line2 = 1; } @@ -2259,7 +2259,7 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only) case 't': if (checkforcmd(&p, "tab", 3)) { if (!skip_only) { - long tabnr = get_address(eap, &eap->cmd, ADDR_TABS, eap->skip, skip_only, false, 1); + int tabnr = (int)get_address(eap, &eap->cmd, ADDR_TABS, eap->skip, skip_only, false, 1); if (tabnr == MAXLNUM) { cmdmod.tab = tabpage_index(curtab) + 1; @@ -2403,7 +2403,7 @@ int parse_cmd_address(exarg_T *eap, char **errormsg, bool silent) eap->line2 = 1; break; case ADDR_QUICKFIX: - eap->line2 = qf_get_cur_idx(eap); + eap->line2 = (linenr_T)qf_get_cur_idx(eap); break; case ADDR_QUICKFIX_VALID: eap->line2 = qf_get_cur_valid_idx(eap); @@ -2473,7 +2473,7 @@ int parse_cmd_address(exarg_T *eap, char **errormsg, bool silent) break; case ADDR_QUICKFIX_VALID: eap->line1 = 1; - eap->line2 = qf_get_valid_size(eap); + eap->line2 = (linenr_T)qf_get_valid_size(eap); if (eap->line2 == 0) { eap->line2 = 1; } @@ -3756,10 +3756,10 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) xp->xp_context = EXPAND_LANGUAGE; xp->xp_pattern = (char_u *)arg; } else { - if (strncmp(arg, "messages", p - arg) == 0 - || strncmp(arg, "ctype", p - arg) == 0 - || strncmp(arg, "time", p - arg) == 0 - || strncmp(arg, "collate", p - arg) == 0) { + if (strncmp(arg, "messages", (size_t)(p - arg)) == 0 + || strncmp(arg, "ctype", (size_t)(p - arg)) == 0 + || strncmp(arg, "time", (size_t)(p - arg)) == 0 + || strncmp(arg, "collate", (size_t)(p - arg)) == 0) { xp->xp_context = EXPAND_LOCALES; xp->xp_pattern = skipwhite((const char_u *)p); } else { @@ -3925,7 +3925,7 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in goto error; break; case ADDR_QUICKFIX: - lnum = qf_get_cur_idx(eap); + lnum = (linenr_T)qf_get_cur_idx(eap); break; case ADDR_QUICKFIX_VALID: lnum = qf_get_cur_valid_idx(eap); @@ -3970,13 +3970,13 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in goto error; break; case ADDR_QUICKFIX: - lnum = qf_get_size(eap); + lnum = (linenr_T)qf_get_size(eap); if (lnum == 0) { lnum = 1; } break; case ADDR_QUICKFIX_VALID: - lnum = qf_get_valid_size(eap); + lnum = (linenr_T)qf_get_valid_size(eap); if (lnum == 0) { lnum = 1; } @@ -4135,7 +4135,7 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in lnum = 1; break; case ADDR_QUICKFIX: - lnum = qf_get_cur_idx(eap); + lnum = (linenr_T)qf_get_cur_idx(eap); break; case ADDR_QUICKFIX_VALID: lnum = qf_get_cur_valid_idx(eap); @@ -4357,7 +4357,7 @@ static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) char_u *pos; char_u *ptr; int len; - int i; + size_t i; /* * Don't do it when ":vimgrep" is used for ":grep". @@ -4391,10 +4391,10 @@ static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) ++i; } len = (int)STRLEN(p); - new_cmdline = xmalloc(STRLEN(program) + (size_t)i * (len - 2) + 1); + new_cmdline = xmalloc(STRLEN(program) + i * (size_t)(len - 2) + 1); ptr = new_cmdline; while ((pos = (char_u *)strstr((char *)program, "$*")) != NULL) { - i = (int)(pos - program); + i = (size_t)(pos - program); memcpy(ptr, program, i); STRCPY(ptr += i, p); ptr += len; @@ -4818,8 +4818,8 @@ static int getargopt(exarg_T *eap) eap->force_ff = eap->cmd[eap->force_ff]; } else if (pp == &eap->force_enc) { // Make 'fileencoding' lower case. - for (p = eap->cmd + eap->force_enc; *p != NUL; ++p) { - *p = TOLOWER_ASC(*p); + for (p = eap->cmd + eap->force_enc; *p != NUL; p++) { + *p = (char_u)TOLOWER_ASC(*p); } } else { // Check ++bad= argument. Must be a single-byte character, "keep" or @@ -4856,7 +4856,7 @@ static int get_tabpage_arg(exarg_T *eap) } p_save = p; - tab_number = getdigits(&p, false, tab_number); + tab_number = (int)getdigits(&p, false, tab_number); if (relative == 0) { if (STRCMP(p, "$") == 0) { @@ -4896,7 +4896,7 @@ static int get_tabpage_arg(exarg_T *eap) eap->errmsg = e_invrange; tab_number = 0; } else { - tab_number = eap->line2; + tab_number = (int)eap->line2; if (!unaccept_arg0 && *skipwhite(*eap->cmdlinep) == '-') { tab_number--; if (tab_number < unaccept_arg0) { @@ -5243,7 +5243,7 @@ int uc_add_command(char_u *name, size_t name_len, char_u *rep, uint32_t argt, lo char_u *const p = vim_strnsave(name, name_len); cmd = USER_CMD_GA(gap, i); - memmove(cmd + 1, cmd, (gap->ga_len - i) * sizeof(ucmd_T)); + memmove(cmd + 1, cmd, (size_t)(gap->ga_len - i) * sizeof(ucmd_T)); ++gap->ga_len; @@ -5543,8 +5543,8 @@ static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def, int for (i = 0; i < (int)len; i++) { if (attr[i] == '=') { val = &attr[i + 1]; - vallen = len - i - 1; - attrlen = i; + vallen = len - (size_t)i - 1; + attrlen = (size_t)i; break; } } @@ -5666,7 +5666,7 @@ static void ex_command(exarg_T *eap) char_u *compl_arg = NULL; cmd_addr_T addr_type_arg = ADDR_NONE; int has_attr = (eap->arg[0] == '-'); - int name_len; + size_t name_len; p = eap->arg; @@ -5674,7 +5674,7 @@ static void ex_command(exarg_T *eap) while (*p == '-') { ++p; end = skiptowhite(p); - if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl, &compl_arg, + if (uc_scan_attr(p, (size_t)(end - p), &argt, &def, &flags, &compl, &compl_arg, &addr_type_arg) == FAIL) { return; } @@ -5772,7 +5772,7 @@ static void ex_delcommand(exarg_T *eap) --gap->ga_len; if (i < gap->ga_len) { - memmove(cmd, cmd + 1, (gap->ga_len - i) * sizeof(ucmd_T)); + memmove(cmd, cmd + 1, (size_t)(gap->ga_len - i) * sizeof(ucmd_T)); } } @@ -5800,9 +5800,9 @@ bool uc_split_args_iter(const char_u *arg, size_t arglen, size_t *end, char *buf size_t l = 0; for (; pos < arglen - 1; pos++) { if (arg[pos] == '\\' && (arg[pos + 1] == '\\' || ascii_iswhite(arg[pos + 1]))) { - buf[l++] = arg[++pos]; + buf[l++] = (char)arg[++pos]; } else { - buf[l++] = arg[pos]; + buf[l++] = (char)arg[pos]; if (ascii_iswhite(arg[pos + 1])) { *end = pos + 1; *len = l; @@ -5812,7 +5812,7 @@ bool uc_split_args_iter(const char_u *arg, size_t arglen, size_t *end, char *buf } if (pos < arglen && !ascii_iswhite(arg[pos])) { - buf[l++] = arg[pos]; + buf[l++] = (char)arg[pos]; } *len = l; @@ -5855,7 +5855,7 @@ static char_u *uc_split_args(char_u *arg, size_t *lenp) } } - buf = xmalloc(len + 1); + buf = xmalloc((size_t)len + 1); p = arg; q = buf; @@ -5886,7 +5886,7 @@ static char_u *uc_split_args(char_u *arg, size_t *lenp) *q++ = '"'; *q = 0; - *lenp = len; + *lenp = (size_t)len; return buf; } @@ -6109,7 +6109,7 @@ static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd, *buf++ = '\''; } if (eap->regname) { - *buf++ = eap->regname; + *buf++ = (char_u)eap->regname; } if (quote) { *buf = '\''; @@ -6257,7 +6257,7 @@ static void do_ucmd(exarg_T *eap) // K_SPECIAL has been put in the buffer as K_SPECIAL // KS_SPECIAL KE_FILLER, like for mappings, but // do_cmdline() doesn't handle that, so convert it back. - len = ksp - p; + len = (size_t)(ksp - p); if (len > 0) { memmove(q, p, len); q += len; @@ -6277,7 +6277,7 @@ static void do_ucmd(exarg_T *eap) ++end; // Take everything up to the '<' - len = start - p; + len = (size_t)(start - p); if (buf == NULL) { totlen += len; } else { @@ -6285,7 +6285,7 @@ static void do_ucmd(exarg_T *eap) q += len; } - len = uc_check_code(start, end - start, q, cmd, eap, + len = uc_check_code(start, (size_t)(end - start), q, cmd, eap, &split_buf, &split_len); if (len == (size_t)-1) { // no match, continue after '<' @@ -6461,7 +6461,7 @@ int parse_compl_arg(const char_u *value, int vallen, int *complp, uint32_t *argt for (i = 0; i < vallen; ++i) { if (value[i] == ',') { arg = &value[i + 1]; - arglen = vallen - i - 1; + arglen = (size_t)(vallen - i - 1); valend = i; break; } @@ -6605,7 +6605,7 @@ static void ex_quit(exarg_T *eap) win_T *wp; if (eap->addr_count > 0) { - int wnr = eap->line2; + linenr_T wnr = eap->line2; for (wp = firstwin; wp->w_next != NULL; wp = wp->w_next) { if (--wnr <= 0) { @@ -6880,7 +6880,7 @@ void tabpage_close_other(tabpage_T *tp, int forceit) static void ex_only(exarg_T *eap) { win_T *wp; - int wnr; + linenr_T wnr; if (eap->addr_count > 0) { wnr = eap->line2; @@ -7311,7 +7311,7 @@ static void ex_tabnext(exarg_T *eap) if (eap->arg && *eap->arg != NUL) { char_u *p = eap->arg; char_u *p_save = p; - tab_number = getdigits(&p, false, 0); + tab_number = (int)getdigits(&p, false, 0); if (p == p_save || *p_save == '-' || *p_save == '+' || *p != NUL || tab_number == 0) { // No numbers as argument. @@ -7322,7 +7322,7 @@ static void ex_tabnext(exarg_T *eap) if (eap->addr_count == 0) { tab_number = 1; } else { - tab_number = eap->line2; + tab_number = (int)eap->line2; if (tab_number < 1) { eap->errmsg = e_invrange; return; @@ -7415,12 +7415,12 @@ static void ex_resize(exarg_T *eap) win_T *wp = curwin; if (eap->addr_count > 0) { - n = eap->line2; + n = (int)eap->line2; for (wp = firstwin; wp->w_next != NULL && --n > 0; wp = wp->w_next) { } } - n = atol((char *)eap->arg); + n = (int)atol((char *)eap->arg); if (cmdmod.split & WSP_VERT) { if (*eap->arg == '-' || *eap->arg == '+') { n += wp->w_width; @@ -7442,7 +7442,7 @@ static void ex_resize(exarg_T *eap) static void ex_find(exarg_T *eap) { char_u *fname; - int count; + linenr_T count; fname = find_file_in_path(eap->arg, STRLEN(eap->arg), FNAME_MESS, TRUE, curbuf->b_ffname); @@ -7702,13 +7702,13 @@ static void ex_read(exarg_T *eap) return; } i = readfile(curbuf->b_ffname, curbuf->b_fname, - eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); + eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false); } else { if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) { (void)setaltfname(eap->arg, eap->arg, (linenr_T)1); } i = readfile(eap->arg, NULL, - eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); + eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false); } if (i != OK) { if (!aborting()) { @@ -8181,7 +8181,7 @@ static void ex_join(exarg_T *eap) } ++eap->line2; } - do_join(eap->line2 - eap->line1 + 1, !eap->forceit, TRUE, TRUE, true); + do_join((size_t)(eap->line2 - eap->line1 + 1), !eap->forceit, true, true, true); beginline(BL_WHITE | BL_FIX); ex_may_print(eap); } @@ -8661,7 +8661,7 @@ static void ex_normal(exarg_T *eap) } } if (len > 0) { - arg = xmalloc(STRLEN(eap->arg) + len + 1); + arg = xmalloc(STRLEN(eap->arg) + (size_t)len + 1); len = 0; for (p = eap->arg; *p != NUL; ++p) { arg[len++] = *p; @@ -8788,7 +8788,7 @@ static void ex_checkpath(exarg_T *eap) /// ":psearch" static void ex_psearch(exarg_T *eap) { - g_do_tagpreview = p_pvh; + g_do_tagpreview = (int)p_pvh; ex_findpat(eap); g_do_tagpreview = 0; } @@ -8851,7 +8851,7 @@ static void ex_findpat(exarg_T *eap) /// ":ptag", ":ptselect", ":ptjump", ":ptnext", etc. static void ex_ptag(exarg_T *eap) { - g_do_tagpreview = p_pvh; // will be reset to 0 in ex_tag_cmd() + g_do_tagpreview = (int)p_pvh; // will be reset to 0 in ex_tag_cmd() ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1); } @@ -8861,7 +8861,7 @@ static void ex_pedit(exarg_T *eap) win_T *curwin_save = curwin; // Open the preview window or popup and make it the current window. - g_do_tagpreview = p_pvh; + g_do_tagpreview = (int)p_pvh; prepare_tagpreview(true); // Edit the file. @@ -9326,7 +9326,7 @@ static char_u *arg_all(void) } // allocate memory - retval = xmalloc(len + 1); + retval = xmalloc((size_t)len + 1); } return retval; diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 282e25e10e..25c99af41b 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -176,7 +176,7 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr) /// /// @return FAIL for failure, NOTDONE for directory (failure), or OK int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip, - linenr_T lines_to_read, exarg_T *eap, int flags) + linenr_T lines_to_read, exarg_T *eap, int flags, bool silent) { int fd = 0; int newfile = (flags & READ_NEW); @@ -472,10 +472,12 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski return FAIL; } } - if (dir_of_file_exists(fname)) { - filemess(curbuf, sfname, (char_u *)new_file_message(), 0); - } else { - filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0); + if (!silent) { + if (dir_of_file_exists(fname)) { + filemess(curbuf, sfname, (char_u *)new_file_message(), 0); + } else { + filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0); + } } // Even though this is a new file, it might have been // edited before and deleted. Get the old marks. @@ -658,7 +660,7 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski // Autocommands may add lines to the file, need to check if it is empty wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY); - if (!recoverymode && !filtering && !(flags & READ_DUMMY)) { + if (!recoverymode && !filtering && !(flags & READ_DUMMY) && !silent) { if (!read_stdin && !read_buffer) { filemess(curbuf, sfname, (char_u *)"", 0); } @@ -1788,7 +1790,7 @@ failed: return OK; // an interrupt isn't really an error } - if (!filtering && !(flags & READ_DUMMY)) { + if (!filtering && !(flags & READ_DUMMY) && !silent) { add_quoted_fname((char *)IObuff, IOSIZE, curbuf, (const char *)sfname); c = false; @@ -5191,7 +5193,7 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options) curbuf->b_flags |= BF_CHECK_RO; // check for RO again keep_filetype = true; // don't detect 'filetype' if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0, - (linenr_T)MAXLNUM, &ea, flags) != OK) { + (linenr_T)MAXLNUM, &ea, flags, false) != OK) { if (!aborting()) { semsg(_("E321: Could not reload \"%s\""), buf->b_fname); } diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 44da4ec223..56517c1741 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -32,6 +32,7 @@ #include "nvim/quickfix.h" #include "nvim/strings.h" #include "nvim/tag.h" +#include "nvim/window.h" #if defined(UNIX) # include <sys/wait.h> #endif diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 5646b2db15..5c2f494450 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -994,7 +994,7 @@ void ml_recover(bool checkext) */ if (curbuf->b_ffname != NULL) { orig_file_status = readfile(curbuf->b_ffname, NULL, (linenr_T)0, - (linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW); + (linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW, false); } // Use the 'fileformat' and 'fileencoding' as stored in the swap file. @@ -1069,7 +1069,7 @@ void ml_recover(bool checkext) line_count = pp->pb_pointer[idx].pe_line_count; if (readfile(curbuf->b_ffname, NULL, lnum, pp->pb_pointer[idx].pe_old_lnum - 1, line_count, - NULL, 0) != OK) { + NULL, 0, false) != OK) { cannot_open = true; } else { lnum += line_count; diff --git a/src/nvim/os/pty_process_win.c b/src/nvim/os/pty_process_win.c index 4fb9e30a96..5bbd22c610 100644 --- a/src/nvim/os/pty_process_win.c +++ b/src/nvim/os/pty_process_win.c @@ -4,7 +4,6 @@ #include <assert.h> #include <stdbool.h> #include <stdlib.h> -#include <winpty_constants.h> #include "nvim/ascii.h" #include "nvim/mbyte.h" // for utf8_to_utf16, utf16_to_utf8 @@ -23,11 +22,7 @@ static void CALLBACK pty_process_finish1(void *context, BOOLEAN unused) PtyProcess *ptyproc = (PtyProcess *)context; Process *proc = (Process *)ptyproc; - if (ptyproc->type == kConpty - && ptyproc->object.conpty != NULL) { - os_conpty_free(ptyproc->object.conpty); - ptyproc->object.conpty = NULL; - } + os_conpty_free(ptyproc->conpty); uv_timer_init(&proc->loop->uv, &ptyproc->wait_eof_timer); ptyproc->wait_eof_timer.data = (void *)ptyproc; uv_timer_start(&ptyproc->wait_eof_timer, wait_eof_timer_cb, 200, 200); @@ -39,10 +34,6 @@ int pty_process_spawn(PtyProcess *ptyproc) { Process *proc = (Process *)ptyproc; int status = 0; - winpty_error_ptr_t err = NULL; - winpty_config_t *cfg = NULL; - winpty_spawn_config_t *spawncfg = NULL; - winpty_t *winpty_object = NULL; conpty_t *conpty_object = NULL; char *in_name = NULL; char *out_name = NULL; @@ -56,38 +47,11 @@ int pty_process_spawn(PtyProcess *ptyproc) assert(proc->err.closed); - if (os_has_conpty_working()) { - if ((conpty_object = - os_conpty_init(&in_name, &out_name, ptyproc->width, ptyproc->height)) != NULL) { - ptyproc->type = kConpty; - } - } - - if (ptyproc->type == kWinpty) { - cfg = winpty_config_new(WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION, &err); - if (cfg == NULL) { - emsg = "winpty_config_new failed"; - goto cleanup; - } - - winpty_config_set_initial_size(cfg, ptyproc->width, ptyproc->height); - winpty_object = winpty_open(cfg, &err); - if (winpty_object == NULL) { - emsg = "winpty_open failed"; - goto cleanup; - } - - status = utf16_to_utf8(winpty_conin_name(winpty_object), -1, &in_name); - if (status != 0) { - emsg = "utf16_to_utf8(winpty_conin_name) failed"; - goto cleanup; - } - - status = utf16_to_utf8(winpty_conout_name(winpty_object), -1, &out_name); - if (status != 0) { - emsg = "utf16_to_utf8(winpty_conout_name) failed"; - goto cleanup; - } + if (!os_has_conpty_working() + || (conpty_object = + os_conpty_init(&in_name, &out_name, ptyproc->width, ptyproc->height)) == NULL) { + status = UV_ENOSYS; + goto cleanup; } if (!proc->in.closed) { @@ -130,44 +94,15 @@ int pty_process_spawn(PtyProcess *ptyproc) goto cleanup; } - if (ptyproc->type == kConpty) { - if (!os_conpty_spawn(conpty_object, - &process_handle, - NULL, - cmd_line, - cwd, - env)) { - emsg = "os_conpty_spawn failed"; - status = (int)GetLastError(); - goto cleanup; - } - } else { - spawncfg = winpty_spawn_config_new(WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN, - NULL, // Optional application name - cmd_line, - cwd, - env, - &err); - if (spawncfg == NULL) { - emsg = "winpty_spawn_config_new failed"; - goto cleanup; - } - - DWORD win_err = 0; - if (!winpty_spawn(winpty_object, - spawncfg, - &process_handle, - NULL, // Optional thread handle - &win_err, - &err)) { - if (win_err) { - status = (int)win_err; - emsg = "failed to spawn process"; - } else { - emsg = "winpty_spawn failed"; - } - goto cleanup; - } + if (!os_conpty_spawn(conpty_object, + &process_handle, + NULL, + cmd_line, + cwd, + env)) { + emsg = "os_conpty_spawn failed"; + status = (int)GetLastError(); + goto cleanup; } proc->pid = (int)GetProcessId(process_handle); @@ -186,11 +121,8 @@ int pty_process_spawn(PtyProcess *ptyproc) uv_run(&proc->loop->uv, UV_RUN_ONCE); } - (ptyproc->type == kConpty) ? - (void *)(ptyproc->object.conpty = conpty_object) : - (void *)(ptyproc->object.winpty = winpty_object); + ptyproc->conpty = conpty_object; ptyproc->process_handle = process_handle; - winpty_object = NULL; conpty_object = NULL; process_handle = NULL; @@ -200,16 +132,7 @@ cleanup: ELOG("pty_process_spawn(%s): %s: error code: %d", proc->argv[0], emsg, status); status = os_translate_sys_error(status); - } else if (err != NULL) { - status = (int)winpty_error_code(err); - ELOG("pty_process_spawn(%s): %s: error code: %d", - proc->argv[0], emsg, status); - status = translate_winpty_error(status); } - winpty_error_free(err); - winpty_config_free(cfg); - winpty_spawn_config_free(spawncfg); - winpty_free(winpty_object); os_conpty_free(conpty_object); xfree(in_name); xfree(out_name); @@ -232,12 +155,7 @@ const char *pty_process_tty_name(PtyProcess *ptyproc) void pty_process_resize(PtyProcess *ptyproc, uint16_t width, uint16_t height) FUNC_ATTR_NONNULL_ALL { - if (ptyproc->type == kConpty - && ptyproc->object.conpty != NULL) { - os_conpty_set_size(ptyproc->object.conpty, width, height); - } else if (ptyproc->object.winpty != NULL) { - winpty_set_size(ptyproc->object.winpty, width, height, NULL); - } + os_conpty_set_size(ptyproc->conpty, width, height); } void pty_process_close(PtyProcess *ptyproc) @@ -255,11 +173,6 @@ void pty_process_close(PtyProcess *ptyproc) void pty_process_close_master(PtyProcess *ptyproc) FUNC_ATTR_NONNULL_ALL { - if (ptyproc->type == kWinpty - && ptyproc->object.winpty != NULL) { - winpty_free(ptyproc->object.winpty); - ptyproc->object.winpty = NULL; - } } void pty_process_teardown(Loop *loop) @@ -434,40 +347,6 @@ static void quote_cmd_arg(char *dest, size_t dest_remaining, const char *src) } } -/// Translate winpty error code to libuv error. -/// -/// @param[in] winpty_errno Winpty error code returned by winpty_error_code -/// function. -/// -/// @returns Error code of libuv error. -int translate_winpty_error(int winpty_errno) -{ - if (winpty_errno <= 0) { - return winpty_errno; // If < 0 then it's already a libuv error. - } - - switch (winpty_errno) { - case WINPTY_ERROR_OUT_OF_MEMORY: - return UV_ENOMEM; - case WINPTY_ERROR_SPAWN_CREATE_PROCESS_FAILED: - return UV_EAI_FAIL; - case WINPTY_ERROR_LOST_CONNECTION: - return UV_ENOTCONN; - case WINPTY_ERROR_AGENT_EXE_MISSING: - return UV_ENOENT; - case WINPTY_ERROR_UNSPECIFIED: - return UV_UNKNOWN; - case WINPTY_ERROR_AGENT_DIED: - return UV_ESRCH; - case WINPTY_ERROR_AGENT_TIMEOUT: - return UV_ETIMEDOUT; - case WINPTY_ERROR_AGENT_CREATION_FAILED: - return UV_EAI_FAIL; - default: - return UV_UNKNOWN; - } -} - typedef struct EnvNode { wchar_t *str; size_t len; @@ -484,7 +363,7 @@ static int build_env_block(dict_T *denv, wchar_t **env_block) { const size_t denv_size = (size_t)tv_dict_len(denv); size_t env_block_len = 0; - int rc; + int rc = 0; char **env = tv_dict_to_env(denv); QUEUE *q; diff --git a/src/nvim/os/pty_process_win.h b/src/nvim/os/pty_process_win.h index d1737fd63a..ed7d765ac7 100644 --- a/src/nvim/os/pty_process_win.h +++ b/src/nvim/os/pty_process_win.h @@ -2,25 +2,15 @@ #define NVIM_OS_PTY_PROCESS_WIN_H #include <uv.h> -#include <winpty.h> #include "nvim/event/process.h" #include "nvim/lib/queue.h" #include "nvim/os/pty_conpty_win.h" -typedef enum { - kWinpty, - kConpty, -} PtyType; - typedef struct pty_process { Process process; uint16_t width, height; - union { - winpty_t *winpty; - conpty_t *conpty; - } object; - PtyType type; + conpty_t *conpty; HANDLE finish_wait; HANDLE process_handle; uv_timer_t wait_eof_timer; @@ -38,8 +28,7 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data) rv.process = process_init(loop, kProcessTypePty, data); rv.width = 80; rv.height = 24; - rv.object.winpty = NULL; - rv.type = kWinpty; + rv.conpty = NULL; rv.finish_wait = NULL; rv.process_handle = NULL; return rv; diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 30419fe253..03552a0a19 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -5744,7 +5744,7 @@ static buf_T *load_dummy_buffer(char *fname, char *dirname_start, char *resultin newbuf_to_wipe.br_buf = NULL; readfile_result = readfile((char_u *)fname, NULL, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, NULL, - READ_NEW | READ_DUMMY); + READ_NEW | READ_DUMMY, false); newbuf->b_locked--; if (readfile_result == OK && !got_int diff --git a/src/nvim/search.c b/src/nvim/search.c index 4fc5ac93aa..48df289831 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -5093,26 +5093,30 @@ static int fuzzy_match_item_compare(const void *const s1, const void *const s2) /// for each item or use 'item_cb' Funcref function to get the string. /// If 'retmatchpos' is true, then return a list of positions where 'str' /// matches for each item. -static void fuzzy_match_in_list(list_T *const items, char_u *const str, const bool matchseq, +static void fuzzy_match_in_list(list_T *const l, char_u *const str, const bool matchseq, const char_u *const key, Callback *const item_cb, - const bool retmatchpos, list_T *const fmatchlist) + const bool retmatchpos, list_T *const fmatchlist, + const long max_matches) FUNC_ATTR_NONNULL_ARG(2, 5, 7) { - const long len = tv_list_len(items); + long len = tv_list_len(l); if (len == 0) { return; } + if (max_matches > 0 && len > max_matches) { + len = max_matches; + } - fuzzyItem_T *const ptrs = xcalloc(len, sizeof(fuzzyItem_T)); - long i = 0; - bool found_match = false; + fuzzyItem_T *const items = xcalloc(len, sizeof(fuzzyItem_T)); + long match_count = 0; uint32_t matches[MAX_FUZZY_MATCHES]; // For all the string items in items, get the fuzzy matching score - TV_LIST_ITER(items, li, { - ptrs[i].idx = i; - ptrs[i].item = li; - ptrs[i].score = SCORE_NONE; + TV_LIST_ITER(l, li, { + if (max_matches > 0 && match_count >= max_matches) { + break; + } + char_u *itemstr = NULL; typval_T rettv; rettv.v_type = VAR_UNKNOWN; @@ -5143,31 +5147,33 @@ static void fuzzy_match_in_list(list_T *const items, char_u *const str, const bo int score; if (itemstr != NULL && fuzzy_match(itemstr, str, matchseq, &score, matches, - sizeof(matches) / sizeof(matches[0]))) { + MAX_FUZZY_MATCHES)) { + items[match_count].idx = match_count; + items[match_count].item = li; + items[match_count].score = score; + // Copy the list of matching positions in itemstr to a list, if // 'retmatchpos' is set. if (retmatchpos) { - ptrs[i].lmatchpos = tv_list_alloc(kListLenMayKnow); + items[match_count].lmatchpos = tv_list_alloc(kListLenMayKnow); int j = 0; const char_u *p = str; while (*p != NUL) { if (!ascii_iswhite(utf_ptr2char(p))) { - tv_list_append_number(ptrs[i].lmatchpos, matches[j]); + tv_list_append_number(items[match_count].lmatchpos, matches[j]); j++; } MB_PTR_ADV(p); } } - ptrs[i].score = score; - found_match = true; + match_count++; } - i++; tv_clear(&rettv); }); - if (found_match) { + if (match_count > 0) { // Sort the list by the descending order of the match score - qsort(ptrs, len, sizeof(fuzzyItem_T), fuzzy_match_item_compare); + qsort(items, match_count, sizeof(fuzzyItem_T), fuzzy_match_item_compare); // For matchfuzzy(), return a list of matched strings. // ['str1', 'str2', 'str3'] @@ -5176,48 +5182,49 @@ static void fuzzy_match_in_list(list_T *const items, char_u *const str, const bo // is a list of lists where each list item is a list of matched // character positions. The third item is a list of matching scores. // [['str1', 'str2', 'str3'], [[1, 3], [1, 3], [1, 3]]] - list_T *l; + list_T *retlist; if (retmatchpos) { const listitem_T *const li = tv_list_find(fmatchlist, 0); assert(li != NULL && TV_LIST_ITEM_TV(li)->vval.v_list != NULL); - l = TV_LIST_ITEM_TV(li)->vval.v_list; + retlist = TV_LIST_ITEM_TV(li)->vval.v_list; } else { - l = fmatchlist; + retlist = fmatchlist; } // Copy the matching strings with a valid score to the return list - for (i = 0; i < len; i++) { - if (ptrs[i].score == SCORE_NONE) { + for (long i = 0; i < match_count; i++) { + if (items[i].score == SCORE_NONE) { break; } - tv_list_append_tv(l, TV_LIST_ITEM_TV(ptrs[i].item)); + tv_list_append_tv(retlist, TV_LIST_ITEM_TV(items[i].item)); } // next copy the list of matching positions if (retmatchpos) { const listitem_T *li = tv_list_find(fmatchlist, -2); assert(li != NULL && TV_LIST_ITEM_TV(li)->vval.v_list != NULL); - l = TV_LIST_ITEM_TV(li)->vval.v_list; - for (i = 0; i < len; i++) { - if (ptrs[i].score == SCORE_NONE) { + retlist = TV_LIST_ITEM_TV(li)->vval.v_list; + + for (long i = 0; i < match_count; i++) { + if (items[i].score == SCORE_NONE) { break; } - tv_list_append_list(l, ptrs[i].lmatchpos); + tv_list_append_list(retlist, items[i].lmatchpos); } // copy the matching scores li = tv_list_find(fmatchlist, -1); assert(li != NULL && TV_LIST_ITEM_TV(li)->vval.v_list != NULL); - l = TV_LIST_ITEM_TV(li)->vval.v_list; - for (i = 0; i < len; i++) { - if (ptrs[i].score == SCORE_NONE) { + retlist = TV_LIST_ITEM_TV(li)->vval.v_list; + for (long i = 0; i < match_count; i++) { + if (items[i].score == SCORE_NONE) { break; } - tv_list_append_number(l, ptrs[i].score); + tv_list_append_number(retlist, items[i].score); } } } - xfree(ptrs); + xfree(items); } /// Do fuzzy matching. Returns the list of matched strings in 'rettv'. @@ -5239,6 +5246,7 @@ static void do_fuzzymatch(const typval_T *const argvars, typval_T *const rettv, Callback cb = CALLBACK_NONE; const char_u *key = NULL; bool matchseq = false; + long max_matches = 0; if (argvars[2].v_type != VAR_UNKNOWN) { if (argvars[2].v_type != VAR_DICT || argvars[2].vval.v_dict == NULL) { emsg(_(e_dictreq)); @@ -5248,8 +5256,8 @@ static void do_fuzzymatch(const typval_T *const argvars, typval_T *const rettv, // To search a dict, either a callback function or a key can be // specified. dict_T *const d = argvars[2].vval.v_dict; - const dictitem_T *const di = tv_dict_find(d, "key", -1); - if (di != NULL) { + const dictitem_T *di; + if ((di = tv_dict_find(d, "key", -1)) != NULL) { if (di->di_tv.v_type != VAR_STRING || di->di_tv.vval.v_string == NULL || *di->di_tv.vval.v_string == NUL) { semsg(_(e_invarg2), tv_get_string(&di->di_tv)); @@ -5259,7 +5267,14 @@ static void do_fuzzymatch(const typval_T *const argvars, typval_T *const rettv, } else if (!tv_dict_get_callback(d, "text_cb", -1, &cb)) { semsg(_(e_invargval), "text_cb"); return; + } else if ((di = tv_dict_find(d, "limit", -1)) != NULL) { + if (di->di_tv.v_type != VAR_NUMBER) { + semsg(_(e_invarg2), tv_get_string(&di->di_tv)); + return; + } + max_matches = (long)tv_get_number_chk(&di->di_tv, NULL); } + if (tv_dict_find(d, "matchseq", -1) != NULL) { matchseq = true; } @@ -5278,7 +5293,7 @@ static void do_fuzzymatch(const typval_T *const argvars, typval_T *const rettv, } fuzzy_match_in_list(argvars[0].vval.v_list, (char_u *)tv_get_string(&argvars[1]), matchseq, key, - &cb, retmatchpos, rettv->vval.v_list); + &cb, retmatchpos, rettv->vval.v_list, max_matches); callback_free(&cb); } diff --git a/src/nvim/sign.c b/src/nvim/sign.c index a50b4a5a99..6685c2f231 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -5,6 +5,7 @@ // sign.c: functions for managing with signs // +#include "nvim/sign.h" #include "nvim/ascii.h" #include "nvim/buffer.h" @@ -17,9 +18,9 @@ #include "nvim/move.h" #include "nvim/option.h" #include "nvim/screen.h" -#include "nvim/sign.h" #include "nvim/syntax.h" #include "nvim/vim.h" +#include "nvim/window.h" /// Struct to hold the sign properties. typedef struct sign sign_T; diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 659a3db10e..39c9aacad0 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -585,7 +585,8 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose) && tagp2.user_data) { XFREE_CLEAR(tagstack[tagstackidx].user_data); tagstack[tagstackidx].user_data = vim_strnsave(tagp2.user_data, - tagp2.user_data_end - tagp2.user_data); + (size_t)(tagp2.user_data_end - + tagp2.user_data)); } tagstackidx++; @@ -972,7 +973,7 @@ static int add_llist_tags(char_u *tag, int num_matches, char_u **matches) if (cmd_len > (CMDBUFFSIZE - 5)) { cmd_len = CMDBUFFSIZE - 5; } - snprintf((char *)cmd + len, CMDBUFFSIZE + 1 - len, + snprintf((char *)cmd + len, (size_t)(CMDBUFFSIZE + 1 - len), "%.*s", cmd_len, cmd_start); len += cmd_len; @@ -1118,7 +1119,7 @@ static void prepare_pats(pat_T *pats, int has_re) } } if (p_tl != 0 && pats->headlen > p_tl) { // adjust for 'taglength' - pats->headlen = p_tl; + pats->headlen = (int)p_tl; } } @@ -1476,7 +1477,7 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int /* * Allocate memory for the buffers that are used */ - lbuf = xmalloc(lbuf_size); + lbuf = xmalloc((size_t)lbuf_size); tag_fname = xmalloc(MAXPATHL + 1); for (mtt = 0; mtt < MT_COUNT; mtt++) { ga_init(&ga_match[mtt], sizeof(char_u *), 100); @@ -1503,14 +1504,14 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int if (orgpat.len > 3 && pat[orgpat.len - 3] == '@' && ASCII_ISALPHA(pat[orgpat.len - 2]) && ASCII_ISALPHA(pat[orgpat.len - 1])) { - saved_pat = vim_strnsave(pat, orgpat.len - 3); + saved_pat = vim_strnsave(pat, (size_t)orgpat.len - 3); help_lang_find = &pat[orgpat.len - 2]; orgpat.pat = saved_pat; orgpat.len -= 3; } } if (p_tl != 0 && orgpat.len > p_tl) { // adjust for 'taglength' - orgpat.len = p_tl; + orgpat.len = (int)p_tl; } save_emsg_off = emsg_off; @@ -1854,7 +1855,7 @@ parse_line: if (lbuf[lbuf_size - 2] != NUL && !use_cscope) { lbuf_size *= 2; xfree(lbuf); - lbuf = xmalloc(lbuf_size); + lbuf = xmalloc((size_t)lbuf_size); // this will try the same thing again, make sure the offset is // different search_info.curr_offset = 0; @@ -1879,7 +1880,7 @@ parse_line: */ cmplen = (int)(tagp.tagname_end - tagp.tagname); if (p_tl != 0 && cmplen > p_tl) { // adjust for 'taglength' - cmplen = p_tl; + cmplen = (int)p_tl; } if (has_re && orgpat.headlen < cmplen) { cmplen = orgpat.headlen; @@ -2006,7 +2007,7 @@ parse_line: */ cmplen = (int)(tagp.tagname_end - tagp.tagname); if (p_tl != 0 && cmplen > p_tl) { // adjust for 'taglength' - cmplen = p_tl; + cmplen = (int)p_tl; } // if tag length does not match, don't try comparing if (orgpat.len != cmplen) { @@ -2043,13 +2044,13 @@ parse_line: orgpat.regmatch.rm_ic = TRUE; } } - *tagp.tagname_end = cc; - match_re = TRUE; + *tagp.tagname_end = (char_u)cc; + match_re = true; } // If a match is found, add it to ht_match[] and ga_match[]. if (match) { - int len = 0; + size_t len = 0; if (use_cscope) { // Don't change the ordering, always use the same table. @@ -2092,7 +2093,7 @@ parse_line: // detecting duplicates. // The format is {tagname}@{lang}NUL{heuristic}NUL *tagp.tagname_end = NUL; - len = (int)(tagp.tagname_end - tagp.tagname); + len = (size_t)(tagp.tagname_end - tagp.tagname); mfp = xmalloc(sizeof(char_u) + len + 10 + ML_EXTRA + 1); p = mfp; @@ -2118,7 +2119,7 @@ parse_line: } if (tagp.command + 2 < temp_end) { - len = (int)(temp_end - tagp.command - 2); + len = (size_t)(temp_end - tagp.command - 2); mfp = xmalloc(len + 2); STRLCPY(mfp, tagp.command + 2, len + 1); } else { @@ -2126,7 +2127,7 @@ parse_line: } get_it_again = false; } else { - len = (int)(tagp.tagname_end - tagp.tagname); + len = (size_t)(tagp.tagname_end - tagp.tagname); mfp = xmalloc(sizeof(char_u) + len + 1); STRLCPY(mfp, tagp.tagname, len + 1); @@ -2144,10 +2145,10 @@ parse_line: // other tag: <mtt><tag_fname><0x02><0x02><lbuf><NUL> // without Emacs tags: <mtt><tag_fname><0x02><lbuf><NUL> // Here <mtt> is the "mtt" value plus 1 to avoid NUL. - len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3; + len = tag_fname_len + STRLEN(lbuf) + 3; mfp = xmalloc(sizeof(char_u) + len + 1); p = mfp; - p[0] = mtt + 1; + p[0] = (char_u)(mtt + 1); STRCPY(p + 1, tag_fname); #ifdef BACKSLASH_IN_FILENAME // Ignore differences in slashes, avoid adding @@ -2263,7 +2264,7 @@ findtag_end: } if (match_count > 0) { - matches = xmalloc(match_count * sizeof(char_u *)); + matches = xmalloc((size_t)match_count * sizeof(char_u *)); } else { matches = NULL; } @@ -2276,7 +2277,7 @@ findtag_end: } else { if (!name_only) { // Change mtt back to zero-based. - *mfp = *mfp - 1; + *mfp = (char_u)(*mfp - 1); // change the TAG_SEP back to NUL for (p = mfp + 1; *p != NUL; p++) { @@ -2541,7 +2542,7 @@ static size_t matching_line_len(const char_u *const lbuf) // does the same thing as parse_match() p += STRLEN(p) + 1; - return (p - lbuf) + STRLEN(p); + return (size_t)(p - lbuf) + STRLEN(p); } /// Parse a line from a matching tag. Does not change the line itself. @@ -2638,7 +2639,7 @@ static char_u *tag_full_fname(tagptrs_T *tagp) int c = *tagp->fname_end; *tagp->fname_end = NUL; char_u *fullname = expand_tag_fname(tagp->fname, tagp->tag_fname, false); - *tagp->fname_end = c; + *tagp->fname_end = (char_u)c; return fullname; } @@ -2878,7 +2879,7 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help) found = 0; } } - *tagp.tagname_end = cc; + *tagp.tagname_end = (char_u)cc; } if (found == 0) { emsg(_("E434: Can't find tag pattern")); @@ -3040,7 +3041,7 @@ static int test_for_current(char_u *fname, char_u *fname_end, char_u *tag_fname, retval = (path_full_compare(fullname, buf_ffname, true, true) & kEqualFiles); xfree(fullname); - *fname_end = c; + *fname_end = (char_u)c; } return retval; @@ -3131,7 +3132,7 @@ int expand_tags(int tagnames, char_u *pat, int *num_file, char_u ***file) size_t len; parse_match((*file)[i], &t_p); - len = t_p.tagname_end - t_p.tagname; + len = (size_t)(t_p.tagname_end - t_p.tagname); if (len > name_buf_size - 3) { char_u *buf; @@ -3145,8 +3146,8 @@ int expand_tags(int tagnames, char_u *pat, int *num_file, char_u ***file) name_buf[len++] = (t_p.tagkind != NULL && *t_p.tagkind) ? *t_p.tagkind : 'f'; name_buf[len++] = 0; - memmove((*file)[i] + len, t_p.fname, t_p.fname_end - t_p.fname); - (*file)[i][len + (t_p.fname_end - t_p.fname)] = 0; + memmove((*file)[i] + len, t_p.fname, (size_t)(t_p.fname_end - t_p.fname)); + (*file)[i][len + (size_t)(t_p.fname_end - t_p.fname)] = 0; memmove((*file)[i], name_buf, len); } } diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 7a52d0a044..6872eb3bb7 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -258,6 +258,7 @@ let s:filename_checks = { \ 'rnoweb': ['file.rnw', 'file.snw'], \ 'rrst': ['file.rrst', 'file.srst'], \ 'template': ['file.tmpl'], + \ 'html': ['file.html', 'file.htm', 'file.cshtml'], \ 'htmlm4': ['file.html.m4'], \ 'httest': ['file.htt', 'file.htb'], \ 'ibasic': ['file.iba', 'file.ibi'], diff --git a/src/nvim/testdir/test_matchfuzzy.vim b/src/nvim/testdir/test_matchfuzzy.vim index abcc9b40c1..d53f8b0f4d 100644 --- a/src/nvim/testdir/test_matchfuzzy.vim +++ b/src/nvim/testdir/test_matchfuzzy.vim @@ -245,4 +245,16 @@ func Test_matchfuzzypos_mbyte() call assert_equal([['xффйд'], [[2, 3, 4]], [168]], matchfuzzypos(['xффйд'], 'фйд')) endfunc +" Test for matchfuzzy() with limit +func Test_matchfuzzy_limit() + let x = ['1', '2', '3', '2'] + call assert_equal(['2', '2'], x->matchfuzzy('2')) + call assert_equal(['2', '2'], x->matchfuzzy('2', #{})) + call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 0})) + call assert_equal(['2'], x->matchfuzzy('2', #{limit: 1})) + call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 2})) + call assert_equal(['2', '2'], x->matchfuzzy('2', #{limit: 3})) + call assert_fails("call matchfuzzy(x, '2', #{limit: '2'})", 'E475:') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 691b2ea9da..399ad325d1 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -13,6 +13,7 @@ #include "nvim/option.h" #include "nvim/os/input.h" #include "nvim/os/os.h" +#include "nvim/tui/tui.h" #include "nvim/tui/input.h" #include "nvim/vim.h" #ifdef WIN32 @@ -41,6 +42,7 @@ void tinput_init(TermInput *input, Loop *loop) input->paste = 0; input->in_fd = STDIN_FILENO; input->waiting_for_bg_response = 0; + input->extkeys_type = kExtkeysNone; // The main thread is waiting for the UI thread to call CONTINUE, so it can // safely access global variables. input->ttimeout = (bool)p_ttimeout; @@ -344,6 +346,39 @@ static void tk_getkeys(TermInput *input, bool force) forward_modified_utf8(input, &key); } else if (key.type == TERMKEY_TYPE_MOUSE) { forward_mouse_event(input, &key); + } else if (key.type == TERMKEY_TYPE_UNKNOWN_CSI) { + // There is no specified limit on the number of parameters a CSI sequence can contain, so just + // allocate enough space for a large upper bound + long args[16]; + size_t nargs = 16; + unsigned long cmd; + if (termkey_interpret_csi(input->tk, &key, args, &nargs, &cmd) == TERMKEY_RES_KEY) { + uint8_t intermediate = (cmd >> 16) & 0xFF; + uint8_t initial = (cmd >> 8) & 0xFF; + uint8_t command = cmd & 0xFF; + + // Currently unused + (void)intermediate; + + if (input->waiting_for_csiu_response > 0) { + if (initial == '?' && command == 'u') { + // The first (and only) argument contains the current progressive + // enhancement flags. Only enable CSI u mode if the first bit + // (disambiguate escape codes) is not already set + if (nargs > 0 && (args[0] & 0x1) == 0) { + input->extkeys_type = kExtkeysCSIu; + } else { + input->extkeys_type = kExtkeysNone; + } + } else if (initial == '?' && command == 'c') { + // Received Primary Device Attributes response + input->waiting_for_csiu_response = 0; + tui_enable_extkeys(input->tui_data); + } else { + input->waiting_for_csiu_response--; + } + } + } } } diff --git a/src/nvim/tui/input.h b/src/nvim/tui/input.h index 2a8ea32a88..84daf40744 100644 --- a/src/nvim/tui/input.h +++ b/src/nvim/tui/input.h @@ -6,6 +6,13 @@ #include "nvim/event/stream.h" #include "nvim/event/time.h" +#include "nvim/tui/tui.h" + +typedef enum { + kExtkeysNone, + kExtkeysCSIu, + kExtkeysXterm, +} ExtkeysType; typedef struct term_input { int in_fd; @@ -14,6 +21,8 @@ typedef struct term_input { bool waiting; bool ttimeout; int8_t waiting_for_bg_response; + int8_t waiting_for_csiu_response; + ExtkeysType extkeys_type; long ttimeoutlen; TermKey *tk; #if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18 @@ -25,6 +34,7 @@ typedef struct term_input { RBuffer *key_buffer; uv_mutex_t key_buffer_mutex; uv_cond_t key_buffer_cond; + TUIData *tui_data; } TermInput; #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 4b5ad4cff8..61c6dc5ca3 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -71,7 +71,7 @@ typedef struct { int top, bot, left, right; } Rect; -typedef struct { +struct TUIData { UIBridgeData *bridge; Loop *loop; unibi_var_t params[9]; @@ -132,9 +132,10 @@ typedef struct { int set_underline_style; int set_underline_color; int enable_extended_keys, disable_extended_keys; + int get_extkeys; } unibi_ext; char *space_buf; -} TUIData; +}; static bool volatile got_winch = false; static bool did_user_set_dimensions = false; @@ -179,6 +180,32 @@ UI *tui_start(void) return ui_bridge_attach(ui, tui_main, tui_scheduler); } +void tui_enable_extkeys(TUIData *data) +{ + TermInput input = data->input; + unibi_term *ut = data->ut; + UI *ui = data->bridge->ui; + + switch (input.extkeys_type) { + case kExtkeysCSIu: + data->unibi_ext.enable_extended_keys = (int)unibi_add_ext_str(ut, "ext.enable_extended_keys", + "\x1b[>1u"); + data->unibi_ext.disable_extended_keys = (int)unibi_add_ext_str(ut, "ext.disable_extended_keys", + "\x1b[<1u"); + break; + case kExtkeysXterm: + data->unibi_ext.enable_extended_keys = (int)unibi_add_ext_str(ut, "ext.enable_extended_keys", + "\x1b[>4;2m"); + data->unibi_ext.disable_extended_keys = (int)unibi_add_ext_str(ut, "ext.disable_extended_keys", + "\x1b[>4;0m"); + break; + default: + break; + } + + unibi_out_ext(ui, data->unibi_ext.enable_extended_keys); +} + static size_t unibi_pre_fmt_str(TUIData *data, unsigned int unibi_index, char *buf, size_t len) { const char *str = unibi_get_str(data->ut, unibi_index); @@ -228,8 +255,10 @@ static void terminfo_start(UI *ui) data->unibi_ext.set_underline_color = -1; data->unibi_ext.enable_extended_keys = -1; data->unibi_ext.disable_extended_keys = -1; + data->unibi_ext.get_extkeys = -1; data->out_fd = STDOUT_FILENO; data->out_isatty = os_isatty(data->out_fd); + data->input.tui_data = data; const char *term = os_getenv("TERM"); #ifdef WIN32 @@ -311,8 +340,9 @@ static void terminfo_start(UI *ui) // Enable bracketed paste unibi_out_ext(ui, data->unibi_ext.enable_bracketed_paste); - // Enable extended keys (also known as 'modifyOtherKeys' or CSI u) - unibi_out_ext(ui, data->unibi_ext.enable_extended_keys); + // Query the terminal to see if it supports CSI u + data->input.waiting_for_csiu_response = 5; + unibi_out_ext(ui, data->unibi_ext.get_extkeys); int ret; uv_loop_init(&data->write_loop); @@ -1810,6 +1840,12 @@ static void patch_terminfo_bugs(TUIData *data, const char *term, const char *col data->unibi_ext.get_bg = (int)unibi_add_ext_str(ut, "ext.get_bg", "\x1b]11;?\x07"); + // Query the terminal to see if it supports CSI u key encoding by writing CSI + // ? u followed by a request for the primary device attributes (CSI c) + // See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#detection-of-support-for-this-protocol + data->unibi_ext.get_extkeys = (int)unibi_add_ext_str(ut, "ext.get_extkeys", + "\x1b[?u\x1b[c"); + // Terminals with 256-colour SGR support despite what terminfo says. if (unibi_get_num(ut, unibi_max_colors) < 256) { // See http://fedoraproject.org/wiki/Features/256_Color_Terminals @@ -2074,15 +2110,9 @@ static void augment_terminfo(TUIData *data, const char *term, long vte_version, "\x1b[58:2::%p1%d:%p2%d:%p3%dm"); } - data->unibi_ext.enable_extended_keys = unibi_find_ext_str(ut, "Eneks"); - data->unibi_ext.disable_extended_keys = unibi_find_ext_str(ut, "Dseks"); - if (data->unibi_ext.enable_extended_keys == -1) { - if (!kitty && (vte_version == 0 || vte_version >= 5400)) { - data->unibi_ext.enable_extended_keys = (int)unibi_add_ext_str(ut, "ext.enable_extended_keys", - "\x1b[>4;2m"); - data->unibi_ext.disable_extended_keys = (int)unibi_add_ext_str(ut, "ext.disable_extended_keys", - "\x1b[>4m"); - } + if (!kitty && (vte_version == 0 || vte_version >= 5400)) { + // Fallback to Xterm's modifyOtherKeys if terminal does not support CSI u + data->input.extkeys_type = kExtkeysXterm; } } diff --git a/src/nvim/tui/tui.h b/src/nvim/tui/tui.h index 996496ee60..88ea73e99c 100644 --- a/src/nvim/tui/tui.h +++ b/src/nvim/tui/tui.h @@ -4,6 +4,8 @@ #include "nvim/cursor_shape.h" #include "nvim/ui.h" +typedef struct TUIData TUIData; + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "tui/tui.h.generated.h" #endif diff --git a/test/functional/api/autocmd_spec.lua b/test/functional/api/autocmd_spec.lua index 377b4fecf0..a30af63ba1 100644 --- a/test/functional/api/autocmd_spec.lua +++ b/test/functional/api/autocmd_spec.lua @@ -727,7 +727,7 @@ describe('autocmd api', function() set_ft("txt") set_ft("python") - eq(get_executed_count(), 2) + eq(2, get_executed_count()) end) it('works getting called multiple times', function() @@ -736,7 +736,7 @@ describe('autocmd api', function() set_ft() set_ft() - eq(get_executed_count(), 3) + eq(3, get_executed_count()) end) it('handles ++once', function() @@ -746,7 +746,7 @@ describe('autocmd api', function() set_ft('txt') set_ft('help') - eq(get_executed_count(), 1) + eq(1, get_executed_count()) end) it('errors on unexpected keys', function() @@ -874,7 +874,7 @@ describe('autocmd api', function() set_ft("txt") set_ft("python") - eq(get_executed_count(), 1) + eq(1, get_executed_count()) end) it('autocmds can be registered multiple times.', function() @@ -888,7 +888,7 @@ describe('autocmd api', function() set_ft("txt") set_ft("python") - eq(get_executed_count(), 3 * 2) + eq(3 * 2, get_executed_count()) end) it('can be deleted', function() diff --git a/test/functional/api/proc_spec.lua b/test/functional/api/proc_spec.lua index d828bdf948..0fbf58a8e7 100644 --- a/test/functional/api/proc_spec.lua +++ b/test/functional/api/proc_spec.lua @@ -63,9 +63,9 @@ describe('API', function() local pid = funcs.getpid() local pinfo = request('nvim_get_proc', pid) eq((iswin() and 'nvim.exe' or 'nvim'), pinfo.name) - eq(pinfo.pid, pid) - eq(type(pinfo.ppid), 'number') - neq(pinfo.ppid, pid) + eq(pid, pinfo.pid) + eq('number', type(pinfo.ppid)) + neq(pid, pinfo.ppid) end) it('validates input', function() diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 04b79a7157..f4b1a7fd59 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -122,9 +122,9 @@ describe('API', function() -- Functions nvim('exec', 'function Foo()\ncall setline(1,["xxx"])\nendfunction', false) - eq(nvim('get_current_line'), '') + eq('', nvim('get_current_line')) nvim('exec', 'call Foo()', false) - eq(nvim('get_current_line'), 'xxx') + eq('xxx', nvim('get_current_line')) -- Autocmds nvim('exec','autocmd BufAdd * :let x1 = "Hello"', false) @@ -1841,10 +1841,10 @@ describe('API', function() -- spin the loop a bit helpers.run(nil, nil, on_setup) - eq(nvim('get_var', 'x1'), '…') + eq('…', nvim('get_var', 'x1')) -- Because of the double escaping this is neq - neq(nvim('get_var', 'x2'), '…') - eq(nvim('get_var', 'x3'), '…') + neq('…', nvim('get_var', 'x2')) + eq('…', nvim('get_var', 'x3')) end) end) diff --git a/test/functional/core/main_spec.lua b/test/functional/core/main_spec.lua index 37a9f0b836..f6fb859ccc 100644 --- a/test/functional/core/main_spec.lua +++ b/test/functional/core/main_spec.lua @@ -52,11 +52,15 @@ describe('Command-line option', function() if helpers.pending_win32(pending) then return end local screen = Screen.new(40, 8) screen:attach() - funcs.termopen({ + local args = { nvim_prog_abs(), '-u', 'NONE', '-i', 'NONE', - '--cmd', 'set noswapfile shortmess+=IFW fileformats=unix', - '-s', '-' - }) + '--cmd', 'set noswapfile shortmess+=IFW fileformats=unix', + '-s', '-' + } + + -- Need to explicitly pipe to stdin so that the embedded Nvim instance doesn't try to read + -- data from the terminal #18181 + funcs.termopen(string.format([[echo "" | %s]], table.concat(args, " "))) screen:expect([[ ^ | {1:~ }| diff --git a/test/functional/editor/langmap_spec.lua b/test/functional/editor/langmap_spec.lua index e4349a22e7..af19f97a68 100644 --- a/test/functional/editor/langmap_spec.lua +++ b/test/functional/editor/langmap_spec.lua @@ -30,7 +30,7 @@ describe("'langmap'", function() command('nmapclear') end) it("'langnoremap' is by default ON", function() - eq(eval('&langnoremap'), 1) + eq(1, eval('&langnoremap')) end) it("Results of maps are not converted when 'langnoremap' ON.", function() @@ -71,19 +71,19 @@ describe("'langmap'", function() feed('<C-w>s') local origwin = curwin() feed('<C-w>i') - neq(curwin(), origwin) + neq(origwin, curwin()) -- Works when setting a mark feed('yy3p3gg0mwgg0mi') - eq(call('getpos', "'i"), {0, 3, 1, 0}) - eq(call('getpos', "'w"), {0, 1, 1, 0}) + eq({0, 3, 1, 0}, call('getpos', "'i")) + eq({0, 1, 1, 0}, call('getpos', "'w")) feed('3dd') -- Works when moving to a mark feed("'i") - eq(call('getpos', '.'), {0, 1, 1, 0}) + eq({0, 1, 1, 0}, call('getpos', '.')) -- Works when selecting a register feed('qillqqwhhq') - eq(eval('@i'), 'hh') - eq(eval('@w'), 'll') + eq('hh', eval('@i')) + eq('ll', eval('@w')) feed('a<C-r>i<esc>') expect('illii www') feed('"ip') @@ -107,7 +107,7 @@ describe("'langmap'", function() expect('wwi www') feed('u@a') expect('wwi www') - eq(eval('@a'), ':s/i/w/gc\ryyn') + eq(':s/i/w/gc\ryyn', eval('@a')) end) it('insert-mode CTRL-G', function() command('set langmap=jk,kj') @@ -127,7 +127,7 @@ describe("'langmap'", function() helhellolo helxlo hello]]) - eq(eval('@a'), 'gg3|ahellojx') + eq('gg3|ahellojx', eval('@a')) end) it('command-line CTRL-\\', function() command('set langmap=en,ne') @@ -145,8 +145,8 @@ describe("'langmap'", function() set langmap=ij,ji ]]) feed(':let <C-R>i=1<CR>') - eq(eval('i_value'), 1) - eq(eval('j_value'), 0) + eq(1, eval('i_value')) + eq(0, eval('j_value')) end) -- it('-- More -- prompt', function() -- -- The 'b' 'j' 'd' 'f' commands at the -- More -- prompt @@ -186,17 +186,17 @@ describe("'langmap'", function() nnoremap x :call Map()<CR> ]]) feed('x1<CR>') - eq(eval('gotten_one'), 1) + eq(1, eval('gotten_one')) command('let g:gotten_one = 0') feed_command('call Map()') feed('1<CR>') - eq(eval('gotten_one'), 1) + eq(1, eval('gotten_one')) end) end) it('conversions are not applied during setreg()', function() call('setreg', 'i', 'ww') - eq(eval('@i'), 'ww') + eq('ww', eval('@i')) end) it('conversions not applied in insert mode', function() feed('aiiiwww') diff --git a/test/functional/editor/macro_spec.lua b/test/functional/editor/macro_spec.lua index d4cf6b28fd..53be7dcc62 100644 --- a/test/functional/editor/macro_spec.lua +++ b/test/functional/editor/macro_spec.lua @@ -17,20 +17,20 @@ describe('macros', function() it('can be recorded and replayed', function() feed('qiahello<esc>q') expect('hello') - eq(eval('@i'), 'ahello') + eq('ahello', eval('@i')) feed('@i') expect('hellohello') - eq(eval('@i'), 'ahello') + eq('ahello', eval('@i')) end) it('applies maps', function() command('imap x l') command('nmap l a') feed('qilxxx<esc>q') expect('lll') - eq(eval('@i'), 'lxxx') + eq('lxxx', eval('@i')) feed('@i') expect('llllll') - eq(eval('@i'), 'lxxx') + eq('lxxx', eval('@i')) end) it('can be replayed with Q', function() diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua index 6a2e86ccb4..fbb67f9c03 100644 --- a/test/functional/legacy/arglist_spec.lua +++ b/test/functional/legacy/arglist_spec.lua @@ -17,7 +17,7 @@ describe('argument list commands', function() end local function assert_fails(cmd, err) - neq(exc_exec(cmd):find(err), nil) + neq(nil, exc_exec(cmd):find(err)) end it('test that argidx() works', function() diff --git a/test/functional/legacy/function_sort_spec.lua b/test/functional/legacy/function_sort_spec.lua index 12875460e0..414953aacc 100644 --- a/test/functional/legacy/function_sort_spec.lua +++ b/test/functional/legacy/function_sort_spec.lua @@ -52,6 +52,6 @@ describe('sort', function() eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval([[sort([3.3, 1, "2", "A", "a", "AA"], '')]])) eq({'2', 'A', 'AA', 'a', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"], 0)')) eq({'2', 'A', 'a', 'AA', 1, 3.3}, eval('sort([3.3, 1, "2", "A", "a", "AA"], 1)')) - neq(exc_exec('call sort([3.3, 1, "2"], 3)'):find('E474:'), nil) + neq(nil, exc_exec('call sort([3.3, 1, "2"], 3)'):find('E474:')) end) end) diff --git a/test/functional/legacy/wordcount_spec.lua b/test/functional/legacy/wordcount_spec.lua index 826743b0ca..21f96628c0 100644 --- a/test/functional/legacy/wordcount_spec.lua +++ b/test/functional/legacy/wordcount_spec.lua @@ -50,44 +50,44 @@ describe('wordcount', function() ]=]) -- Test 1: empty window - eq(eval('DoRecordWin()'), - eval([=[ + eq(eval([=[ [[''], {'chars': 0, 'cursor_chars': 0, 'words': 0, 'cursor_words': 0, 'bytes': 0, 'cursor_bytes': 0}] - ]=]) + ]=]), + eval('DoRecordWin()') ) -- Test 2: some words, cursor at start command([[call PutInWindow('one two three')]]) - eq(eval('DoRecordWin([1, 1, 0])'), - eval([=[ + eq(eval([=[ [['', 'one two three'], {'chars': 15, 'cursor_chars': 1, 'words': 3, 'cursor_words': 0, 'bytes': 15, 'cursor_bytes': 1}] - ]=]) + ]=]), + eval('DoRecordWin([1, 1, 0])') ) -- Test 3: some words, cursor at end command([[call PutInWindow('one two three')]]) - eq(eval('DoRecordWin([2, 99, 0])'), - eval([=[ + eq(eval([=[ [['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 14}] - ]=]) + ]=]), + eval('DoRecordWin([2, 99, 0])') ) -- Test 4: some words, cursor at end, ve=all command('set ve=all') command([[call PutInWindow('one two three')]]) - eq(eval('DoRecordWin([2,99,0])'), - eval([=[ + eq(eval([=[ [['', 'one two three'], {'chars': 15, 'cursor_chars': 15, 'words': 3, 'cursor_words': 3, 'bytes': 15, 'cursor_bytes': 15}] - ]=]) + ]=]), + eval('DoRecordWin([2,99,0])') ) command('set ve=') -- Test 5: several lines with words command([=[call PutInWindow(['one two three', 'one two three', 'one two three'])]=]) - eq(eval('DoRecordWin([4,99,0])'), - eval([=[ + eq(eval([=[ [['', 'one two three', 'one two three', 'one two three'], {'chars': 43, 'cursor_chars': 42, 'words': 9, 'cursor_words': 9, 'bytes': 43, 'cursor_bytes': 42}] - ]=]) + ]=]), + eval('DoRecordWin([4,99,0])') ) -- Test 6: one line with BOM set @@ -95,10 +95,10 @@ describe('wordcount', function() command('wincmd k') command('set bomb') command('wincmd j') - eq(eval('DoRecordWin([2,99,0])'), - eval([=[ + eq(eval([=[ [['', 'one two three'], {'chars': 15, 'cursor_chars': 14, 'words': 3, 'cursor_words': 3, 'bytes': 18, 'cursor_bytes': 14}] - ]=]) + ]=]), + eval('DoRecordWin([2,99,0])') ) command('wincmd k') command('set nobomb') @@ -106,18 +106,18 @@ describe('wordcount', function() -- Test 7: one line with multibyte words command([=[call PutInWindow(['Äne M¤ne Müh'])]=]) - eq(eval('DoRecordWin([2,99,0])'), - eval([=[ + eq(eval([=[ [['', 'Äne M¤ne Müh'], {'chars': 14, 'cursor_chars': 13, 'words': 3, 'cursor_words': 3, 'bytes': 17, 'cursor_bytes': 16}] - ]=]) + ]=]), + eval('DoRecordWin([2,99,0])') ) -- Test 8: several lines with multibyte words command([=[call PutInWindow(['Äne M¤ne Müh', 'und raus bist dü!'])]=]) - eq(eval('DoRecordWin([3,99,0])'), - eval([=[ + eq(eval([=[ [['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'cursor_chars': 31, 'words': 7, 'cursor_words': 7, 'bytes': 36, 'cursor_bytes': 35}] - ]=]) + ]=]), + eval('DoRecordWin([3,99,0])') ) -- Test 9: visual mode, complete buffer @@ -131,10 +131,10 @@ describe('wordcount', function() command('set stl= ls=1') command('let log=DoRecordWin([3,99,0])') command('let log[1]=g:visual_stat') - eq(eval('log'), - eval([=[ + eq(eval([=[ [['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 32, 'visual_words': 7, 'visual_bytes': 36}] - ]=]) + ]=]), + eval('log') ) -- Test 10: visual mode (empty) @@ -148,10 +148,10 @@ describe('wordcount', function() command('set stl= ls=1') command('let log=DoRecordWin([3,99,0])') command('let log[1]=g:visual_stat') - eq(eval('log'), - eval([=[ + eq(eval([=[ [['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 1, 'visual_words': 0, 'visual_bytes': 1}] - ]=]) + ]=]), + eval('log') ) -- Test 11: visual mode, single line @@ -165,10 +165,10 @@ describe('wordcount', function() command('set stl= ls=1') command('let log=DoRecordWin([3,99,0])') command('let log[1]=g:visual_stat') - eq(eval('log'), - eval([=[ + eq(eval([=[ [['', 'Äne M¤ne Müh', 'und raus bist dü!'], {'chars': 32, 'words': 7, 'bytes': 36, 'visual_chars': 13, 'visual_words': 3, 'visual_bytes': 16}] - ]=]) + ]=]), + eval('log') ) end) end) diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index ae6a1d5765..d9a8dfd2e8 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -645,17 +645,17 @@ describe('lua stdlib', function() return vim.tbl_islist(c) and count == 0 ]])) - eq(exec_lua([[ + eq({a = {b = 1}}, exec_lua([[ local a = { a = { b = 1 } } local b = { a = {} } return vim.tbl_deep_extend("force", a, b) - ]]), {a = {b = 1}}) + ]])) - eq(exec_lua([[ + eq({a = {b = 1}}, exec_lua([[ local a = { a = 123 } local b = { a = { b = 1} } return vim.tbl_deep_extend("force", a, b) - ]]), {a = {b = 1}}) + ]])) ok(exec_lua([[ local a = { a = {[2] = 3} } @@ -664,11 +664,11 @@ describe('lua stdlib', function() return vim.deep_equal(c, {a = {[3] = 3}}) ]])) - eq(exec_lua([[ + eq({a = 123}, exec_lua([[ local a = { a = { b = 1} } local b = { a = 123 } return vim.tbl_deep_extend("force", a, b) - ]]), {a = 123 }) + ]])) matches('invalid "behavior": nil', pcall_err(exec_lua, [[ diff --git a/test/functional/options/keymap_spec.lua b/test/functional/options/keymap_spec.lua index 52a714f7a8..a814c35a39 100644 --- a/test/functional/options/keymap_spec.lua +++ b/test/functional/options/keymap_spec.lua @@ -120,9 +120,9 @@ describe("'keymap' / :lmap", function() it("Can be toggled with <C-^> in insert mode", function() feed('i<C-^>l<C-^>l<esc>') expect('lalllaaa') - eq(eval('&iminsert'), 1) + eq(1, eval('&iminsert')) feed('i<C-^><esc>') - eq(eval('&iminsert'), 0) + eq(0, eval('&iminsert')) end) end) describe("'imsearch' option", function() @@ -136,36 +136,36 @@ describe("'keymap' / :lmap", function() expect('aaa') end) it("Can be toggled with C-^", function() - eq(eval('&imsearch'), 1) + eq(1, eval('&imsearch')) feed('/<C-^>lll<cr>3x') expect('aaa') - eq(eval('&imsearch'), 0) + eq(0, eval('&imsearch')) feed('u0/<C-^>lll<cr>3x') expect('lll') - eq(eval('&imsearch'), 1) + eq(1, eval('&imsearch')) end) it("can follow 'iminsert'", function() command('set imsearch=-1') feed('/lll<cr>3x') expect('lll') - eq(eval('&imsearch'), -1) - eq(eval('&iminsert'), 1) + eq(-1, eval('&imsearch')) + eq(1, eval('&iminsert')) feed('u/<C-^>lll<cr>3x') expect('aaa') - eq(eval('&imsearch'), -1) - eq(eval('&iminsert'), 0) + eq(-1, eval('&imsearch')) + eq(0, eval('&iminsert')) end) end) it(":lmap not applied to macros", function() command("call setreg('a', 'il')") feed('@a') expect('llllaaa') - eq(call('getreg', 'a'), 'il') + eq('il', call('getreg', 'a')) end) it(":lmap applied to macro recording", function() feed('qail<esc>q@a') expect('aalllaaa') - eq(call('getreg', 'a'), 'ia') + eq('ia', call('getreg', 'a')) end) it(":lmap not applied to mappings", function() command('imap t l') diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua index 83d794b620..19b01edb29 100644 --- a/test/functional/plugin/lsp/diagnostic_spec.lua +++ b/test/functional/plugin/lsp/diagnostic_spec.lua @@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local exec_lua = helpers.exec_lua local eq = helpers.eq +local neq = require('test.helpers').neq describe('vim.lsp.diagnostic', function() local fake_uri @@ -227,5 +228,43 @@ describe('vim.lsp.diagnostic', function() eq(exec_lua([[return vim.str_byteindex(..., 7, true)]], line), result[1].col) eq(exec_lua([[return vim.str_byteindex(..., 8, true)]], line), result[1].end_col) end) + + it('does not create buffer on empty diagnostics', function() + local bufnr + + -- No buffer is created without diagnostics + bufnr = exec_lua [[ + vim.lsp.diagnostic.on_publish_diagnostics(nil, { + uri = "file:///fake/uri2", + diagnostics = {}, + }, {client_id=client_id}) + return vim.fn.bufnr(vim.uri_to_fname("file:///fake/uri2")) + ]] + eq(bufnr, -1) + + -- Create buffer on diagnostics + bufnr = exec_lua [[ + vim.lsp.diagnostic.on_publish_diagnostics(nil, { + uri = "file:///fake/uri2", + diagnostics = { + make_error('Diagnostic', 0, 0, 0, 0), + }, + }, {client_id=client_id}) + return vim.fn.bufnr(vim.uri_to_fname("file:///fake/uri2")) + ]] + neq(bufnr, -1) + eq(exec_lua([[return #vim.diagnostic.get(...)]], bufnr), 1) + + -- Clear diagnostics after buffer was created + bufnr = exec_lua [[ + vim.lsp.diagnostic.on_publish_diagnostics(nil, { + uri = "file:///fake/uri2", + diagnostics = {}, + }, {client_id=client_id}) + return vim.fn.bufnr(vim.uri_to_fname("file:///fake/uri2")) + ]] + neq(bufnr, -1) + eq(exec_lua([[return #vim.diagnostic.get(...)]], bufnr), 0) + end) end) end) diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 359d1f206a..96e7b1b6bc 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -85,8 +85,8 @@ describe('float window', function() local buf = meths.create_buf(false, false) meths.buf_set_lines(buf, 0, -1, true, {'the floatwin'}) local win = meths.open_win(buf, true, {relative='win', width=16, height=1, row=0, col=10}) - eq(pcall_err(funcs.win_execute, win, 'close'), 'Vim(close):E37: No write since last change (add ! to override)') - eq(pcall_err(funcs.win_execute, win, 'bdelete'), 'Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)') + eq('Vim(close):E37: No write since last change (add ! to override)', pcall_err(funcs.win_execute, win, 'close')) + eq('Vim(bdelete):E89: No write since last change for buffer 2 (add ! to override)', pcall_err(funcs.win_execute, win, 'bdelete')) funcs.win_execute(win, 'bwipe!') end) @@ -367,7 +367,7 @@ describe('float window', function() return vim.api.nvim_open_win(bufnr, false, opts) ]]) command('windo echo') - neq(eval('win_getid()'), winid) + neq(winid, eval('win_getid()')) end) it('is active after windo when focusable', function() @@ -384,7 +384,7 @@ describe('float window', function() return vim.api.nvim_open_win(bufnr, false, opts) ]]) command('windo echo') - eq(eval('win_getid()'), winid) + eq(winid, eval('win_getid()')) end) it('supports windo with focusable and non-focusable floats', function() diff --git a/test/functional/vimscript/has_spec.lua b/test/functional/vimscript/has_spec.lua index c03fd13e0c..4d9b226434 100644 --- a/test/functional/vimscript/has_spec.lua +++ b/test/functional/vimscript/has_spec.lua @@ -68,4 +68,11 @@ describe('has()', function() eq(0, funcs.has('wsl')) end end) + + it('does not change v:shell_error', function() + local nvim_prog = helpers.nvim_prog + funcs.system({nvim_prog, '-es', '+73cquit'}) + funcs.has('python3') -- use a call whose implementation shells out + eq(73, funcs.eval('v:shell_error')) + end) end) diff --git a/test/functional/vimscript/msgpack_functions_spec.lua b/test/functional/vimscript/msgpack_functions_spec.lua index 837b629858..cab67d77e4 100644 --- a/test/functional/vimscript/msgpack_functions_spec.lua +++ b/test/functional/vimscript/msgpack_functions_spec.lua @@ -5,6 +5,7 @@ local eval, eq = helpers.eval, helpers.eq local command = helpers.command local nvim = helpers.nvim local exc_exec = helpers.exc_exec +local iswin = helpers.iswin describe('msgpack*() functions', function() before_each(clear) @@ -466,6 +467,11 @@ describe('msgpackparse() function', function() eval(cmd) eval(cmd) -- do it again (try to force segfault) local api_info = eval(cmd) -- do it again + if iswin() then + helpers.assert_alive() + pending('msgpackparse() has a bug on windows') + return + end eq({'error_types', 'functions', 'types', 'ui_events', 'ui_options', 'version'}, api_info) end) diff --git a/test/functional/vimscript/reltime_spec.lua b/test/functional/vimscript/reltime_spec.lua index d87943e485..6d661402a6 100644 --- a/test/functional/vimscript/reltime_spec.lua +++ b/test/functional/vimscript/reltime_spec.lua @@ -12,7 +12,7 @@ describe('reltimestr(), reltimefloat()', function() local later = reltime() local elapsed = reltime(now) - neq(reltimestr(elapsed), '0.0') + neq('0.0', reltimestr(elapsed)) ok(reltimefloat(elapsed) > 0.0) -- original vim test for < 0.1, but easily fails on travis ok(nil ~= string.match(reltimestr(elapsed), "0%.")) @@ -26,7 +26,7 @@ describe('reltimestr(), reltimefloat()', function() eq(0.0, reltimefloat(same)) local differs = reltime(now, later) - neq(reltimestr(differs), '0.0') + neq('0.0', reltimestr(differs)) ok(reltimefloat(differs) > 0.0) -- original vim test for < 0.1, but easily fails on travis ok(nil ~= string.match(reltimestr(differs), "0%.")) diff --git a/test/functional/vimscript/setpos_spec.lua b/test/functional/vimscript/setpos_spec.lua index 935f387bcc..02e550dcc0 100644 --- a/test/functional/vimscript/setpos_spec.lua +++ b/test/functional/vimscript/setpos_spec.lua @@ -24,41 +24,41 @@ describe('setpos() function', function() end) it('can set the current cursor position', function() setpos(".", {0, 2, 1, 0}) - eq(getpos("."), {0, 2, 1, 0}) + eq({0, 2, 1, 0}, getpos(".")) setpos(".", {2, 1, 1, 0}) - eq(getpos("."), {0, 1, 1, 0}) + eq({0, 1, 1, 0}, getpos(".")) local ret = exc_exec('call setpos(".", [1, 1, 1, 0])') eq(0, ret) end) it('can set lowercase marks in the current buffer', function() setpos("'d", {0, 2, 1, 0}) - eq(getpos("'d"), {0, 2, 1, 0}) + eq({0, 2, 1, 0}, getpos("'d")) command('undo') command('call setpos("\'d", [2, 3, 1, 0])') - eq(getpos("'d"), {0, 3, 1, 0}) + eq({0, 3, 1, 0}, getpos("'d")) end) it('can set lowercase marks in other buffers', function() local retval = setpos("'d", {1, 2, 1, 0}) eq(0, retval) setpos("'d", {1, 2, 1, 0}) - eq(getpos("'d"), {0, 0, 0, 0}) + eq({0, 0, 0, 0}, getpos("'d")) command('wincmd w') - eq(eval('bufnr("%")'), 1) - eq(getpos("'d"), {0, 2, 1, 0}) + eq(1, eval('bufnr("%")')) + eq({0, 2, 1, 0}, getpos("'d")) end) it("fails when setting a mark in a buffer that doesn't exist", function() local retval = setpos("'d", {3, 2, 1, 0}) eq(-1, retval) - eq(getpos("'d"), {0, 0, 0, 0}) + eq({0, 0, 0, 0}, getpos("'d")) retval = setpos("'D", {3, 2, 1, 0}) eq(-1, retval) - eq(getpos("'D"), {0, 0, 0, 0}) + eq({0, 0, 0, 0}, getpos("'D")) end) it('can set uppercase marks', function() setpos("'D", {2, 2, 3, 0}) - eq(getpos("'D"), {2, 2, 3, 0}) + eq({2, 2, 3, 0}, getpos("'D")) -- Can set a mark in another buffer setpos("'D", {1, 2, 2, 0}) - eq(getpos("'D"), {1, 2, 2, 0}) + eq({1, 2, 2, 0}, getpos("'D")) end) end) diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua index a0e02b6624..c039b95d16 100644 --- a/test/unit/os/env_spec.lua +++ b/test/unit/os/env_spec.lua @@ -154,7 +154,7 @@ describe('env.c', function() local value = 'TESTVALUE' os_setenv(name, value, 1) eq(OK, os_unsetenv(name)) - neq(os_getenv(name), value) + neq(value, os_getenv(name)) -- Depending on the platform the var might be unset or set as '' assert.True(os_getenv(name) == nil or os_getenv(name) == '') if os_getenv(name) == nil then diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index c06e31a328..6b1c0b466e 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -191,9 +191,6 @@ set(WIN32YANK_X86_SHA256 62f34e5a46c5d4a7b3f3b512e1ff7b77fedd432f42581cbe825233a set(WIN32YANK_X86_64_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x64.zip) set(WIN32YANK_X86_64_SHA256 33a747a92da60fb65e668edbf7661d3d902411a2d545fe9dc08623cecd142a20) -set(WINPTY_URL https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip) -set(WINPTY_SHA256 35a48ece2ff4acdcbc8299d4920de53eb86b1fb41e64d2fe5ae7898931bcee89) - set(GETTEXT_URL https://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.1.tar.gz) set(GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c) @@ -284,18 +281,6 @@ if(WIN32) elseif(TARGET_ARCH STREQUAL "X86") set(TARGET_ARCH ia32) endif() - - GetBinaryDep(TARGET winpty - INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/bin - COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/winpty/${TARGET_ARCH}/bin/* - -DTO=${DEPS_INSTALL_DIR}/bin/ - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake - COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/winpty/include/* - -DTO=${DEPS_INSTALL_DIR}/include/ - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake - COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/winpty/${TARGET_ARCH}/lib/* - -DTO=${DEPS_INSTALL_DIR}/lib/ - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake) endif() # clean-shared-libraries removes ${DEPS_INSTALL_DIR}/lib/nvim/parser/c.dll, |