1
0
forked from aniani/vim

patch 8.1.1251: no test for completion of mapping keys

Problem:    No test for completion of mapping keys.
Solution:   Add a test.  Also clean up the code.
This commit is contained in:
Bram Moolenaar
2019-05-03 15:13:57 +02:00
parent d788543ac6
commit 2cb9f02532
5 changed files with 50 additions and 14 deletions

View File

@@ -6629,22 +6629,20 @@ check_for_codes_from_term(void)
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
/*
* Translate an internal mapping/abbreviation representation into the
* corresponding external one recognized by :map/:abbrev commands;
* respects the current B/k/< settings of 'cpoption'.
* corresponding external one recognized by :map/:abbrev commands.
* Respects the current B/k/< settings of 'cpoption'.
*
* This function is called when expanding mappings/abbreviations on the
* command-line, and for building the "Ambiguous mapping..." error message.
* command-line.
*
* It uses a growarray to build the translation string since the
* latter can be wider than the original description. The caller has to
* free the string afterwards.
* It uses a growarray to build the translation string since the latter can be
* wider than the original description. The caller has to free the string
* afterwards.
*
* Returns NULL when there is a problem.
*/
char_u *
translate_mapping(
char_u *str,
int expmap) /* TRUE when expanding mappings on command-line */
translate_mapping(char_u *str)
{
garray_T ga;
int c;
@@ -6691,7 +6689,7 @@ translate_mapping(
}
if (c == K_SPECIAL && str[1] != NUL && str[2] != NUL)
{
if (expmap && cpo_special)
if (cpo_special)
{
ga_clear(&ga);
return NULL;
@@ -6703,7 +6701,7 @@ translate_mapping(
}
if (IS_SPECIAL(c) || modifiers) /* special key */
{
if (expmap && cpo_special)
if (cpo_special)
{
ga_clear(&ga);
return NULL;