mirror of
https://github.com/neovim/neovim.git
synced 2026-07-18 15:11:40 +00:00
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`.
This commit is contained in:
@@ -98,7 +98,7 @@ function M.cmdline_pos(pos)
|
|||||||
if curpos[1] ~= M.row + 1 or curpos[2] ~= promptlen + pos then
|
if curpos[1] ~= M.row + 1 or curpos[2] ~= promptlen + pos then
|
||||||
curpos[1], curpos[2] = M.row + 1, promptlen + pos
|
curpos[1], curpos[2] = M.row + 1, promptlen + pos
|
||||||
-- Add matchparen highlighting to non-prompt part of cmdline.
|
-- 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 })
|
api.nvim_win_set_cursor(ext.wins.cmd, { curpos[1], curpos[2] - 1 })
|
||||||
vim._with({ win = ext.wins.cmd, wo = { eventignorewin = '' } }, function()
|
vim._with({ win = ext.wins.cmd, wo = { eventignorewin = '' } }, function()
|
||||||
api.nvim_exec_autocmds('CursorMoved', {})
|
api.nvim_exec_autocmds('CursorMoved', {})
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ end)
|
|||||||
|
|
||||||
local function set_color_cb(funcname, callback_return, id)
|
local function set_color_cb(funcname, callback_return, id)
|
||||||
api.nvim_set_var('id', id or '')
|
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))
|
command(('let g:Nvim_color_input%s = {cmdline -> %sN(%s, cmdline)}'):format(id, funcname, id))
|
||||||
if callback_return then
|
if callback_return then
|
||||||
api.nvim_set_var('callback_return' .. id, callback_return)
|
api.nvim_set_var('callback_return' .. id, callback_return)
|
||||||
|
|||||||
Reference in New Issue
Block a user