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>
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index a24b4ef..32cd7c5 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3584,7 +3584,9 @@
/*
* 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 @@
{
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 @@
if (one_letter_cmd(p, &eap->cmdidx))
{
++p;
+ if (full != NULL)
+ *full = TRUE;
}
else
{