Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

end_col value outside range #181

Closed
ichirou2910 opened this issue Oct 30, 2022 · 0 comments · Fixed by #639
Closed

end_col value outside range #181

ichirou2910 opened this issue Oct 30, 2022 · 0 comments · Fixed by #639

Comments

@ichirou2910
Copy link

This is more like a "send help" request rather than an issue. I don't really know where to put this one so I decided to put it here.

I'm using a custom render for vim-notify which will print the message first then the title and icon. When I started using noice, everytime a replace command fails there will be an error of end_col value outside range. Can someone help me with this?

I'm using the relevant plugins' default configuration (call the setup function with no argument, except for vim-notify with the custom render), latest commit Neovim, latest commit plugins (through Packer's PackerSync).

vim-notify's custom render

local function custom_render(bufnr, notif, highlights, config)
    local icon = notif.icon .. " "
    local messages = notif.message

    local title = notif.title[1]
    if utils.isEmpty(title) then
        title = "Global"
    end

    local namespace = notify_base.namespace()

	-- messages
    api.nvim_buf_set_lines(bufnr, 0, #messages - 1, false, messages)
    api.nvim_buf_set_extmark(bufnr, namespace, 0, 0, {
        hl_group = highlights.body,
        end_line = #messages - 1,
        end_col = #messages[#messages],
        priority = 50, -- Allow treesitter to override
    })

    -- title
    api.nvim_buf_set_lines(bufnr, #messages, -1, false, { "" })
    api.nvim_buf_set_extmark(bufnr, namespace, #messages, 0, {
        virt_text = {
            { icon, highlights.icon },
            { title, highlights.title },
        },
        virt_text_pos = "right_align",
        priority = 10,
    })
end

require('notify').setup({
	render = custom_render
})

image
image

NoiceLog

Sun 30 Oct 2022 10:35:59 PM +07
...im/site/pack/packer/start/nui.nvim/lua/nui/text/init.lua:67: end_col value outside range

stack traceback:
	[C]: in function 'pcall'
	...ite/pack/packer/start/noice.nvim/lua/noice/util/call.lua:140: in function <...ite/pack/packer/start/noice.nvim/lua/noice/util/call.lua:139>
	[C]: in function 'nvim_buf_set_extmark'
	...im/site/pack/packer/start/nui.nvim/lua/nui/text/init.lua:67: in function 'highlight'
	...im/site/pack/packer/start/nui.nvim/lua/nui/line/init.lua:55: in function 'highlight'
	...te/pack/packer/start/noice.nvim/lua/noice/text/block.lua:73: in function 'highlight'
	...ite/pack/packer/start/noice.nvim/lua/noice/view/init.lua:232: in function 'render'
	...
	[C]: in function 'xpcall'
	...ite/pack/packer/start/noice.nvim/lua/noice/util/call.lua:145: in function 'try'
	...ite/pack/packer/start/noice.nvim/lua/noice/view/init.lua:123: in function 'display'
	...ack/packer/start/noice.nvim/lua/noice/message/router.lua:115: in function <...ack/packer/start/noice.nvim/lua/noice/message/router.lua:74>
	[C]: in function 'xpcall'
	...ite/pack/packer/start/noice.nvim/lua/noice/util/call.lua:145: in function <...ite/pack/packer/start/noice.nvim/lua/noice/util/call.lua:130>
	[C]: in function 'pcall'
	...ite/pack/packer/start/noice.nvim/lua/noice/util/init.lua:104: in function ''
	vim/_editor.lua: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>
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 a pull request may close this issue.

1 participant