mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
ex_cmds: const variables in find_help_tags()
keep_lang (param) is bool.
This commit is contained in:
parent
9d7dc49db1
commit
d29b71a1de
@ -4675,15 +4675,13 @@ static int help_compare(const void *s1, const void *s2)
|
|||||||
return strcmp(p1, p2);
|
return strcmp(p1, p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Find all help tags matching "arg", sort them and return in matches[], with
|
||||||
* Find all help tags matching "arg", sort them and return in matches[], with
|
// the number of matches in num_matches.
|
||||||
* the number of matches in num_matches.
|
// The matches will be sorted with a "best" match algorithm.
|
||||||
* The matches will be sorted with a "best" match algorithm.
|
// When "keep_lang" is true try keeping the language of the current buffer.
|
||||||
* When "keep_lang" is TRUE try keeping the language of the current buffer.
|
int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches,
|
||||||
*/
|
bool keep_lang)
|
||||||
int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_lang)
|
|
||||||
{
|
{
|
||||||
char_u *s, *d;
|
|
||||||
int i;
|
int i;
|
||||||
static char *(mtable[]) = {"*", "g*", "[*", "]*",
|
static char *(mtable[]) = {"*", "g*", "[*", "]*",
|
||||||
"/*", "/\\*", "\"*", "**",
|
"/*", "/\\*", "\"*", "**",
|
||||||
@ -4709,9 +4707,7 @@ int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_la
|
|||||||
"s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
|
"s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
|
||||||
static char *(expr_table[]) = {"!=?", "!~?", "<=?", "<?", "==?", "=~?",
|
static char *(expr_table[]) = {"!=?", "!~?", "<=?", "<?", "==?", "=~?",
|
||||||
">=?", ">?", "is?", "isnot?"};
|
">=?", ">?", "is?", "isnot?"};
|
||||||
int flags;
|
char_u *d = IObuff; // assume IObuff is long enough!
|
||||||
|
|
||||||
d = IObuff; /* assume IObuff is long enough! */
|
|
||||||
|
|
||||||
if (STRNICMP(arg, "expr-", 5) == 0) {
|
if (STRNICMP(arg, "expr-", 5) == 0) {
|
||||||
// When the string starting with "expr-" and containing '?' and matches
|
// When the string starting with "expr-" and containing '?' and matches
|
||||||
@ -4764,7 +4760,7 @@ int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_la
|
|||||||
if (*arg == '(' && arg[1] == '\'') {
|
if (*arg == '(' && arg[1] == '\'') {
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
for (s = arg; *s; s++) {
|
for (const char_u *s = arg; *s; s++) {
|
||||||
// Replace "|" with "bar" and '"' with "quote" to match the name of
|
// Replace "|" with "bar" and '"' with "quote" to match the name of
|
||||||
// the tags for these commands.
|
// the tags for these commands.
|
||||||
// Replace "*" with ".*" and "?" with "." to match command line
|
// Replace "*" with ".*" and "?" with "." to match command line
|
||||||
@ -4873,7 +4869,7 @@ int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_la
|
|||||||
|
|
||||||
*matches = (char_u **)"";
|
*matches = (char_u **)"";
|
||||||
*num_matches = 0;
|
*num_matches = 0;
|
||||||
flags = TAG_HELP | TAG_REGEXP | TAG_NAMES | TAG_VERBOSE;
|
int flags = TAG_HELP | TAG_REGEXP | TAG_NAMES | TAG_VERBOSE;
|
||||||
if (keep_lang)
|
if (keep_lang)
|
||||||
flags |= TAG_KEEP_LANG;
|
flags |= TAG_KEEP_LANG;
|
||||||
if (find_tags(IObuff, num_matches, matches, flags, (int)MAXCOL, NULL) == OK
|
if (find_tags(IObuff, num_matches, matches, flags, (int)MAXCOL, NULL) == OK
|
||||||
|
@ -4677,7 +4677,7 @@ ExpandFromContext (
|
|||||||
/* With an empty argument we would get all the help tags, which is
|
/* With an empty argument we would get all the help tags, which is
|
||||||
* very slow. Get matches for "help" instead. */
|
* very slow. Get matches for "help" instead. */
|
||||||
if (find_help_tags(*pat == NUL ? (char_u *)"help" : pat,
|
if (find_help_tags(*pat == NUL ? (char_u *)"help" : pat,
|
||||||
num_file, file, FALSE) == OK) {
|
num_file, file, false) == OK) {
|
||||||
cleanup_help_tags(*num_file, *file);
|
cleanup_help_tags(*num_file, *file);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user