diff options
-rw-r--r-- | .github/workflows/release.yml | 19 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | cmake.deps/CMakeLists.txt | 6 | ||||
-rw-r--r-- | contrib/flake.nix | 157 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 79 | ||||
-rw-r--r-- | runtime/lua/vim/diagnostic.lua | 13 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/buf.lua | 193 | ||||
-rw-r--r-- | runtime/nvim.appdata.xml | 1 | ||||
-rwxr-xr-x | src/nvim/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/nvim/match.c | 20 | ||||
-rw-r--r-- | src/nvim/testdir/test_search.vim | 76 | ||||
-rw-r--r-- | test/functional/fixtures/api_level_10.mpack | bin | 0 -> 30761 bytes | |||
-rw-r--r-- | test/functional/legacy/search_spec.lua | 30 | ||||
-rw-r--r-- | test/functional/ui/searchhl_spec.lua | 22 |
14 files changed, 198 insertions, 425 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5fc40a2471..e713e3969a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -131,12 +131,7 @@ jobs: DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }} DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }} CMAKE_BUILD_TYPE: "RelWithDebInfo" - strategy: - matrix: - include: - - config: MSVC_64 - archive: nvim-win64 - name: windows (${{ matrix.config }}) + name: windows (MSVC_64) steps: - uses: actions/checkout@v3 with: @@ -147,10 +142,10 @@ jobs: run: .\ci\build.ps1 -Package - uses: actions/upload-artifact@v3 with: - name: ${{ matrix.archive }} + name: nvim-win64 path: | - build/${{ matrix.archive }}.msi - build/${{ matrix.archive }}.zip + build/nvim-win64.msi + build/nvim-win64.zip retention-days: 1 publish: @@ -238,10 +233,10 @@ jobs: steps: - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly') name: Publish stable - uses: vedantmgoyal2009/winget-releaser@latest + uses: vedantmgoyal2009/winget-releaser@v1 with: identifier: Neovim.Neovim - release-tag: ${{ github.event.inputs.tag_name || github.ref }} + release-tag: ${{ github.event.inputs.tag_name || github.ref_name }} token: ${{ secrets.WINGET_TOKEN }} - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') name: Get nightly version @@ -253,7 +248,7 @@ jobs: echo "::set-output name=version::$VERSION" - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') name: Publish nightly - uses: vedantmgoyal2009/winget-releaser@latest + uses: vedantmgoyal2009/winget-releaser@v1 with: identifier: Neovim.Neovim.Nightly version: ${{ steps.get-version.outputs.version }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 76526d6ccb..35af9f88bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,14 +131,14 @@ endif() # If not in a git repo (e.g., a tarball) these tokens define the complete # version string, else they are combined with the result of `git describe`. set(NVIM_VERSION_MAJOR 0) -set(NVIM_VERSION_MINOR 8) +set(NVIM_VERSION_MINOR 9) set(NVIM_VERSION_PATCH 0) set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers # API level 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 true) +set(NVIM_API_PRERELEASE false) set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}") # NVIM_VERSION_CFLAGS set further below. diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt index f5d2008086..07ea3fdd3d 100644 --- a/cmake.deps/CMakeLists.txt +++ b/cmake.deps/CMakeLists.txt @@ -183,9 +183,9 @@ set(LUV_SHA256 f8c69908e17ec8ab370253d1508e23deaecfc0c4752d2efb77e427e579501104) set(LUA_COMPAT53_URL https://github.com/keplerproject/lua-compat-5.3/archive/v0.9.tar.gz) set(LUA_COMPAT53_SHA256 ad05540d2d96a48725bb79a1def35cf6652a4e2ec26376e2617c8ce2baa6f416) -# cat.exe curl.exe curl-ca-bundle.crt tee.exe xxd.exe -set(WINTOOLS_URL https://github.com/neovim/deps/raw/db6981d3d86c9eb78656883b72a7e493b06d31fb/opt/win32tools.zip) -set(WINTOOLS_SHA256 8344cac77fd37e60bb3ac29b0507f5bad29ad710644671bad370910fd16e43cf) +# cat.exe curl.exe curl-ca-bundle.crt diff.exe tee.exe xxd.exe +set(WINTOOLS_URL https://github.com/neovim/deps/raw/c1e7dd8de9e1b18d11dcfa0a192cd029262e5303/opt/win32tools.zip) +set(WINTOOLS_SHA256 3c4c490a3d392ceeb1347cb77cc821a31900b688a2189276d3a1131a3f21daf1) set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.17/neovim-qt.zip) set(WINGUI_SHA256 502e386eef677c2c2e0c11d8cbb27f3e12b4d96818369417e8da4129c4580c25) diff --git a/contrib/flake.nix b/contrib/flake.nix index ef3174dda1..cd6242a8d6 100644 --- a/contrib/flake.nix +++ b/contrib/flake.nix @@ -8,61 +8,63 @@ outputs = { self, nixpkgs, flake-utils }: { - overlay = final: prev: - let - pkgs = nixpkgs.legacyPackages.${prev.system}; - in - rec { - neovim = pkgs.neovim-unwrapped.overrideAttrs (oa: { - version = "master"; - src = ../.; - - buildInputs = oa.buildInputs ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ - CoreServices - ]); + overlay = final: prev: rec { + neovim-unwrapped = prev.neovim-unwrapped.override ({ + libvterm-neovim = prev.libvterm-neovim.overrideAttrs (old: { + version = "0.3"; + src = builtins.fetchTarball { + url = "https://www.leonerd.org.uk/code/libvterm/libvterm-0.3.tar.gz"; + sha256 = "0zg6sn5brwrnqaab883pdj0l2swk5askbbwbdam0zq55ikbrzgar"; + }; }); - - # a development binary to help debug issues - neovim-debug = - let - stdenv = if pkgs.stdenv.isLinux then pkgs.llvmPackages_latest.stdenv else pkgs.stdenv; - in - ((neovim.override { - lua = pkgs.luajit; - inherit stdenv; - }).overrideAttrs (oa: { - - dontStrip = true; - NIX_CFLAGS_COMPILE = " -ggdb -Og"; - - cmakeBuildType = "Debug"; - cmakeFlags = oa.cmakeFlags ++ [ - "-DMIN_LOG_LEVEL=0" - ]; - - disallowedReferences = [ ]; - })); - - # for neovim developers, beware of the slow binary - neovim-developer = - let - lib = nixpkgs.lib; - luacheck = pkgs.luaPackages.luacheck; - in - (neovim-debug.override ({ doCheck = pkgs.stdenv.isLinux; })).overrideAttrs (oa: { - cmakeFlags = oa.cmakeFlags ++ [ - "-DLUACHECK_PRG=${luacheck}/bin/luacheck" - "-DMIN_LOG_LEVEL=0" - "-DENABLE_LTO=OFF" - ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ - # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags - # https://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports - "-DCLANG_ASAN_UBSAN=ON" - ]; - }); - }; - } // - flake-utils.lib.eachDefaultSystem (system: + }); + + neovim = final.neovim-unwrapped.overrideAttrs (oa: { + version = "master"; + src = ../.; + + buildInputs = oa.buildInputs + ++ final.lib.optionals final.stdenv.isDarwin + (with final.darwin.apple_sdk.frameworks; [ CoreServices ]); + }); + + # a development binary to help debug issues + neovim-debug = let + stdenv = if final.stdenv.isLinux then + final.llvmPackages_latest.stdenv + else + final.stdenv; + in ((neovim.override { + lua = final.luajit; + inherit stdenv; + }).overrideAttrs (oa: { + + dontStrip = true; + NIX_CFLAGS_COMPILE = " -ggdb -Og"; + + cmakeBuildType = "Debug"; + cmakeFlags = oa.cmakeFlags ++ [ "-DMIN_LOG_LEVEL=0" ]; + + disallowedReferences = [ ]; + })); + + # for neovim developers, beware of the slow binary + neovim-developer = let luacheck = final.luaPackages.luacheck; + in (neovim-debug.override ({ + doCheck = final.stdenv.isLinux; + })).overrideAttrs (oa: { + cmakeFlags = oa.cmakeFlags ++ [ + "-DLUACHECK_PRG=${luacheck}/bin/luacheck" + "-DMIN_LOG_LEVEL=0" + "-DENABLE_LTO=OFF" + ] ++ final.lib.optionals final.stdenv.isLinux [ + # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags + # https://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports + "-DCLANG_ASAN_UBSAN=ON" + ]; + }); + }; + } // flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { overlays = [ self.overlay ]; @@ -75,26 +77,22 @@ ps.msgpack ps.flake8 # for 'make pylint' ]); - in - rec { - + in { packages = with pkgs; { default = neovim; inherit neovim neovim-debug neovim-developer; }; checks = { - pylint = pkgs.runCommandNoCC "pylint" - { - nativeBuildInputs = [ pythonEnv ]; - preferLocalBuild = true; - } "make -C ${./..} pylint > $out"; - - shlint = pkgs.runCommandNoCC "shlint" - { - nativeBuildInputs = [ pkgs.shellcheck ]; - preferLocalBuild = true; - } "make -C ${./..} shlint > $out"; + pylint = pkgs.runCommand "pylint" { + nativeBuildInputs = [ pythonEnv ]; + preferLocalBuild = true; + } "make -C ${./..} pylint > $out"; + + shlint = pkgs.runCommand "shlint" { + nativeBuildInputs = [ pkgs.shellcheck ]; + preferLocalBuild = true; + } "make -C ${./..} shlint > $out"; }; # kept for backwards-compatibility @@ -103,17 +101,18 @@ devShells = { default = pkgs.neovim-developer.overrideAttrs (oa: { - buildInputs = with pkgs; oa.buildInputs ++ [ - cmake - lua.pkgs.luacheck - sumneko-lua-language-server - pythonEnv - include-what-you-use # for scripts/check-includes.py - jq # jq for scripts/vim-patch.sh -r - shellcheck # for `make shlint` - doxygen # for script/gen_vimdoc.py - clang-tools # for clangd to find the correct headers - ]; + buildInputs = with pkgs; + oa.buildInputs ++ [ + cmake + lua.pkgs.luacheck + sumneko-lua-language-server + pythonEnv + include-what-you-use # for scripts/check-includes.py + jq # jq for scripts/vim-patch.sh -r + shellcheck # for `make shlint` + doxygen # for script/gen_vimdoc.py + clang-tools # for clangd to find the correct headers + ]; shellHook = oa.shellHook + '' export NVIM_PYTHON_LOG_LEVEL=DEBUG diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 26bca21507..b3bff89224 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1145,59 +1145,6 @@ format({options}) *vim.lsp.buf.format()* Defaults to `nil` in other modes, formatting the full buffer -formatting({options}) *vim.lsp.buf.formatting()* - Formats the current buffer. - - Parameters: ~ - {options} (table|nil) Can be used to specify FormattingOptions. Some - unspecified options will be automatically derived from the - current Neovim options. - - See also: ~ - https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting - - *vim.lsp.buf.formatting_seq_sync()* -formatting_seq_sync({options}, {timeout_ms}, {order}) - Formats the current buffer by sequentially requesting formatting from - attached clients. - - Useful when multiple clients with formatting capability are attached. - - Since it's synchronous, can be used for running on save, to make sure - buffer is formatted prior to being saved. {timeout_ms} is passed on to the - |vim.lsp.client| `request_sync` method. Example: > - - vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]] -< - - Parameters: ~ - {options} (table|nil) `FormattingOptions` entries - {timeout_ms} (number|nil) Request timeout - {order} (table|nil) List of client names. Formatting is - requested from clients in the following order: first all - clients that are not in the `order` list, then the - remaining clients in the order as they occur in the - `order` list. - - *vim.lsp.buf.formatting_sync()* -formatting_sync({options}, {timeout_ms}) - Performs |vim.lsp.buf.formatting()| synchronously. - - Useful for running on save, to make sure buffer is formatted prior to - being saved. {timeout_ms} is passed on to |vim.lsp.buf_request_sync()|. - Example: -> - - autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync() -< - - Parameters: ~ - {options} (table|nil) with valid `FormattingOptions` entries - {timeout_ms} (number) Request timeout - - See also: ~ - |vim.lsp.buf.format()| - hover() *vim.lsp.buf.hover()* Displays hover information about the symbol under the cursor in a floating window. Calling the function twice will jump into the floating window. @@ -1224,32 +1171,6 @@ outgoing_calls() *vim.lsp.buf.outgoing_calls()* |quickfix| window. If the symbol can resolve to multiple items, the user can pick one in the |inputlist()|. - *vim.lsp.buf.range_code_action()* -range_code_action({context}, {start_pos}, {end_pos}) - Performs |vim.lsp.buf.code_action()| for a given range. - - Parameters: ~ - {context} (table|nil) `CodeActionContext` of the LSP specification: - • diagnostics: (table|nil) LSP`Diagnostic[]` . Inferred from the current position if not provided. - • only: (table|nil) List of LSP `CodeActionKind`s used to - filter the code actions. Most language servers support - values like `refactor` or `quickfix`. - {start_pos} ({number, number}, optional) mark-indexed position. - Defaults to the start of the last visual selection. - {end_pos} ({number, number}, optional) mark-indexed position. - Defaults to the end of the last visual selection. - - *vim.lsp.buf.range_formatting()* -range_formatting({options}, {start_pos}, {end_pos}) - Formats a given range. - - Parameters: ~ - {options} Table with valid `FormattingOptions` entries. - {start_pos} ({number, number}, optional) mark-indexed position. - Defaults to the start of the last visual selection. - {end_pos} ({number, number}, optional) mark-indexed position. - Defaults to the end of the last visual selection. - references({context}, {options}) *vim.lsp.buf.references()* Lists all the references to the symbol under the cursor in the quickfix window. diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 98dbe0779b..84091fbf0e 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -357,19 +357,6 @@ local function execute_scheduled_display(namespace, bufnr) M.show(namespace, bufnr, nil, args) end ---- @deprecated ---- Callback scheduled when leaving Insert mode. ---- ---- called from the Vimscript autocommand. ---- ---- See @ref schedule_display() ---- ----@private -function M._execute_scheduled_display(namespace, bufnr) - vim.deprecate('vim.diagnostic._execute_scheduled_display', nil, '0.9') - execute_scheduled_display(namespace, bufnr) -end - --- Table of autocmd events to fire the update for displaying new diagnostic information local insert_leave_auto_cmds = { 'InsertLeave', 'CursorHoldI' } diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index b9aaacb437..8550fe253b 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -119,38 +119,6 @@ function M.completion(context) end ---@private ---- If there is more than one client that supports the given method, ---- asks the user to select one. --- ----@returns The client that the user selected or nil -local function select_client(method, on_choice) - validate({ - on_choice = { on_choice, 'function', false }, - }) - local clients = vim.tbl_values(vim.lsp.buf_get_clients()) - clients = vim.tbl_filter(function(client) - return client.supports_method(method) - end, clients) - -- better UX when choices are always in the same order (between restarts) - table.sort(clients, function(a, b) - return a.name < b.name - end) - - if #clients > 1 then - vim.ui.select(clients, { - prompt = 'Select a language server:', - format_item = function(client) - return client.name - end, - }, on_choice) - elseif #clients < 1 then - on_choice(nil) - else - on_choice(clients[1]) - end -end - ----@private ---@return table {start={row, col}, end={row, col}} using (1, 0) indexing local function range_from_selection() -- TODO: Use `vim.region()` instead https://github.com/neovim/neovim/pull/13896 @@ -283,139 +251,6 @@ function M.format(options) end end ---- Formats the current buffer. ---- ----@param options (table|nil) Can be used to specify FormattingOptions. ---- Some unspecified options will be automatically derived from the current ---- Neovim options. --- ----@see https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting -function M.formatting(options) - vim.notify_once( - 'vim.lsp.buf.formatting is deprecated. Use vim.lsp.buf.format { async = true } instead', - vim.log.levels.WARN - ) - local params = util.make_formatting_params(options) - local bufnr = api.nvim_get_current_buf() - select_client('textDocument/formatting', function(client) - if client == nil then - return - end - - return client.request('textDocument/formatting', params, nil, bufnr) - end) -end - ---- Performs |vim.lsp.buf.formatting()| synchronously. ---- ---- Useful for running on save, to make sure buffer is formatted prior to being ---- saved. {timeout_ms} is passed on to |vim.lsp.buf_request_sync()|. Example: ---- ---- <pre> ---- autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync() ---- </pre> ---- ----@param options table|nil with valid `FormattingOptions` entries ----@param timeout_ms (number) Request timeout ----@see |vim.lsp.buf.format()| -function M.formatting_sync(options, timeout_ms) - vim.notify_once( - 'vim.lsp.buf.formatting_sync is deprecated. Use vim.lsp.buf.format instead', - vim.log.levels.WARN - ) - local params = util.make_formatting_params(options) - local bufnr = api.nvim_get_current_buf() - select_client('textDocument/formatting', function(client) - if client == nil then - return - end - - local result, err = client.request_sync('textDocument/formatting', params, timeout_ms, bufnr) - if result and result.result then - util.apply_text_edits(result.result, bufnr, client.offset_encoding) - elseif err then - vim.notify('vim.lsp.buf.formatting_sync: ' .. err, vim.log.levels.WARN) - end - end) -end - ---- Formats the current buffer by sequentially requesting formatting from attached clients. ---- ---- Useful when multiple clients with formatting capability are attached. ---- ---- Since it's synchronous, can be used for running on save, to make sure buffer is formatted ---- prior to being saved. {timeout_ms} is passed on to the |vim.lsp.client| `request_sync` method. ---- Example: ---- <pre> ---- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]] ---- </pre> ---- ----@param options (table|nil) `FormattingOptions` entries ----@param timeout_ms (number|nil) Request timeout ----@param order (table|nil) List of client names. Formatting is requested from clients ----in the following order: first all clients that are not in the `order` list, then ----the remaining clients in the order as they occur in the `order` list. -function M.formatting_seq_sync(options, timeout_ms, order) - vim.notify_once( - 'vim.lsp.buf.formatting_seq_sync is deprecated. Use vim.lsp.buf.format instead', - vim.log.levels.WARN - ) - local clients = vim.tbl_values(vim.lsp.buf_get_clients()) - local bufnr = api.nvim_get_current_buf() - - -- sort the clients according to `order` - for _, client_name in pairs(order or {}) do - -- if the client exists, move to the end of the list - for i, client in pairs(clients) do - if client.name == client_name then - table.insert(clients, table.remove(clients, i)) - break - end - end - end - - -- loop through the clients and make synchronous formatting requests - for _, client in pairs(clients) do - if vim.tbl_get(client.server_capabilities, 'documentFormattingProvider') then - local params = util.make_formatting_params(options) - local result, err = client.request_sync( - 'textDocument/formatting', - params, - timeout_ms, - api.nvim_get_current_buf() - ) - if result and result.result then - util.apply_text_edits(result.result, bufnr, client.offset_encoding) - elseif err then - vim.notify( - string.format('vim.lsp.buf.formatting_seq_sync: (%s) %s', client.name, err), - vim.log.levels.WARN - ) - end - end - end -end - ---- Formats a given range. ---- ----@param options Table with valid `FormattingOptions` entries. ----@param start_pos ({number, number}, optional) mark-indexed position. ----Defaults to the start of the last visual selection. ----@param end_pos ({number, number}, optional) mark-indexed position. ----Defaults to the end of the last visual selection. -function M.range_formatting(options, start_pos, end_pos) - vim.deprecate('vim.lsp.buf.range_formatting', 'vim.lsp.formatexpr or vim.lsp.buf.format', '0.9.0') - local params = util.make_given_range_params(start_pos, end_pos) - params.options = util.make_formatting_params(options).options - select_client('textDocument/rangeFormatting', function(client) - if client == nil then - return - end - - return client.request('textDocument/rangeFormatting', params) - end) -end - --- Renames all references to the symbol under the cursor. --- ---@param new_name string|nil If not provided, the user will be prompted for a new @@ -943,34 +778,6 @@ function M.code_action(options) code_action_request(params, options) end ---- Performs |vim.lsp.buf.code_action()| for a given range. ---- ---- ----@param context table|nil `CodeActionContext` of the LSP specification: ---- - diagnostics: (table|nil) ---- LSP `Diagnostic[]`. Inferred from the current ---- position if not provided. ---- - only: (table|nil) ---- List of LSP `CodeActionKind`s used to filter the code actions. ---- Most language servers support values like `refactor` ---- or `quickfix`. ----@param start_pos ({number, number}, optional) mark-indexed position. ----Defaults to the start of the last visual selection. ----@param end_pos ({number, number}, optional) mark-indexed position. ----Defaults to the end of the last visual selection. -function M.range_code_action(context, start_pos, end_pos) - vim.deprecate('vim.lsp.buf.range_code_action', 'vim.lsp.buf.code_action', '0.9.0') - validate({ context = { context, 't', true } }) - context = context or {} - if not context.diagnostics then - local bufnr = api.nvim_get_current_buf() - context.diagnostics = vim.lsp.diagnostic.get_line_diagnostics(bufnr) - end - local params = util.make_given_range_params(start_pos, end_pos) - params.context = context - code_action_request(params) -end - --- Executes an LSP server command. --- ---@param command_params table A valid `ExecuteCommandParams` object diff --git a/runtime/nvim.appdata.xml b/runtime/nvim.appdata.xml index 1464c27694..e8d392ec7d 100644 --- a/runtime/nvim.appdata.xml +++ b/runtime/nvim.appdata.xml @@ -26,6 +26,7 @@ </screenshots> <releases> + <release date="2022-09-30" version="0.8.0"/> <release date="2022-04-15" version="0.7.0"/> <release date="2021-12-31" version="0.6.1"/> <release date="2021-11-30" version="0.6.0"/> diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index f19eb8fb69..504fe6ff4a 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -490,6 +490,7 @@ if(WIN32) foreach(DEP_FILE IN ITEMS curl-ca-bundle.crt curl.exe + diff.exe tee.exe win32yank.exe xxd.exe @@ -531,6 +532,8 @@ if(WIN32) translations/qt_uk.qm D3Dcompiler_47.dll libEGL.dll + libgcc_s_seh-1.dll + libGLESv2.dll libstdc++-6.dll libwinpthread-1.dll nvim-qt.exe diff --git a/src/nvim/match.c b/src/nvim/match.c index cd8c65cc02..f41eab889b 100644 --- a/src/nvim/match.c +++ b/src/nvim/match.c @@ -738,7 +738,13 @@ int update_search_hl(win_T *wp, linenr_T lnum, colnr_T col, char_u **line, match if (shl->startcol == shl->endcol) { // highlight empty match, try again after it - shl->endcol += utfc_ptr2len((char *)(*line) + shl->endcol); + char *p = (char *)(*line) + shl->endcol; + + if (*p == NUL) { + shl->endcol++; + } else { + shl->endcol += utfc_ptr2len(p); + } } // Loop to check if the match starts at the @@ -792,12 +798,19 @@ bool get_prevcol_hl_flag(win_T *wp, match_T *search_hl, long curcol) prevcol++; } - if (!search_hl->is_addpos && prevcol == search_hl->startcol) { + // Highlight a character after the end of the line if the match started + // at the end of the line or when the match continues in the next line + // (match includes the line break). + if (!search_hl->is_addpos && (prevcol == (long)search_hl->startcol + || (prevcol > (long)search_hl->startcol + && search_hl->endcol == MAXCOL))) { return true; } else { cur = wp->w_match_head; while (cur != NULL) { - if (!cur->hl.is_addpos && prevcol == cur->hl.startcol) { + if (!cur->hl.is_addpos && (prevcol == (long)cur->hl.startcol + || (prevcol > (long)cur->hl.startcol + && cur->hl.endcol == MAXCOL))) { return true; } cur = cur->next; @@ -815,7 +828,6 @@ void get_search_match_hl(win_T *wp, match_T *search_hl, long col, int *char_attr bool shl_flag = false; // flag to indicate whether search_hl // has been processed or not - *char_attr = search_hl->attr; while (cur != NULL || !shl_flag) { if (!shl_flag && (cur == NULL || cur->priority > SEARCH_HL_PRIORITY)) { diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index 3d1bbfb726..0cf55c7d0b 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -956,24 +956,24 @@ func Test_incsearch_search_dump() call delete('Xis_search_script') endfunc -func Test_hlsearch_block_visual_match() +func Test_hlsearch_dump() + CheckOption hlsearch CheckScreendump - let lines =<< trim END - set hlsearch - call setline(1, ['aa', 'bbbb', 'cccccc']) - END - call writefile(lines, 'Xhlsearch_block') - let buf = RunVimInTerminal('-S Xhlsearch_block', {'rows': 9, 'cols': 60}) + call writefile([ + \ 'set hlsearch cursorline', + \ 'call setline(1, ["xxx", "xxx", "xxx"])', + \ '/.*', + \ '2', + \ ], 'Xhlsearch_script') + let buf = RunVimInTerminal('-S Xhlsearch_script', {'rows': 6, 'cols': 50}) + call VerifyScreenDump(buf, 'Test_hlsearch_1', {}) - call term_sendkeys(buf, "G\<C-V>$kk\<Esc>") - sleep 100m - call term_sendkeys(buf, "/\\%V\<CR>") - sleep 100m - call VerifyScreenDump(buf, 'Test_hlsearch_block_visual_match', {}) + call term_sendkeys(buf, "/\\_.*\<CR>") + call VerifyScreenDump(buf, 'Test_hlsearch_2', {}) call StopVimInTerminal(buf) - call delete('Xhlsearch_block') + call delete('Xhlsearch_script') endfunc func Test_hlsearch_and_visual() @@ -996,6 +996,26 @@ func Test_hlsearch_and_visual() call delete('Xhlvisual_script') endfunc +func Test_hlsearch_block_visual_match() + CheckScreendump + + let lines =<< trim END + set hlsearch + call setline(1, ['aa', 'bbbb', 'cccccc']) + END + call writefile(lines, 'Xhlsearch_block') + let buf = RunVimInTerminal('-S Xhlsearch_block', {'rows': 9, 'cols': 60}) + + call term_sendkeys(buf, "G\<C-V>$kk\<Esc>") + sleep 100m + call term_sendkeys(buf, "/\\%V\<CR>") + sleep 100m + call VerifyScreenDump(buf, 'Test_hlsearch_block_visual_match', {}) + + call StopVimInTerminal(buf) + call delete('Xhlsearch_block') +endfunc + func Test_incsearch_substitute() CheckFunction test_override CheckOption incsearch @@ -1017,6 +1037,21 @@ func Test_incsearch_substitute() call Incsearch_cleanup() endfunc +func Test_incsearch_substitute_long_line() + CheckFunction test_override + new + call test_override("char_avail", 1) + set incsearch + + call repeat('x', 100000)->setline(1) + call feedkeys(':s/\%c', 'xt') + redraw + call feedkeys("\<Esc>", 'xt') + + call Incsearch_cleanup() + bwipe! +endfunc + func Test_hlsearch_cursearch() CheckScreendump @@ -1341,21 +1376,6 @@ func Test_subst_word_under_cursor() set noincsearch endfunc -func Test_incsearch_substitute_long_line() - CheckFunction test_override - new - call test_override("char_avail", 1) - set incsearch - - call repeat('x', 100000)->setline(1) - call feedkeys(':s/\%c', 'xt') - redraw - call feedkeys("\<Esc>", 'xt') - - call Incsearch_cleanup() - bwipe! -endfunc - func Test_search_undefined_behaviour() CheckFeature terminal diff --git a/test/functional/fixtures/api_level_10.mpack b/test/functional/fixtures/api_level_10.mpack Binary files differnew file mode 100644 index 0000000000..2a1f51045d --- /dev/null +++ b/test/functional/fixtures/api_level_10.mpack diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua index 67991f5d48..5a94fca794 100644 --- a/test/functional/legacy/search_spec.lua +++ b/test/functional/legacy/search_spec.lua @@ -644,7 +644,35 @@ end) describe('Search highlight', function() before_each(clear) - it('Search highlight is combined with Visual highlight vim-patch:8.2.2797', function() + + -- oldtest: Test_hlsearch_dump() + it('beyond line end vim-patch:8.2.2542', function() + local screen = Screen.new(50, 6) + screen:set_default_attr_ids({ + [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [2] = {background = Screen.colors.Yellow}, -- Search + [3] = {background = Screen.colors.Grey90}, -- CursorLine + }) + screen:attach() + exec([[ + set hlsearch noincsearch cursorline + call setline(1, ["xxx", "xxx", "xxx"]) + /.* + 2 + ]]) + feed([[/\_.*<CR>]]) + screen:expect([[ + {2:xxx } | + {2:xxx } | + {2:^xxx }{3: }| + {1:~ }| + {1:~ }| + /\_.* | + ]]) + end) + + -- oldtest: Test_hlsearch_and_visual() + it('is combined with Visual highlight vim-patch:8.2.2797', function() local screen = Screen.new(40, 6) screen:set_default_attr_ids({ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index c5c88323a2..18bbb56a61 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -221,10 +221,10 @@ describe('search highlighting', function() feed('gg/foo\\nbar<CR>') screen:expect([[ one | - {2:^foo} | + {2:^foo } | {2:bar} | baz | - {1:foo} | + {1:foo } | {1:bar} | /foo\nbar | ]]) @@ -232,20 +232,20 @@ describe('search highlighting', function() feed('gg/efg\\nhij<CR>') screen:expect([[ --- | - abcd{2:^efg} | + abcd{2:^efg } | {2:hij}kl | --- | - abcd{1:efg} | + abcd{1:efg } | {1:hij}kl | /efg\nhij | ]]) feed('n') screen:expect([[ --- | - abcd{1:efg} | + abcd{1:efg } | {1:hij}kl | --- | - abcd{2:^efg} | + abcd{2:^efg } | {2:hij}kl | /efg\nhij | ]]) @@ -548,9 +548,9 @@ describe('search highlighting', function() feed('/line\\na<cr>') screen:expect([[ | - a repeated {2:^line} | - {2:a} repeated {2:line} | - {2:a} repeated {2:line} | + a repeated {2:^line } | + {2:a} repeated {2:line } | + {2:a} repeated {2:line } | {2:a} repeated line | {1:~ }| {4:search hit BOTTOM, continuing at TOP} | @@ -560,9 +560,9 @@ describe('search highlighting', function() feed('4Grb') screen:expect([[ | - a repeated {2:line} | + a repeated {2:line } | {2:a} repeated line | - ^b repeated {2:line} | + ^b repeated {2:line } | {2:a} repeated line | {1:~ }| {4:search hit BOTTOM, continuing at TOP} | |