Closed thomaswuhoileong closed 2 months ago
There is also the same problem in H.expr_motion()
which causes the same error when typing g[<Bslash>
etc.
Thanks for the issue!
Yes, I can reproduce. And if \
is a reasonable case, I am not sure supporting <C-xxx>
keys is a good idea if it needs some dark magic to be done. I'll take a look.
The case of \
should now be fixed on latest main
. Also the list of allowed characters for textobject id is now better clarified as "alphanumeric, punctuation, space, or tab", so <C-J>
(which is \n
) and <C-M>
(which is \r
) are now correctly not supported (with message).
Contributing guidelines
Module(s)
mini.ai
Description
Using
\
orCTRL-J
orCTRL-M
as the key for a textobject leads to the error due to invalid lua syntax. The reason is that, in the return statement ofH.expr_textobject()
, whentobj_id
is'\\'
, it is not escaped when substituted in the expression, and whentobj_id
is'\n'
or'\r'
, the linebreak makes the expression incomplete.Neovim version
0.9.5
Steps to reproduce
1) Open nvim 2) Load
mini.ai
(by:lua require 'mini.ai'.setup {}<CR>
) 3) Typeva<Bslash>
orva<C-J>
orva<CR>
Expected behavior
No error due to invalid lua syntax should occur. Either the corresponding textobject is searched for or a message rejecting the usage of such keys is shown.
Actual behavior
The error message
E5107: Error loading lua [string ":lua"]:1: <message>
is shown (where<message>
depends on the key andmini.ai
configuration).