mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 15:58:17 +00:00
vim-patch:8.2.1262: src/ex_cmds.c file is too big (#19811)
Problem: src/ex_cmds.c file is too big.
Solution: Move help related code to src/help.c. (Yegappan Lakshmanan,
closes vim/vim#6506)
f868ba8903
This commit is contained in:
@@ -52,6 +52,7 @@
|
|||||||
#include "nvim/garray.h"
|
#include "nvim/garray.h"
|
||||||
#include "nvim/getchar.h"
|
#include "nvim/getchar.h"
|
||||||
#include "nvim/hashtab.h"
|
#include "nvim/hashtab.h"
|
||||||
|
#include "nvim/help.h"
|
||||||
#include "nvim/highlight_group.h"
|
#include "nvim/highlight_group.h"
|
||||||
#include "nvim/indent.h"
|
#include "nvim/indent.h"
|
||||||
#include "nvim/indent_c.h"
|
#include "nvim/indent_c.h"
|
||||||
|
1119
src/nvim/ex_cmds.c
1119
src/nvim/ex_cmds.c
File diff suppressed because it is too large
Load Diff
@@ -20,9 +20,9 @@
|
|||||||
#define ECMD_NOWINENTER 0x40 // do not trigger BufWinEnter
|
#define ECMD_NOWINENTER 0x40 // do not trigger BufWinEnter
|
||||||
|
|
||||||
// for lnum argument in do_ecmd()
|
// for lnum argument in do_ecmd()
|
||||||
#define ECMD_LASTL (linenr_T)0 // use last position in loaded file
|
#define ECMD_LASTL (linenr_T)0 // use last position in loaded file
|
||||||
#define ECMD_LAST ((linenr_T) - 1) // use last position in all files
|
#define ECMD_LAST ((linenr_T)(-1)) // use last position in all files
|
||||||
#define ECMD_ONE (linenr_T)1 // use first line
|
#define ECMD_ONE (linenr_T)1 // use first line
|
||||||
|
|
||||||
/// Previous :substitute replacement string definition
|
/// Previous :substitute replacement string definition
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "nvim/getchar.h"
|
#include "nvim/getchar.h"
|
||||||
#include "nvim/globals.h"
|
#include "nvim/globals.h"
|
||||||
#include "nvim/hardcopy.h"
|
#include "nvim/hardcopy.h"
|
||||||
|
#include "nvim/help.h"
|
||||||
#include "nvim/highlight_group.h"
|
#include "nvim/highlight_group.h"
|
||||||
#include "nvim/if_cscope.h"
|
#include "nvim/if_cscope.h"
|
||||||
#include "nvim/input.h"
|
#include "nvim/input.h"
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include "nvim/garray.h"
|
#include "nvim/garray.h"
|
||||||
#include "nvim/getchar.h"
|
#include "nvim/getchar.h"
|
||||||
#include "nvim/globals.h"
|
#include "nvim/globals.h"
|
||||||
|
#include "nvim/help.h"
|
||||||
#include "nvim/highlight.h"
|
#include "nvim/highlight.h"
|
||||||
#include "nvim/highlight_defs.h"
|
#include "nvim/highlight_defs.h"
|
||||||
#include "nvim/highlight_group.h"
|
#include "nvim/highlight_group.h"
|
||||||
@@ -5025,58 +5026,6 @@ int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, char ***
|
|||||||
return EXPAND_OK;
|
return EXPAND_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup matches for help tags:
|
|
||||||
// Remove "@ab" if the top of 'helplang' is "ab" and the language of the first
|
|
||||||
// tag matches it. Otherwise remove "@en" if "en" is the only language.
|
|
||||||
static void cleanup_help_tags(int num_file, char **file)
|
|
||||||
{
|
|
||||||
char_u buf[4];
|
|
||||||
char_u *p = buf;
|
|
||||||
|
|
||||||
if (p_hlg[0] != NUL && (p_hlg[0] != 'e' || p_hlg[1] != 'n')) {
|
|
||||||
*p++ = '@';
|
|
||||||
*p++ = p_hlg[0];
|
|
||||||
*p++ = p_hlg[1];
|
|
||||||
}
|
|
||||||
*p = NUL;
|
|
||||||
|
|
||||||
for (int i = 0; i < num_file; i++) {
|
|
||||||
int len = (int)STRLEN(file[i]) - 3;
|
|
||||||
if (len <= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (STRCMP(file[i] + len, "@en") == 0) {
|
|
||||||
// Sorting on priority means the same item in another language may
|
|
||||||
// be anywhere. Search all items for a match up to the "@en".
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < num_file; j++) {
|
|
||||||
if (j != i
|
|
||||||
&& (int)STRLEN(file[j]) == len + 3
|
|
||||||
&& STRNCMP(file[i], file[j], len + 1) == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (j == num_file) {
|
|
||||||
// item only exists with @en, remove it
|
|
||||||
file[i][len] = NUL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*buf != NUL) {
|
|
||||||
for (int i = 0; i < num_file; i++) {
|
|
||||||
int len = (int)STRLEN(file[i]) - 3;
|
|
||||||
if (len <= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (STRCMP(file[i] + len, buf) == 0) {
|
|
||||||
// remove the default language
|
|
||||||
file[i][len] = NUL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef char *(*ExpandFunc)(expand_T *, int);
|
typedef char *(*ExpandFunc)(expand_T *, int);
|
||||||
|
|
||||||
/// Do the expansion based on xp->xp_context and "pat".
|
/// Do the expansion based on xp->xp_context and "pat".
|
||||||
|
1178
src/nvim/help.c
Normal file
1178
src/nvim/help.c
Normal file
File diff suppressed because it is too large
Load Diff
11
src/nvim/help.h
Normal file
11
src/nvim/help.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef NVIM_HELP_H
|
||||||
|
#define NVIM_HELP_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "nvim/ex_cmds_defs.h"
|
||||||
|
|
||||||
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
|
# include "help.h.generated.h"
|
||||||
|
#endif
|
||||||
|
#endif // NVIM_HELP_H
|
@@ -35,6 +35,7 @@
|
|||||||
#include "nvim/getchar.h"
|
#include "nvim/getchar.h"
|
||||||
#include "nvim/globals.h"
|
#include "nvim/globals.h"
|
||||||
#include "nvim/grid_defs.h"
|
#include "nvim/grid_defs.h"
|
||||||
|
#include "nvim/help.h"
|
||||||
#include "nvim/indent.h"
|
#include "nvim/indent.h"
|
||||||
#include "nvim/keycodes.h"
|
#include "nvim/keycodes.h"
|
||||||
#include "nvim/log.h"
|
#include "nvim/log.h"
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include "nvim/ex_getln.h"
|
#include "nvim/ex_getln.h"
|
||||||
#include "nvim/fileio.h"
|
#include "nvim/fileio.h"
|
||||||
#include "nvim/fold.h"
|
#include "nvim/fold.h"
|
||||||
|
#include "nvim/help.h"
|
||||||
#include "nvim/highlight_group.h"
|
#include "nvim/highlight_group.h"
|
||||||
#include "nvim/mark.h"
|
#include "nvim/mark.h"
|
||||||
#include "nvim/mbyte.h"
|
#include "nvim/mbyte.h"
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include "nvim/fileio.h"
|
#include "nvim/fileio.h"
|
||||||
#include "nvim/fold.h"
|
#include "nvim/fold.h"
|
||||||
#include "nvim/garray.h"
|
#include "nvim/garray.h"
|
||||||
|
#include "nvim/help.h"
|
||||||
#include "nvim/if_cscope.h"
|
#include "nvim/if_cscope.h"
|
||||||
#include "nvim/input.h"
|
#include "nvim/input.h"
|
||||||
#include "nvim/insexpand.h"
|
#include "nvim/insexpand.h"
|
||||||
|
Reference in New Issue
Block a user