Cursor position is off when status column updates in insert mode
33KK opened this issue · comments
lua_ls
removes all the diagnostics after some edit was done, which causes the statuscolumn to shrink. The cursor stays in the old position when this happens.
Configuration
{
"luukvbaal/statuscol.nvim",
opts = function()
local builtin = require("statuscol.builtin")
return {
relculright = true,
segments = {
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
{
sign = {
name = { "Diagnostic" },
maxwidth = 1,
auto = true,
},
click = "v:lua.ScSa",
},
{ text = { builtin.lnumfunc }, click = "v:lua.ScLa" },
{
sign = {
name = { ".*" },
maxwidth = 2,
colwidth = 1,
auto = true,
wrap = true,
},
click = "v:lua.ScSa",
},
{ text = { " " } },
},
}
end,
config = function(_, opts)
require("statuscol").setup(opts)
end,
}
Version
NVIM v0.10.0-dev-798+g72e619ca92
This plugin does not affect the cursor position in the situation you describe.
If you're sure that that is what is happening (and shouldn't) you should open an issue over on the neovim issue tracker including reproducable steps. Does the problem also happen with the default "statuscolumn", the stock sign column would grow/shrink as well here.
I'm not sure why this happens only with the plugin enabled. signcolumn=auto
works perfectly fine. I guess it's related to redraw timing or something like that. I'll open the issue in neovim repo.
Is it the actual cursor position that is affected? I.e. does 'ruler'
reflect the issue.
Or is it just that the cursor is drawn incorrectly?
I see, that is an issue that should be fixed in neovim then. Best open an issue, not sure when I'll have time to look into it.
Okay, will open an issue, thanks for your help.
It's a bit weird, it seems to only happen if I set vim.opt.number = true BEFORE calling statuscol.setup
EDIT: nvm, seems to happen either way, not sure what happened that time
for name, url in pairs({
"https://github.com/neovim/nvim-lspconfig",
"https://github.com/luukvbaal/statuscol.nvim",
}) do
local install_path = vim.fn.fnamemodify("nvim_issue/" .. name, ":p")
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
end
vim.opt.runtimepath:append(install_path)
end
vim.cmd.colorscheme("habamax")
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({})
local builtin = require("statuscol.builtin")
------------------------------
vim.opt.number = true
require("statuscol").setup({
relculright = true,
segments = {
{ text = { builtin.foldfunc }, click = "v:lua.ScFa" },
{
sign = {
name = { "Diagnostic" },
maxwidth = 1,
auto = true,
},
click = "v:lua.ScSa",
},
{ text = { builtin.lnumfunc }, click = "v:lua.ScLa" },
{
sign = {
name = { ".*" },
maxwidth = 2,
colwidth = 1,
auto = true,
wrap = true,
},
click = "v:lua.ScSa",
},
{ text = { " " } },
},
})
Yeah redraws in neovim can be quite unpredictable. Especially so when signs are involved in my experience.
Minimal config looking good👍🏻