neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit f2e60d000ed3e8e9b3f8d2f55d9c7441352e958d
parent 58d85cd03dc8067253aa525c38ea8c6c13d8cc2a
Author: phanium <91544758+phanen@users.noreply.github.com>
Date:   Mon,  9 Jun 2025 15:07:38 +0800

fix: `fn.exists()` typos (#34390)

Problem:  `exists()` checks should test for being equal to 1 rather than truthy, and extui check can be more restrictive.
Solution:  Adjust `exists()` guards to equal 1 and use `matchparen#CursorMoved`.
Diffstat:
Mruntime/lua/vim/_extui/cmdline.lua | 2+-
Mtest/functional/ui/cmdline_highlight_spec.lua | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/runtime/lua/vim/_extui/cmdline.lua b/runtime/lua/vim/_extui/cmdline.lua @@ -98,7 +98,7 @@ function M.cmdline_pos(pos) if curpos[1] ~= M.row + 1 or curpos[2] ~= promptlen + pos then curpos[1], curpos[2] = M.row + 1, promptlen + pos -- Add matchparen highlighting to non-prompt part of cmdline. - if pos > 0 and fn.exists('#matchparen') then + if pos > 0 and fn.exists('#matchparen#CursorMoved') == 1 then api.nvim_win_set_cursor(ext.wins.cmd, { curpos[1], curpos[2] - 1 }) vim._with({ win = ext.wins.cmd, wo = { eventignorewin = '' } }, function() api.nvim_exec_autocmds('CursorMoved', {}) diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua @@ -157,7 +157,7 @@ end) local function set_color_cb(funcname, callback_return, id) api.nvim_set_var('id', id or '') - if id and id ~= '' and fn.exists('*' .. funcname .. 'N') then + if id and id ~= '' and fn.exists('*' .. funcname .. 'N') == 1 then command(('let g:Nvim_color_input%s = {cmdline -> %sN(%s, cmdline)}'):format(id, funcname, id)) if callback_return then api.nvim_set_var('callback_return' .. id, callback_return)