comparison src/option.c @ 31819:aec031683d61 v9.0.1242

patch 9.0.1242: code for :runtime completion is not consistent Commit: https://github.com/vim/vim/commit/b0d45ec67f4976318f199a7929ad3bcf93686fd0 Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Jan 25 15:04:22 2023 +0000 patch 9.0.1242: code for :runtime completion is not consistent Problem: Code for :runtime completion is not consistent. Solution: Make code for cmdline expansion more consistent. (closes https://github.com/vim/vim/issues/11875)
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Jan 2023 16:15:06 +0100
parents 9f1504e36ae9
children b741e5243e58
comparison
equal deleted inserted replaced
31818:9a2b2949d045 31819:aec031683d61
6711 6711
6712 return OK; 6712 return OK;
6713 } 6713 }
6714 6714
6715 int 6715 int
6716 ExpandOldSetting(int *num_file, char_u ***file) 6716 ExpandOldSetting(int *numMatches, char_u ***matches)
6717 { 6717 {
6718 char_u *var = NULL; // init for GCC 6718 char_u *var = NULL; // init for GCC
6719 char_u *buf; 6719 char_u *buf;
6720 6720
6721 *num_file = 0; 6721 *numMatches = 0;
6722 *file = ALLOC_ONE(char_u *); 6722 *matches = ALLOC_ONE(char_u *);
6723 if (*file == NULL) 6723 if (*matches == NULL)
6724 return FAIL; 6724 return FAIL;
6725 6725
6726 /* 6726 /*
6727 * For a terminal key code expand_option_idx is < 0. 6727 * For a terminal key code expand_option_idx is < 0.
6728 */ 6728 */
6746 // what happens in do_set(). 6746 // what happens in do_set().
6747 buf = vim_strsave_escaped(var, escape_chars); 6747 buf = vim_strsave_escaped(var, escape_chars);
6748 6748
6749 if (buf == NULL) 6749 if (buf == NULL)
6750 { 6750 {
6751 VIM_CLEAR(*file); 6751 VIM_CLEAR(*matches);
6752 return FAIL; 6752 return FAIL;
6753 } 6753 }
6754 6754
6755 #ifdef BACKSLASH_IN_FILENAME 6755 #ifdef BACKSLASH_IN_FILENAME
6756 // For MS-Windows et al. we don't double backslashes at the start and 6756 // For MS-Windows et al. we don't double backslashes at the start and
6762 && vim_isfilec(var[2]) 6762 && vim_isfilec(var[2])
6763 && (var[2] != '\\' || (var == buf && var[4] != '\\'))) 6763 && (var[2] != '\\' || (var == buf && var[4] != '\\')))
6764 STRMOVE(var, var + 1); 6764 STRMOVE(var, var + 1);
6765 #endif 6765 #endif
6766 6766
6767 *file[0] = buf; 6767 *matches[0] = buf;
6768 *num_file = 1; 6768 *numMatches = 1;
6769 return OK; 6769 return OK;
6770 } 6770 }
6771 6771
6772 /* 6772 /*
6773 * Get the value for the numeric or string option *opp in a nice format into 6773 * Get the value for the numeric or string option *opp in a nice format into