0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 9.1.0748: :keep* commmands are sometimes misidentified as :k

Problem:  The :keep{alt,jumps,marks,patterns} commmands are sometimes
          misidentified as :k.
Solution: Make sure one_letter_cmd() only returns true for :k and not
          other :keep* commands (Doug Kearns).

This currently manifests as missing completion for :keep* commands and
incorrect results from fullcommand().

E.g., fullcommand("keepmarks") returns "k" rather than "keepmarks".

The correct command, however, is executed as command modifiers are
handled specially in do_one_cmd() rather than using find_ex_command().

Fix exists(':k') so that it returns 2 for a full match.

closes: #15742

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Doug Kearns
2024-09-29 17:17:41 +02:00
committed by Christian Brabandt
parent ee20fc8062
commit ea84202372
5 changed files with 59 additions and 3 deletions

View File

@@ -3584,7 +3584,9 @@ skip_option_env_lead(char_u *start)
/*
* Return TRUE and set "*idx" if "p" points to a one letter command.
* If not in Vim9 script:
* - The 'k' command can directly be followed by any character.
* - The 'k' command can directly be followed by any character
* but :keepa[lt] is another command, as are :keepj[umps],
* :kee[pmarks] and :keepp[atterns].
* - The 's' command can be followed directly by 'c', 'g', 'i', 'I' or 'r'
* but :sre[wind] is another command, as are :scr[iptnames],
* :scs[cope], :sim[alt], :sig[ns] and :sil[ent].
@@ -3594,7 +3596,8 @@ one_letter_cmd(char_u *p, cmdidx_T *idx)
{
if (in_vim9script())
return FALSE;
if (*p == 'k')
if (p[0] == 'k'
&& (p[1] != 'e' || (p[1] == 'e' && p[2] != 'e')))
{
*idx = CMD_k;
return TRUE;
@@ -3880,6 +3883,8 @@ find_ex_command(
if (one_letter_cmd(p, &eap->cmdidx))
{
++p;
if (full != NULL)
*full = TRUE;
}
else
{