mirror of
https://github.com/neovim/neovim.git
synced 2026-05-26 23:08:36 +00:00
fix(help): fix CTRL character issue for :help {subject} #39537
Problem: The argument to `:help` is normalized to fit the general tag format. I.e. i^U-default, iCTRL-U-default and i_CTRL_U-default should all point to the i_CTRL_U-default tag. Our normalization adds an underscore around the CTRL keycode, e.g. iCTRL-GCTRL-J becomes i_CTRL-G_CTRL-J. That's not necessary if the following part starts with a dash, like the case of iCTRL-U-default. Solution: Do not insert an underscore if the following character is a dash/minus (-).
This commit is contained in:
committed by
GitHub
parent
858cd3d106
commit
84ae70c172
@@ -108,7 +108,7 @@ function M.escape_subject(word)
|
||||
-- E.g. 'iCTRL-GCTRL-J' --> 'i_CTRL-G_CTRL-J'
|
||||
-- Only exception: 'CTRL-{character}'
|
||||
word = word:gsub('([^_])CTRL%-', '%1_CTRL-')
|
||||
word = word:gsub('(CTRL%-[^{])([^_\\])', '%1_%2')
|
||||
word = word:gsub('(CTRL%-[^{])([^-_\\])', '%1_%2')
|
||||
|
||||
-- Skip function arguments
|
||||
-- E.g. 'abs({expr})' --> 'abs'
|
||||
|
||||
@@ -130,6 +130,7 @@ describe(':help', function()
|
||||
check_tag('help <>', '*<>*')
|
||||
check_tag([[help i^x^y]], '*i_CTRL-X_CTRL-Y*')
|
||||
check_tag([[help CTRL-\_CTRL-N]], [[*CTRL-\_CTRL-N*]])
|
||||
check_tag([[help i_CTRL-U-default]], [[*i_CTRL-U-default*]])
|
||||
|
||||
check_tag([[exe "help i\<C-\>\<C-G>"]], [[*i_CTRL-\_CTRL-G*]])
|
||||
check_tag([[exe "help \<C-V>"]], '*CTRL-V*')
|
||||
|
||||
Reference in New Issue
Block a user