diff options
-rw-r--r-- | .luacheckrc | 2 | ||||
-rw-r--r-- | cmake.deps/CMakeLists.txt | 8 | ||||
-rw-r--r-- | cmake.deps/cmake/BuildLuarocks.cmake | 6 | ||||
-rw-r--r-- | runtime/doc/treesitter.txt | 4 | ||||
-rw-r--r-- | runtime/lua/vim/filetype.lua | 11 | ||||
-rw-r--r-- | runtime/lua/vim/lsp.lua | 16 | ||||
-rw-r--r-- | runtime/lua/vim/treesitter.lua | 4 | ||||
-rw-r--r-- | runtime/plugin/nvim.lua | 15 | ||||
-rw-r--r-- | src/nvim/change.c | 1 | ||||
-rw-r--r-- | src/nvim/cmdexpand.c | 5 | ||||
-rw-r--r-- | src/nvim/decoration.c | 2 | ||||
-rw-r--r-- | src/nvim/drawscreen.c | 7 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 6 | ||||
-rw-r--r-- | src/nvim/move.c | 13 | ||||
-rw-r--r-- | src/nvim/option.c | 3 | ||||
-rw-r--r-- | src/nvim/optionstr.c | 8 | ||||
-rw-r--r-- | src/nvim/terminal.c | 4 | ||||
-rw-r--r-- | src/nvim/window.c | 2 | ||||
-rw-r--r-- | test/functional/lua/runtime_spec.lua | 37 | ||||
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 68 | ||||
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/ui/float_spec.lua | 12 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/ui/statuscolumn_spec.lua | 37 | ||||
-rw-r--r-- | test/old/testdir/test_filetype.vim | 7 |
25 files changed, 221 insertions, 64 deletions
diff --git a/.luacheckrc b/.luacheckrc index d1aca1cfd6..e804d1c822 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -19,8 +19,10 @@ cache = true ignore = { "631", -- max_line_length "212/_.*", -- unused argument, for vars with "_" prefix + "214", -- used variable with unused hint ("_" prefix) "121", -- setting read-only global variable 'vim' "122", -- setting read-only field of global variable 'vim' + "581", -- negation of a relational operator- operator can be flipped (not for tables) } -- Global objects defined by the C code diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt index c188df0bea..48a96b1bd8 100644 --- a/cmake.deps/CMakeLists.txt +++ b/cmake.deps/CMakeLists.txt @@ -144,8 +144,8 @@ set(LUAJIT_SHA256 67c88399b901a22e9a236f4b77e6fe39af00f6b7144ce9dd6f51141d921f10 set(LUA_URL https://www.lua.org/ftp/lua-5.1.5.tar.gz) set(LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333) -set(LUAROCKS_URL https://github.com/luarocks/luarocks/archive/v3.8.0.tar.gz) -set(LUAROCKS_SHA256 ab6612ca9ab87c6984871d2712d05525775e8b50172701a0a1cabddf76de2be7) +set(LUAROCKS_URL https://github.com/luarocks/luarocks/archive/v3.9.2.tar.gz) +set(LUAROCKS_SHA256 a0b36cd68586cd79966d0106bb2e5a4f5523327867995fd66bee4237062b3e3b) set(UNIBILIUM_URL https://github.com/neovim/unibilium/archive/d72c3598e7ac5d1ebf86ee268b8b4ed95c0fa628.tar.gz) set(UNIBILIUM_SHA256 9c4747c862ab5e3076dcf8fa8f0ea7a6b50f20ec5905618b9536655596797487) @@ -169,8 +169,8 @@ set(WINTOOLS_SHA256 3c4c490a3d392ceeb1347cb77cc821a31900b688a2189276d3a1131a3f21 set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.17/neovim-qt.zip) set(WINGUI_SHA256 502e386eef677c2c2e0c11d8cbb27f3e12b4d96818369417e8da4129c4580c25) -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(WIN32YANK_X86_64_URL https://github.com/equalsraf/win32yank/releases/download/v0.1.1/win32yank-x64.zip) +set(WIN32YANK_X86_64_SHA256 247c9a05b94387a884b49d3db13f806b1677dfc38020f955f719be6902260cd6) set(GETTEXT_URL https://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.1.tar.gz) set(GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c) diff --git a/cmake.deps/cmake/BuildLuarocks.cmake b/cmake.deps/cmake/BuildLuarocks.cmake index 1f1bb94741..6e77fd7935 100644 --- a/cmake.deps/cmake/BuildLuarocks.cmake +++ b/cmake.deps/cmake/BuildLuarocks.cmake @@ -100,7 +100,7 @@ set(ROCKS_DIR ${DEPS_LIB_DIR}/luarocks/rocks-${LUA_VERSION}) # mpack add_custom_command(OUTPUT ${ROCKS_DIR}/mpack - COMMAND ${LUAROCKS_BINARY} build mpack 1.0.8-0 ${LUAROCKS_BUILDARGS} + COMMAND ${LUAROCKS_BINARY} build mpack 1.0.10-0 ${LUAROCKS_BUILDARGS} DEPENDS luarocks) add_custom_target(mpack ALL DEPENDS ${ROCKS_DIR}/mpack) @@ -140,14 +140,14 @@ if(USE_BUNDLED_BUSTED) # luacheck add_custom_command(OUTPUT ${LUACHECK_EXE} - COMMAND ${LUAROCKS_BINARY} build luacheck 0.23.0-1 ${LUAROCKS_BUILDARGS} + COMMAND ${LUAROCKS_BINARY} build luacheck 1.1.0-1 ${LUAROCKS_BUILDARGS} DEPENDS busted) add_custom_target(luacheck ALL DEPENDS ${LUACHECK_EXE}) if (USE_BUNDLED_LUA OR NOT USE_BUNDLED_LUAJIT) # coxpcall add_custom_command(OUTPUT ${ROCKS_DIR}/coxpcall - COMMAND ${LUAROCKS_BINARY} build coxpcall 1.16.0-1 ${LUAROCKS_BUILDARGS} + COMMAND ${LUAROCKS_BINARY} build coxpcall 1.17.0-1 ${LUAROCKS_BUILDARGS} DEPENDS luarocks) add_custom_target(coxpcall ALL DEPENDS ${ROCKS_DIR}/coxpcall) endif() diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index ddca307e74..46f414d905 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -623,8 +623,8 @@ inspect_tree({opts}) *vim.treesitter.inspect_tree()* • winid (integer|nil): Window id to display the tree buffer in. If omitted, a new window is created with {command}. • command (string|nil): Vimscript command to create the - window. Default value is "topleft 60vnew". Only used when - {winid} is nil. + window. Default value is "60vnew". Only used when {winid} is + nil. • title (string|fun(bufnr:integer):string|nil): Title of the window. If a function, it accepts the buffer number of the source buffer as its only argument and should return a diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 1732623223..cf813b19b1 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -800,6 +800,7 @@ local extension = { pod = 'pod', filter = 'poefilter', pk = 'poke', + pony = 'pony', ps = 'postscr', epsi = 'postscr', afm = 'postscr', @@ -838,6 +839,9 @@ local extension = { R = function(path, bufnr) return require('vim.filetype.detect').r(bufnr) end, + rkt = 'racket', + rktd = 'racket', + rktl = 'racket', rad = 'radiance', mat = 'radiance', ['pod6'] = 'raku', @@ -883,6 +887,8 @@ local extension = { ron = 'ron', rsc = 'routeros', x = 'rpcgen', + rpgle = 'rpgle', + rpgleinc = 'rpgle', rpl = 'rpl', Srst = 'rrst', srst = 'rrst', @@ -908,9 +914,6 @@ local extension = { ss = 'scheme', scm = 'scheme', sld = 'scheme', - rkt = 'scheme', - rktd = 'scheme', - rktl = 'scheme', sce = 'scilab', sci = 'scilab', scss = 'scss', @@ -1016,6 +1019,7 @@ local extension = { swift = 'swift', svh = 'systemverilog', sv = 'systemverilog', + td = 'tablegen', tak = 'tak', tal = 'tal', task = 'taskedit', @@ -1590,6 +1594,7 @@ local filename = { ['.pythonstartup'] = 'python', ['.pythonrc'] = 'python', SConstruct = 'python', + qmldir = 'qmldir', ['.Rprofile'] = 'r', ['Rprofile'] = 'r', ['Rprofile.site'] = 'r', diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 39665a3d4f..7e8c73ddb6 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -1101,21 +1101,21 @@ function lsp.start_client(config) return true end - local old_bufnr = vim.fn.bufnr('') local last_set_from = vim.fn.gettext('\n\tLast set from ') local line = vim.fn.gettext(' line ') + local scriptname - vim.cmd.buffer(bufnr) - local scriptname = vim.fn - .execute('verbose set ' .. option .. '?') - :match(last_set_from .. '(.*)' .. line .. '%d+') - vim.cmd.buffer(old_bufnr) + vim.api.nvim_buf_call(bufnr, function() + scriptname = vim.fn + .execute('verbose set ' .. option .. '?') + :match(last_set_from .. '(.*)' .. line .. '%d+') + end) if not scriptname then return false end - local vimruntime = vim.fn.getenv('VIMRUNTIME') - return vim.startswith(vim.fn.expand(scriptname), vim.fn.expand(vimruntime)) + + return vim.startswith(vim.fn.expand(scriptname), vim.fn.expand('$VIMRUNTIME')) end ---@private diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua index 56000f99a8..43b8c11b80 100644 --- a/runtime/lua/vim/treesitter.lua +++ b/runtime/lua/vim/treesitter.lua @@ -439,7 +439,7 @@ end --- - winid (integer|nil): Window id to display the tree buffer in. If omitted, --- a new window is created with {command}. --- - command (string|nil): Vimscript command to create the window. Default ---- value is "topleft 60vnew". Only used when {winid} is nil. +--- value is "60vnew". Only used when {winid} is nil. --- - title (string|fun(bufnr:integer):string|nil): Title of the window. If a --- function, it accepts the buffer number of the source buffer as its only --- argument and should return a string. @@ -465,7 +465,7 @@ function M.inspect_tree(opts) local w = opts.winid if not w then - vim.cmd(opts.command or 'topleft 60vnew') + vim.cmd(opts.command or '60vnew') w = a.nvim_get_current_win() end diff --git a/runtime/plugin/nvim.lua b/runtime/plugin/nvim.lua index e4b099f7ad..0a33826b82 100644 --- a/runtime/plugin/nvim.lua +++ b/runtime/plugin/nvim.lua @@ -6,6 +6,15 @@ vim.api.nvim_create_user_command('Inspect', function(cmd) end end, { desc = 'Inspect highlights and extmarks at the cursor', bang = true }) -vim.api.nvim_create_user_command('InspectTree', function() - vim.treesitter.inspect_tree() -end, { desc = 'Inspect treesitter language tree for buffer' }) +vim.api.nvim_create_user_command('InspectTree', function(cmd) + if cmd.mods ~= '' or cmd.count ~= 0 then + local count = cmd.count ~= 0 and cmd.count or '' + local new = cmd.mods ~= '' and 'new' or 'vnew' + + vim.treesitter.inspect_tree({ + command = ('%s %s%s'):format(cmd.mods, count, new), + }) + else + vim.treesitter.inspect_tree() + end +end, { desc = 'Inspect treesitter language tree for buffer', count = true }) diff --git a/src/nvim/change.c b/src/nvim/change.c index 04eadfa269..1500aded0c 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -446,6 +446,7 @@ void deleted_lines_mark(linenr_T lnum, long count) } /// Marks the area to be redrawn after a change. +/// Consider also calling changed_line_display_buf(). /// /// @param buf the buffer where lines were changed /// @param lnum first line with change diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index 18d35e1e20..220cb4cf93 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -1206,7 +1206,6 @@ char *addstar(char *fname, size_t len, int context) // For help tags the translation is done in find_help_tags(). // For a tag pattern starting with "/" no translation is needed. if (context == EXPAND_HELP - || context == EXPAND_CHECKHEALTH || context == EXPAND_COLORS || context == EXPAND_COMPILER || context == EXPAND_OWNSYNTAX @@ -1214,7 +1213,9 @@ char *addstar(char *fname, size_t len, int context) || context == EXPAND_PACKADD || context == EXPAND_RUNTIME || ((context == EXPAND_TAGS_LISTFILES || context == EXPAND_TAGS) - && fname[0] == '/')) { + && fname[0] == '/') + || context == EXPAND_CHECKHEALTH + || context == EXPAND_LUA) { retval = xstrnsave(fname, len); } else { new_len = len + 2; // +2 for '^' at start, NUL at end diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c index 217544175d..f45e13b42a 100644 --- a/src/nvim/decoration.c +++ b/src/nvim/decoration.c @@ -11,6 +11,7 @@ #include "nvim/highlight.h" #include "nvim/highlight_group.h" #include "nvim/memory.h" +#include "nvim/move.h" #include "nvim/pos.h" #include "nvim/sign_defs.h" @@ -86,6 +87,7 @@ void decor_redraw(buf_T *buf, int row1, int row2, Decoration *decor) if (decor && kv_size(decor->virt_lines)) { redraw_buf_line_later(buf, row1 + 1 + (decor->virt_lines_above?0:1), true); + changed_line_display_buf(buf); } } diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index 499f4a39e3..1c8bf56e8e 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -1153,6 +1153,7 @@ void comp_col(void) } set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); } + static void redraw_win_signcol(win_T *wp) { // If we can compute a change in the automatic sizing of the sign column @@ -1392,10 +1393,12 @@ static void win_update(win_T *wp, DecorProviders *providers) int type = wp->w_redr_type; if (type >= UPD_NOT_VALID) { - // TODO(bfredl): should only be implied for CLEAR, not NOT_VALID! wp->w_redr_status = true; - wp->w_lines_valid = 0; + if (*wp->w_p_stc != NUL) { + wp->w_nrwidth_line_count = 0; // make sure width is reset + wp->w_statuscol_line_count = 0; // make sure width is re-estimated + } } // Window is zero-height: Only need to draw the separator diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 819e3cccff..3616f1f69f 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1857,12 +1857,6 @@ int nlua_expand_pat(expand_T *xp, char *pat, int *num_results, char ***results) lua_getfield(lstate, -1, "_expand_pat"); luaL_checktype(lstate, -1, LUA_TFUNCTION); - // ex expansion prepends a ^, but don't worry, it is not a regex - if (pat[0] != '^') { - return FAIL; - } - pat++; - // [ vim, vim._expand_pat, buf ] lua_pushlstring(lstate, (const char *)pat, strlen(pat)); diff --git a/src/nvim/move.c b/src/nvim/move.c index 1f55362354..a9f7ffaa76 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -471,6 +471,19 @@ void changed_line_abv_curs_win(win_T *wp) |VALID_CHEIGHT|VALID_TOPLINE); } +/// Display of line has changed for "buf", invalidate cursor position and +/// w_botline. +void changed_line_display_buf(buf_T *buf) +{ + FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { + if (wp->w_buffer == buf) { + wp->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL + |VALID_CROW|VALID_CHEIGHT + |VALID_TOPLINE|VALID_BOTLINE|VALID_BOTLINE_AP); + } + } +} + // Make sure the value of curwin->w_botline is valid. void validate_botline(win_T *wp) { diff --git a/src/nvim/option.c b/src/nvim/option.c index 5fe6e18155..0aa2f8ab04 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -5519,6 +5519,9 @@ int win_signcol_configured(win_T *wp, int *is_fixed) if (*scl == 'n' && (*(scl + 1) == 'o' || (*(scl + 1) == 'u' && (wp->w_p_nu || wp->w_p_rnu)))) { + if (*wp->w_p_stc != NUL) { + buf_signcols(wp->w_buffer, 0); + } return 0; } diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 40cddebc2e..170800b4e6 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -1198,8 +1198,8 @@ static void did_set_statusline(win_T *win, char **varp, char **gvarp, char **err if (varp == &p_ruf) { // reset ru_wid first ru_wid = 0; } else if (varp == &win->w_p_stc) { - win->w_nrwidth_line_count = 0; - win->w_statuscol_line_count = 0; + win->w_nrwidth_line_count = 0; // make sure width is reset + win->w_statuscol_line_count = 0; // make sure width is re-estimated } char *s = *varp; if (varp == &p_ruf && *s == '%') { @@ -1578,7 +1578,9 @@ static void do_spelllang_source(win_T *win) } } if (p > q) { - vim_snprintf(fname, sizeof(fname), "spell/%.*s.\\(vim\\|lua\\)", (int)(p - q), q); + vim_snprintf(fname, sizeof(fname), "spell/%.*s.vim", (int)(p - q), q); + source_runtime(fname, DIP_ALL); + vim_snprintf(fname, sizeof(fname), "spell/%.*s.lua", (int)(p - q), q); source_runtime(fname, DIP_ALL); } } diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index fca8515fab..76fa3049f6 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -723,7 +723,11 @@ void terminal_paste(long count, char **y_array, size_t y_size) for (size_t j = 0; j < y_size; j++) { if (j) { // terminate the previous line +#ifdef MSWIN + terminal_send(curbuf->terminal, "\r\n", 2); +#else terminal_send(curbuf->terminal, "\n", 1); +#endif } size_t len = strlen(y_array[j]); if (len > buff_len) { diff --git a/src/nvim/window.c b/src/nvim/window.c index 6bb9411048..762ad13ba3 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -834,7 +834,7 @@ void win_config_float(win_T *wp, FloatConfig fconfig) } if (!ui_has(kUIMultigrid)) { - wp->w_height = MIN(wp->w_height, Rows - 1 - win_border_height(wp)); + wp->w_height = MIN(wp->w_height, Rows - win_border_height(wp)); wp->w_width = MIN(wp->w_width, Columns - win_border_width(wp)); } diff --git a/test/functional/lua/runtime_spec.lua b/test/functional/lua/runtime_spec.lua index 884ef3ef8e..72c99ac1f3 100644 --- a/test/functional/lua/runtime_spec.lua +++ b/test/functional/lua/runtime_spec.lua @@ -36,10 +36,12 @@ describe('runtime:', function() describe('colors', function() local colorscheme_folder = plug_dir .. sep .. 'colors' + before_each(function() + mkdir_p(colorscheme_folder) + end) it('loads lua colorscheme', function() local colorscheme_file = colorscheme_folder .. sep .. 'new_colorscheme.lua' - mkdir_p(colorscheme_folder) write_file(colorscheme_file, [[vim.g.lua_colorscheme = 1]]) eq({'new_colorscheme'}, funcs.getcompletion('new_c', 'color')) @@ -48,28 +50,27 @@ describe('runtime:', function() exec('colorscheme new_colorscheme') eq(1, eval('g:lua_colorscheme')) - rmdir(colorscheme_folder) end) it('loads vim colorscheme when both lua and vim version exist', function() local colorscheme_file = colorscheme_folder .. sep .. 'new_colorscheme' - mkdir_p(colorscheme_folder) write_file(colorscheme_file..'.vim', [[let g:colorscheme = 'vim']]) write_file(colorscheme_file..'.lua', [[vim.g.colorscheme = 'lua']]) exec('colorscheme new_colorscheme') eq('vim', eval('g:colorscheme')) - rmdir(colorscheme_folder) end) end) describe('compiler', function() local compiler_folder = plug_dir .. sep .. 'compiler' + before_each(function() + mkdir_p(compiler_folder) + end) it('loads lua compilers', function() local compiler_file = compiler_folder .. sep .. 'new_compiler.lua' - mkdir_p(compiler_folder) write_file(compiler_file, [[vim.b.lua_compiler = 1]]) eq({'new_compiler'}, funcs.getcompletion('new_c', 'compiler')) @@ -78,19 +79,16 @@ describe('runtime:', function() exec('compiler new_compiler') eq(1, eval('b:lua_compiler')) - rmdir(compiler_folder) end) it('loads vim compilers when both lua and vim version exist', function() local compiler_file = compiler_folder .. sep .. 'new_compiler' - mkdir_p(compiler_folder) write_file(compiler_file..'.vim', [[let b:compiler = 'vim']]) write_file(compiler_file..'.lua', [[vim.b.compiler = 'lua']]) exec('compiler new_compiler') eq('vim', eval('b:compiler')) - rmdir(compiler_folder) end) end) @@ -98,8 +96,8 @@ describe('runtime:', function() local ftplugin_folder = table.concat({plug_dir, 'ftplugin'}, sep) it('loads lua ftplugins', function() - local ftplugin_file = table.concat({ftplugin_folder , 'new-ft.lua'}, sep) mkdir_p(ftplugin_folder) + local ftplugin_file = table.concat({ftplugin_folder , 'new-ft.lua'}, sep) write_file(ftplugin_file , [[vim.b.lua_ftplugin = 1]]) eq({'new-ft'}, funcs.getcompletion('new-f', 'filetype')) @@ -107,7 +105,6 @@ describe('runtime:', function() exec [[set filetype=new-ft]] eq(1, eval('b:lua_ftplugin')) - rmdir(ftplugin_folder) end) end) @@ -115,8 +112,8 @@ describe('runtime:', function() local indent_folder = table.concat({plug_dir, 'indent'}, sep) it('loads lua indents', function() - local indent_file = table.concat({indent_folder , 'new-ft.lua'}, sep) mkdir_p(indent_folder) + local indent_file = table.concat({indent_folder , 'new-ft.lua'}, sep) write_file(indent_file , [[vim.b.lua_indent = 1]]) eq({'new-ft'}, funcs.getcompletion('new-f', 'filetype')) @@ -124,7 +121,6 @@ describe('runtime:', function() exec [[set filetype=new-ft]] eq(1, eval('b:lua_indent')) - rmdir(indent_folder) end) end) @@ -132,8 +128,8 @@ describe('runtime:', function() local syntax_folder = table.concat({plug_dir, 'syntax'}, sep) before_each(function() - local syntax_file = table.concat({syntax_folder , 'my-lang.lua'}, sep) mkdir_p(syntax_folder) + local syntax_file = table.concat({syntax_folder , 'my-lang.lua'}, sep) write_file(syntax_file , [[vim.b.current_syntax = 'my-lang']]) exec([[let b:current_syntax = '']]) end) @@ -161,5 +157,20 @@ describe('runtime:', function() end) end) + describe('spell', function() + local spell_folder = table.concat({plug_dir, 'spell'}, sep) + + it('loads spell/LANG.{vim,lua}', function() + mkdir_p(spell_folder) + local spell_vim = table.concat({spell_folder , 'Xtest.vim'}, sep) + write_file(spell_vim , [[let b:spell_vim = 1]]) + local spell_lua = table.concat({spell_folder , 'Xtest.lua'}, sep) + write_file(spell_lua , [[vim.b.spell_lua = 1]]) + exec('set spelllang=Xtest') + eq(1, eval('b:spell_vim')) + eq(1, eval('b:spell_lua')) + end) + end) + end) diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index 9c8b983ff7..676be151ee 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -429,3 +429,71 @@ it('terminal truncates number of composing characters to 5', function() meths.chan_send(chan, 'a' .. composing:rep(8)) retry(nil, nil, function() eq('a' .. composing:rep(5), meths.get_current_line()) end) end) + +if is_os('win') then + describe(':terminal in Windows', function() + local screen + + before_each(function() + clear() + feed_command('set modifiable swapfile undolevels=20') + poke_eventloop() + local cmd = '["cmd.exe","/K","PROMPT=$g$s"]' + screen = thelpers.screen_setup(nil, cmd) + end) + + it('"put" operator sends data normally', function() + feed('<c-\\><c-n>G') + feed_command('let @a = ":: tty ready"') + feed_command('let @a = @a . "\\n:: appended " . @a . "\\n\\n"') + feed('"ap"ap') + screen:expect([[ + | + > :: tty ready | + > :: appended :: tty ready | + > :: tty ready | + > :: appended :: tty ready | + ^> {2: } | + :let @a = @a . "\n:: appended " . @a . "\n\n" | + ]]) + -- operator count is also taken into consideration + feed('3"ap') + screen:expect([[ + > :: appended :: tty ready | + > :: tty ready | + > :: appended :: tty ready | + > :: tty ready | + > :: appended :: tty ready | + ^> {2: } | + :let @a = @a . "\n:: appended " . @a . "\n\n" | + ]]) + end) + + it('":put" command sends data normally', function() + feed('<c-\\><c-n>G') + feed_command('let @a = ":: tty ready"') + feed_command('let @a = @a . "\\n:: appended " . @a . "\\n\\n"') + feed_command('put a') + screen:expect([[ + | + > :: tty ready | + > :: appended :: tty ready | + > {2: } | + | + ^ | + :put a | + ]]) + -- line argument is only used to move the cursor + feed_command('6put a') + screen:expect([[ + | + > :: tty ready | + > :: appended :: tty ready | + > :: tty ready | + > :: appended :: tty ready | + ^> {2: } | + :6put a | + ]]) + end) + end) +end diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 4759d68200..d03d2f1374 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -1247,6 +1247,7 @@ if (h->n_buckets < new_n_buckets) { // expand ]]} meths.buf_clear_namespace(0, ns, 0, -1) + -- Cursor should be drawn on the correct line. #22704 screen:expect{grid=[[ if (h->n_buckets < new_n_buckets) { // expand | khkey_t *new_keys = (khkey_t *) | @@ -1254,8 +1255,8 @@ if (h->n_buckets < new_n_buckets) { // expand hkey_t)); | h->keys = new_keys; | if (kh_is_map && val_size) { | - char *new_vals = {3:krealloc}( h->vals_buf, new_n_| - buck^ets * val_size); | + ^char *new_vals = {3:krealloc}( h->vals_buf, new_n_| + buckets * val_size); | h->vals_buf = new_vals; | } | } | @@ -1263,7 +1264,6 @@ if (h->n_buckets < new_n_buckets) { // expand ]]} end) - it('works with text at the beginning of the buffer', function() insert(example_text) feed 'gg' diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 5916c8e238..32f28dce26 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -2015,7 +2015,7 @@ describe('float window', function() it('terminates border on edge of viewport when window extends past viewport', function() local buf = meths.create_buf(false, false) - meths.open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single"}) + meths.open_win(buf, false, {relative='editor', width=40, height=7, row=0, col=0, border="single", zindex=201}) if multigrid then screen:expect{grid=[[ ## grid 1 @@ -2046,7 +2046,7 @@ describe('float window', function() {5:│}{2:~ }{5:│}| {5:└────────────────────────────────────────┘}| ]], float_pos={ - [4] = { { id = 1001 }, "NW", 1, 0, 0, true } + [4] = { { id = 1001 }, "NW", 1, 0, 0, true, 201 } }, win_viewport={ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; @@ -2058,8 +2058,8 @@ describe('float window', function() {5:│}{2:~ }{5:│}| {5:│}{2:~ }{5:│}| {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| {5:└──────────────────────────────────────┘}| - | ]]} end end) @@ -3723,9 +3723,9 @@ describe('float window', function() ]], float_pos=expected_pos} else screen:expect([[ - {1:very } | - {0:~ }{1:^float }{0: }| - | + {1:such } | + {0:~ }{1:very }{0: }| + ^ | ]]) end diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index d5e0eefb41..dce886ac91 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -376,7 +376,6 @@ describe('highlight', function() -- Vertical cursor: highlights char-at-cursor. #8983 command('set guicursor=a:block-blinkon175') - feed('<esc>gg$vhhh') screen:expect([[ line1 foo{1:^ bar} | | diff --git a/test/functional/ui/statuscolumn_spec.lua b/test/functional/ui/statuscolumn_spec.lua index dfbdbb4898..0a253455ad 100644 --- a/test/functional/ui/statuscolumn_spec.lua +++ b/test/functional/ui/statuscolumn_spec.lua @@ -461,7 +461,6 @@ describe('statuscolumn', function() vim.api.nvim_buf_set_extmark(0, ns, 7, 0, { virt_lines_leftcol = true, virt_lines = {{{"virt", ""}}} }) ]]) - feed('lh') -- force update cursor row screen:expect([[ 4 aaaaa | 5 aaaaa | @@ -558,4 +557,40 @@ describe('statuscolumn', function() | ]]) end) + + it("has correct width with custom sign column when (un)placing signs", function() + screen:try_resize(screen._width, 6) + exec_lua([[ + vim.cmd.norm('gg') + vim.o.signcolumn = 'no' + vim.fn.sign_define('sign', { text = 'ss' }) + _G.StatusCol = function() + local s = vim.fn.sign_getplaced(1)[1].signs + local sign = '' + if #s > 0 then + sign = vim.v.lnum == 5 and 'ss' or ' ' + end + return vim.v.lnum .. '%=' .. sign + end + vim.o.statuscolumn = "%!v:lua.StatusCol()" + vim.fn.sign_place(0, '', 'sign', 1, { lnum = 5 }) + ]]) + screen:expect([[ + 1 ^aaaaa | + 2 aaaaa | + 3 aaaaa | + 4 aaaaa | + 5 ssaaaaa | + | + ]]) + command('sign unplace 1') + screen:expect([[ + 1 ^aaaaa | + 2 aaaaa | + 3 aaaaa | + 4 aaaaa | + 5 aaaaa | + | + ]]) + end) end) diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index b7ec4da544..db2c7e1913 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -449,6 +449,7 @@ let s:filename_checks = { \ 'pod': ['file.pod'], \ 'poefilter': ['file.filter'], \ 'poke': ['file.pk'], + \ 'pony': ['file.pony'], \ 'postscr': ['file.ps', 'file.pfa', 'file.afm', 'file.eps', 'file.epsf', 'file.epsi', 'file.ai'], \ 'pov': ['file.pov'], \ 'povini': ['.povrayrc'], @@ -472,9 +473,11 @@ let s:filename_checks = { \ 'pyrex': ['file.pyx', 'file.pxd'], \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi', 'SConstruct'], \ 'ql': ['file.ql', 'file.qll'], + \ 'qmldir': ['qmldir'], \ 'quake': ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg', 'baseq2/file.cfg', 'id1/file.cfg', 'quake1/file.cfg', 'some-baseq2/file.cfg', 'some-id1/file.cfg', 'some-quake1/file.cfg'], \ 'quarto': ['file.qmd'], \ 'r': ['file.r', '.Rprofile', 'Rprofile', 'Rprofile.site'], + \ 'racket': ['file.rkt', 'file.rktd', 'file.rktl'], \ 'radiance': ['file.rad', 'file.mat'], \ 'raku': ['file.pm6', 'file.p6', 'file.t6', 'file.pod6', 'file.raku', 'file.rakumod', 'file.rakudoc', 'file.rakutest'], \ 'raml': ['file.raml'], @@ -495,6 +498,7 @@ let s:filename_checks = { \ 'rnc': ['file.rnc'], \ 'rng': ['file.rng'], \ 'rnoweb': ['file.rnw', 'file.snw'], + \ 'rpgle': ['file.rpgle', 'file.rpgleinc'], \ 'robot': ['file.robot', 'file.resource'], \ 'robots': ['robots.txt'], \ 'ron': ['file.ron'], @@ -512,7 +516,7 @@ let s:filename_checks = { \ 'sather': ['file.sa'], \ 'sbt': ['file.sbt'], \ 'scala': ['file.scala'], - \ 'scheme': ['file.scm', 'file.ss', 'file.sld', 'file.rkt', 'file.rktd', 'file.rktl'], + \ 'scheme': ['file.scm', 'file.ss', 'file.sld'], \ 'scilab': ['file.sci', 'file.sce'], \ 'screen': ['.screenrc', 'screenrc'], \ 'scss': ['file.scss'], @@ -587,6 +591,7 @@ let s:filename_checks = { \ 'taskdata': ['pending.data', 'completed.data', 'undo.data'], \ 'taskedit': ['file.task'], \ 'tcl': ['file.tcl', 'file.tm', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl', '.tclshrc', 'tclsh.rc', '.wishrc'], + \ 'tablegen': ['file.td'], \ 'teal': ['file.tl'], \ 'template': ['file.tmpl'], \ 'teraterm': ['file.ttl'], |