Mercurial > vim
comparison src/cmdexpand.c @ 31091:551ce1a137da v9.0.0880
patch 9.0.0880: preprocessor indenting is off
Commit: https://github.com/vim/vim/commit/161b6ac04f257ab17779e9ba6f5b3e3e15d2a0fd
Author: K.Takata <kentkt@csc.jp>
Date: Mon Nov 14 15:31:07 2022 +0000
patch 9.0.0880: preprocessor indenting is off
Problem: Preprocessor indenting is off.
Solution: Adjust preprocessor indentation. (Ken Takata, closes https://github.com/vim/vim/issues/11546)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 14 Nov 2022 16:45:04 +0100 |
parents | 20390549ce2f |
children | 4f709e5f24d2 |
comparison
equal
deleted
inserted
replaced
31090:a681edbc4386 | 31091:551ce1a137da |
---|---|
2754 if (idx == 1) | 2754 if (idx == 1) |
2755 return (char_u *)"xterm"; | 2755 return (char_u *)"xterm"; |
2756 return NULL; | 2756 return NULL; |
2757 } | 2757 } |
2758 | 2758 |
2759 # ifdef FEAT_EVAL | 2759 #ifdef FEAT_EVAL |
2760 /* | 2760 /* |
2761 * Function given to ExpandGeneric() to obtain the possible arguments of the | 2761 * Function given to ExpandGeneric() to obtain the possible arguments of the |
2762 * ":breakadd {expr, file, func, here}" command. | 2762 * ":breakadd {expr, file, func, here}" command. |
2763 * ":breakdel {func, file, here}" command. | 2763 * ":breakdel {func, file, here}" command. |
2764 */ | 2764 */ |
3018 if (xp->xp_context == EXPAND_FILETYPE) | 3018 if (xp->xp_context == EXPAND_FILETYPE) |
3019 { | 3019 { |
3020 char *directories[] = {"syntax", "indent", "ftplugin", NULL}; | 3020 char *directories[] = {"syntax", "indent", "ftplugin", NULL}; |
3021 return ExpandRTDir(pat, 0, numMatches, matches, directories); | 3021 return ExpandRTDir(pat, 0, numMatches, matches, directories); |
3022 } | 3022 } |
3023 # if defined(FEAT_EVAL) | 3023 #if defined(FEAT_EVAL) |
3024 if (xp->xp_context == EXPAND_USER_LIST) | 3024 if (xp->xp_context == EXPAND_USER_LIST) |
3025 return ExpandUserList(xp, matches, numMatches); | 3025 return ExpandUserList(xp, matches, numMatches); |
3026 # endif | 3026 #endif |
3027 if (xp->xp_context == EXPAND_PACKADD) | 3027 if (xp->xp_context == EXPAND_PACKADD) |
3028 return ExpandPackAddDir(pat, numMatches, matches); | 3028 return ExpandPackAddDir(pat, numMatches, matches); |
3029 | 3029 |
3030 // When expanding a function name starting with s:, match the <SNR>nr_ | 3030 // When expanding a function name starting with s:, match the <SNR>nr_ |
3031 // prefix. | 3031 // prefix. |
3055 if (xp->xp_context == EXPAND_SETTINGS | 3055 if (xp->xp_context == EXPAND_SETTINGS |
3056 || xp->xp_context == EXPAND_BOOL_SETTINGS) | 3056 || xp->xp_context == EXPAND_BOOL_SETTINGS) |
3057 ret = ExpandSettings(xp, ®match, pat, numMatches, matches, fuzzy); | 3057 ret = ExpandSettings(xp, ®match, pat, numMatches, matches, fuzzy); |
3058 else if (xp->xp_context == EXPAND_MAPPINGS) | 3058 else if (xp->xp_context == EXPAND_MAPPINGS) |
3059 ret = ExpandMappings(pat, ®match, numMatches, matches); | 3059 ret = ExpandMappings(pat, ®match, numMatches, matches); |
3060 # if defined(FEAT_EVAL) | 3060 #if defined(FEAT_EVAL) |
3061 else if (xp->xp_context == EXPAND_USER_DEFINED) | 3061 else if (xp->xp_context == EXPAND_USER_DEFINED) |
3062 ret = ExpandUserDefined(pat, xp, ®match, matches, numMatches); | 3062 ret = ExpandUserDefined(pat, xp, ®match, matches, numMatches); |
3063 # endif | 3063 #endif |
3064 else | 3064 else |
3065 ret = ExpandOther(pat, xp, ®match, matches, numMatches); | 3065 ret = ExpandOther(pat, xp, ®match, matches, numMatches); |
3066 | 3066 |
3067 if (!fuzzy) | 3067 if (!fuzzy) |
3068 vim_regfree(regmatch.regprog); | 3068 vim_regfree(regmatch.regprog); |
3166 fuzmatch->score = score; | 3166 fuzmatch->score = score; |
3167 } | 3167 } |
3168 else | 3168 else |
3169 ((char_u **)ga.ga_data)[ga.ga_len] = str; | 3169 ((char_u **)ga.ga_data)[ga.ga_len] = str; |
3170 | 3170 |
3171 # ifdef FEAT_MENU | 3171 #ifdef FEAT_MENU |
3172 if (func == get_menu_names) | 3172 if (func == get_menu_names) |
3173 { | 3173 { |
3174 // test for separator added by get_menu_names() | 3174 // test for separator added by get_menu_names() |
3175 str += STRLEN(str) - 1; | 3175 str += STRLEN(str) - 1; |
3176 if (*str == '\001') | 3176 if (*str == '\001') |
3177 *str = '.'; | 3177 *str = '.'; |
3178 } | 3178 } |
3179 # endif | 3179 #endif |
3180 | 3180 |
3181 ++ga.ga_len; | 3181 ++ga.ga_len; |
3182 } | 3182 } |
3183 | 3183 |
3184 if (ga.ga_len == 0) | 3184 if (ga.ga_len == 0) |
3348 // current directory, to find "subdir/cmd". | 3348 // current directory, to find "subdir/cmd". |
3349 ga_init2(&ga, sizeof(char *), 10); | 3349 ga_init2(&ga, sizeof(char *), 10); |
3350 hash_init(&found_ht); | 3350 hash_init(&found_ht); |
3351 for (s = path; ; s = e) | 3351 for (s = path; ; s = e) |
3352 { | 3352 { |
3353 # if defined(MSWIN) | 3353 #if defined(MSWIN) |
3354 e = vim_strchr(s, ';'); | 3354 e = vim_strchr(s, ';'); |
3355 # else | 3355 #else |
3356 e = vim_strchr(s, ':'); | 3356 e = vim_strchr(s, ':'); |
3357 # endif | 3357 #endif |
3358 if (e == NULL) | 3358 if (e == NULL) |
3359 e = s + STRLEN(s); | 3359 e = s + STRLEN(s); |
3360 | 3360 |
3361 if (*s == NUL) | 3361 if (*s == NUL) |
3362 { | 3362 { |
3394 vim_free(path); | 3394 vim_free(path); |
3395 hash_clear(&found_ht); | 3395 hash_clear(&found_ht); |
3396 return OK; | 3396 return OK; |
3397 } | 3397 } |
3398 | 3398 |
3399 # if defined(FEAT_EVAL) | 3399 #if defined(FEAT_EVAL) |
3400 /* | 3400 /* |
3401 * Call "user_expand_func()" to invoke a user defined Vim script function and | 3401 * Call "user_expand_func()" to invoke a user defined Vim script function and |
3402 * return the result (either a string, a List or NULL). | 3402 * return the result (either a string, a List or NULL). |
3403 */ | 3403 */ |
3404 static void * | 3404 static void * |
3578 | 3578 |
3579 *matches = ga.ga_data; | 3579 *matches = ga.ga_data; |
3580 *numMatches = ga.ga_len; | 3580 *numMatches = ga.ga_len; |
3581 return OK; | 3581 return OK; |
3582 } | 3582 } |
3583 # endif | 3583 #endif |
3584 | 3584 |
3585 /* | 3585 /* |
3586 * Expand "file" for all comma-separated directories in "path". | 3586 * Expand "file" for all comma-separated directories in "path". |
3587 * Adds the matches to "ga". Caller must init "ga". | 3587 * Adds the matches to "ga". Caller must init "ga". |
3588 */ | 3588 */ |
3611 { | 3611 { |
3612 // Copy one item of the path to buf[] and concatenate the file name. | 3612 // Copy one item of the path to buf[] and concatenate the file name. |
3613 copy_option_part(&path, buf, MAXPATHL, ","); | 3613 copy_option_part(&path, buf, MAXPATHL, ","); |
3614 if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) | 3614 if (STRLEN(buf) + STRLEN(file) + 2 < MAXPATHL) |
3615 { | 3615 { |
3616 # if defined(MSWIN) | 3616 #if defined(MSWIN) |
3617 // Using the platform's path separator (\) makes vim incorrectly | 3617 // Using the platform's path separator (\) makes vim incorrectly |
3618 // treat it as an escape character, use '/' instead. | 3618 // treat it as an escape character, use '/' instead. |
3619 if (*buf != NUL && !after_pathsep(buf, buf + STRLEN(buf))) | 3619 if (*buf != NUL && !after_pathsep(buf, buf + STRLEN(buf))) |
3620 STRCAT(buf, "/"); | 3620 STRCAT(buf, "/"); |
3621 # else | 3621 #else |
3622 add_pathsep(buf); | 3622 add_pathsep(buf); |
3623 # endif | 3623 #endif |
3624 STRCAT(buf, file); | 3624 STRCAT(buf, file); |
3625 if (ExpandFromContext(&xpc, buf, &p, &num_p, | 3625 if (ExpandFromContext(&xpc, buf, &p, &num_p, |
3626 WILD_SILENT|expand_options) != FAIL && num_p > 0) | 3626 WILD_SILENT|expand_options) != FAIL && num_p > 0) |
3627 { | 3627 { |
3628 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options); | 3628 ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options); |
3826 while (--j > i) | 3826 while (--j > i) |
3827 { | 3827 { |
3828 if (has_mbyte) | 3828 if (has_mbyte) |
3829 j -= (*mb_head_off)(cclp->cmdbuff, cclp->cmdbuff + j); | 3829 j -= (*mb_head_off)(cclp->cmdbuff, cclp->cmdbuff + j); |
3830 if (vim_ispathsep(cclp->cmdbuff[j]) | 3830 if (vim_ispathsep(cclp->cmdbuff[j]) |
3831 # ifdef BACKSLASH_IN_FILENAME | 3831 #ifdef BACKSLASH_IN_FILENAME |
3832 && vim_strchr((char_u *)" *?[{`$%#", | 3832 && vim_strchr((char_u *)" *?[{`$%#", |
3833 cclp->cmdbuff[j + 1]) == NULL | 3833 cclp->cmdbuff[j + 1]) == NULL |
3834 # endif | 3834 #endif |
3835 ) | 3835 ) |
3836 { | 3836 { |
3837 if (found) | 3837 if (found) |
3838 { | 3838 { |
3839 i = j + 1; | 3839 i = j + 1; |