ErrorMatch highlight is broken when using ibl
orenbenkiki opened this issue · 5 comments
Problem
Offset of the hightlight of :match ErrorMsg ...
are wrong when using ibl.
Steps to reproduce
Doing :match ErrorMsg /FOO/
And then showing:
FOO
FOO
FOO
FOO
Gives:
Expected behavior
The ErrorMsg highlight should be exactly on FOO
on each line.
Neovim version (nvim -v)
NVIM v0.10.0 Build type: Release LuaJIT 2.1.1716656478
It seems :match
is only one example; other forms of highlight are affected (matching parenthesis, etc.)
I cannot reproduce this, everything works fine for me. But even if I could, a rendering issue like this is very likely a bug in Neovim core.
Can you use the minimal reproduction template please?
Put this into min-init.lua
:
local lazypath = "/tmp/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system { "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup ({
{
"lukas-reineke/indent-blankline.nvim",
config = function()
require("ibl").setup {
indent = { char = "ܲ" },
scope = { enabled = false }
}
end,
},
}, { root = "/tmp/lazy" })
Do nvim --clean -u min-init.lua min-init.lua
Type /nvim
(search for nvim
).
My result (MacOS, BTW, if that matters):
I suspect the issue is my use of a weird Unicode character ܲ
https://unicodeplus.com/U+0732
It seems this is a combining character which causes neovim to be confused. On the one hand, it shows it perfectly well as the indent marker (taking one space and all), but on the other hand, it is not counted towards the offset when locating highlight colors in the line because it is taken to be combined with another character?
Could this be related to the stringwidth vs. stringdisplaywidth issue? Or is something deeper in the neovim core?
For now I switched to using ⋅
https://www.compart.com/en/unicode/U+02C8
It looks much less nice:
But at least it isn't the over-the-top in-your-face screaming vertical bar:
But it is still way better than the over-the-top-in-your-face screaming-at-you vertical bar.
I really wish I could stick with my gentle original character which was perfect for the job (in my color scheme anyway), but I realize this is an esoteric issue...
"Seek and ye shall find" - Rooting around the Unicode characters I found ⡁
BRAILLE PATTERN DOTS-17 https://symbl.cc/en/2841/ which works perfectly:
I'm closing this as using combining characters for the indentation symbol is rather unreasonable. Thanks for the quick response!
Could this be related to the stringwidth vs. stringdisplaywidth issue? Or is something deeper in the neovim core?
This is definitely a Neovim core issue. You can open an issue there if you want.
There is nothing I can do here to fix this.