Skip to content

Conversation

@zachMahan64
Copy link

I received some out-of-range Lua errors when loading NvDash (in my essentially stock NvChad set-up), due to large text-art being rendered on a small terminal window.

The error:

Error executing vim.schedule lua callback: ...han/.local/share/nvim/lazy/ui/lua/nvchad/nvdash/init.l
ua:191: Column value outside range
stack traceback:
        [C]: in function 'nvim_win_set_cursor'
        ...han/.local/share/nvim/lazy/ui/lua/nvchad/nvdash/init.lua:191: in function 'open'
        ...rs/zachmahan/.local/share/nvim/lazy/ui/lua/nvchad/au.lua:12: in main chunk
        [C]: in function 'require'
        .../zachmahan/.local/share/nvim/lazy/ui/lua/nvchad/init.lua:32: in function <.../zachmahan/.
local/share/nvim/lazy/ui/lua/nvchad/init.lua:31

My fixes:

  • Clamp the cursor column to the length of the line.
  • Ensure key_movements always returns a valid {row, col} tuple.

These changes prevent E5108 errors when opening or scrolling in NvDash in small terminal windows with large text-art.

@siduck
Copy link
Member

siduck commented Sep 7, 2025

share your setup

@zachMahan64
Copy link
Author

@siduck

here's my config. I haven't touched the NvChad core, and my only config is inside this repo.

files of interest:
my chadrc
and
my nvdash headers

It is worth noting that the size checks in my chadrc when loading the nvdash header are silently failing and defaulting to the large size. Nonetheless, the lack of clamping is still causing errors when large headers are loaded. I do not know how directly related, if at all, those issues are.

I tested my exact same config on both macOS and Fedora and had the same issue on both until I made the changes in the PR.

@siduck
Copy link
Member

siduck commented Sep 7, 2025

header can be a function btw, try that 🤔

@zachMahan64
Copy link
Author

@siduck

like this? still getting the same issue.

original

-- ... in chadrc
header = (function()
        local rows = vim.o.lines
        local cols = vim.o.columns
        if rows < 30 then
            return require "custom.nvdash.small"
        elseif cols < 100 or rows < 50 then
            return require "custom.nvdash.large"
        else
            return require "custom.nvdash.large"
        end
    end)(),
-- ... in chadrc

what i just tried

-- ... in chadrc
header = function()
        local rows = vim.o.lines
        local cols = vim.o.columns
        if rows < 30 then
            return require "custom.nvdash.small"
        elseif cols < 100 or rows < 50 then
            return require "custom.nvdash.large"
        else
            return require "custom.nvdash.large"
        end
    end
-- ... in chadrc

@siduck
Copy link
Member

siduck commented Sep 7, 2025

yes the 2nd one, i'm assuming it happens cuz of your large header?

@zachMahan64
Copy link
Author

@siduck

i'm still seeing the issue with the second one. With the PR changes, there’s no error, but now the cursor doesn’t visually hover above the buttons.

navigation (scroll/select) works fine, though the cursor ends up slightly left of the buttons (looks like column 2). Not really sure why this affects the hover, but it seems more about how the cursor works with buttons' text than whether the header is a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants