Bug: Strange error when scrolling through a line containing substring `['%']`?
nyngwang opened this issue · 4 comments
Moving from upstream issue: nvim-lualine/lualine.nvim#873
Self Checks
- I'm using the latest lualine.
- I didn't find the issue in exsisting issues or prs.
How to reproduce the problem
- You will need to create a lua file, with lua LSP Client sumneko/lua-language-server attached.
- The lua file should contain a lua table like this:
window = { mappings = { -- root behaviour. ['-'] = 'navigate_up', ['<C-]>'] = 'set_root', -- tree itself. ['R'] = 'refresh', -- open files. ['<2-LeftMouse>'] = 'shift_M_open', ['<cr>'] = 'shift_M_open', ['w'] = 'picker_open', ['o'] = 'macOS_open', ['%'] = 'open_vsplit', -- THIS LINE TO BE SPECIFIC } }
- Move your cursor upward until it is located at the line containing the substring
['%']
.
Expected behaviour
Do nothing.
Actual behaviour
An error occurred:
Error executing vim.schedule lua callback: ...acker/start/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: E539: Illegal character <'>
stack traceback:
[C]: in function 'nvim_win_set_option'
...acker/start/lualine.nvim/lua/lualine/utils/nvim_opts.lua:77: in function 'setter_fn'
...acker/start/lualine.nvim/lua/lualine/utils/nvim_opts.lua:50: in function 'set_opt'
...acker/start/lualine.nvim/lua/lualine/utils/nvim_opts.lua:74: in function 'set'
...nvim/site/pack/packer/start/lualine.nvim/lua/lualine.lua:422: in function 'refresh'
...nvim/site/pack/packer/start/lualine.nvim/lua/lualine.lua:343: in function <...nvim/site/pack/packer/start/lualine.nvim/lua/lualine.lua:342>
Press ENTER or type command to continue
Minimal config to reproduce the issue
use {
'nvim-lualine/lualine.nvim',
requires = {
'kyazdani42/nvim-web-devicons',
{
'SmiteshP/nvim-navic',
requires = 'neovim/nvim-lspconfig',
config = function () require('nvim-navic').setup{ separator = ' ' } end
}
},
config = function ()
local navic = require('nvim-navic')
require('lualine').setup {
options = {
theme = 'palenight', -- Purple
},
sections = {
lualine_c = { 'filename', { navic.get_location, cond = navic.is_available } },
lualine_x = { 'encoding', 'filetype' },
}
}
end
}
Aditional information
Reasoning: I guess the char %
might have a special meaning to the next char that follow, thus causing the error. E.g. it escapes the single quote '
.
update: This guess got confirmed by the author of lualine.nvim, see here.
and if you look closely, you will also find that the left-curly-braces, i.e. {
s, showing in the image is bolded: (ignoring the cat which is from another desktop program.)
@SmiteshP Hi, sorry for tagging you on a closed issue first. But it seems that the problem of bolded left-curly-brace still exists(definitely not a big deal, but I assumed that: I care, you care, we better.):
(sorry for making the two arrows exaggeratedly bolded. I did this because I think it would be more easily seen by any readers. might be offensive for some people so I put a note here.)
And most importantly, thanks for developing this good plugin!
Looking at the photo, that icon looks to be unicode U+F668 (which is default setting of navic).
I don't think any special characters like '%' or curly braces would affect to make half of a unicode character to be bold. Could be an issue with the font or the terminal emulator maybe.
Try pasting U+F668 in the neovim buffer as well and see if it looks similar.
Please paste the output of
get_location
andget_data
over here.
@SmiteshP This is the result of calling get_location()
. (I never use get_data
)
21:30:39 msg_show return use config vim.api.nvim_create_autocmd callback if vim.wo.winbar
21:30:40 msg_show return use config vim.api.nvim_create_autocmd callback
21:30:40 msg_show return use config vim.api.nvim_create_autocmd callback if vim.wo.winbar
UPDATE:
Try pasting U+F668 in the neovim buffer as well and see if it looks similar.
Exactly :) You have sharp eyes. OK, now I believe this is not related to nvim-navic
for sure, sorry for my false alert. I will try a different font or maybe just ignore it.