You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
click anywhere from the nvdash buffer except for the item areas
navigate up and down
an error message should appear.
Error produced:
E5108: Lua: ...i12/.local/share/nvim/lazy/ui/lua/nvchad/nvdash/init.lua:214: Expected 2 arguments
stack traceback:
[C]: in function 'nvim_win_set_cursor'
...i12/.local/share/nvim/lazy/ui/lua/nvchad/nvdash/init.lua:214: in function <...i12/.local/share/nvim
/lazy/ui/lua/nvchad/nvdash/init.lua:213>
Why the above error appears:
local key_movements = function(n, cmd)
local curline = fn.line "."
for i, v in ipairs(key_lines) do
if v.i == curline then
local x = key_lines[i + n] or key_lines[n == 1 and 1 or #key_lines]
if cmd and x.cmd then
vim.cmd(x.cmd)
else
return { x.i, x.col }
end
end
end
end
as you can see this function responsible for returning the new cursor position doesn't always return a valid line and col coordinates. Instead a return value only occurs inside the if v.i == curline scope . when v.i is not equal to curline ( in invalid cursor pos), it returns a nil and we see the error I pasted above.
Suggested fix / handling:
diff --git a/lua/nvchad/nvdash/init.lua b/lua/nvchad/nvdash/init.lua
index f36f3fb..c4cacfa 100644
--- a/lua/nvchad/nvdash/init.lua
+++ b/lua/nvchad/nvdash/init.lua
@@ -193,17 +193,29 @@ M.open = function(buf, win, action)
local key_movements = function(n, cmd)
local curline = fn.line "."
+ local target_i = nil;
for i, v in ipairs(key_lines) do
if v.i == curline then
- local x = key_lines[i + n] or key_lines[n == 1 and 1 or #key_lines]
- if cmd and x.cmd then
- vim.cmd(x.cmd)
- else
- return { x.i, x.col }
+ target_i = i + n
+ elseif curline > key_lines[1].i and curline < key_lines[#key_lines].i then
+ if key_lines[i].i < curline and key_lines[i + 1].i > curline then
+ if n > 0 then
+ target_i = i + n
+ else
+ target_i = i
+ end
+ break
end
end
end
+
+ local x = key_lines[target_i] or key_lines[(n == 1) and 1 or #key_lines]
+ if cmd and x.cmd then
+ vim.cmd(x.cmd)
+ else
+ return { x.i, x.col }
+ end
end
How to reproduce this issue:
Error produced:
Why the above error appears:
as you can see this function responsible for returning the new cursor position doesn't always return a valid line and col coordinates. Instead a return value only occurs inside the
if v.i == curlinescope . when v.i is not equal to curline ( in invalid cursor pos), it returns a nil and we see the error I pasted above.Suggested fix / handling:
This fix detection for nearest button.
Preview:
Screencast.From.2026-04-11.02-06-52.mp4