diff options
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 77 |
1 files changed, 14 insertions, 63 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 6474225b26..c15d85967d 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -15,6 +15,7 @@ #include "nvim/api/private/helpers.h" #include "nvim/api/vim.h" #include "nvim/arabic.h" +#include "nvim/arglist.h" #include "nvim/ascii.h" #include "nvim/assert.h" #include "nvim/buffer.h" @@ -23,6 +24,7 @@ #include "nvim/cursor.h" #include "nvim/cursor_shape.h" #include "nvim/digraph.h" +#include "nvim/drawscreen.h" #include "nvim/edit.h" #include "nvim/eval.h" #include "nvim/eval/funcs.h" @@ -38,6 +40,8 @@ #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/globals.h" +#include "nvim/grid.h" +#include "nvim/help.h" #include "nvim/highlight.h" #include "nvim/highlight_defs.h" #include "nvim/highlight_group.h" @@ -64,10 +68,9 @@ #include "nvim/os/time.h" #include "nvim/os_unix.h" #include "nvim/path.h" -#include "nvim/popupmnu.h" +#include "nvim/popupmenu.h" #include "nvim/profile.h" #include "nvim/regexp.h" -#include "nvim/screen.h" #include "nvim/search.h" #include "nvim/sign.h" #include "nvim/state.h" @@ -2181,14 +2184,14 @@ static int command_line_handle_key(CommandLineState *s) if (i > 0) { ccline.cmdbuff[len] = '\\'; } - ++len; + len++; } if (i > 0) { ccline.cmdbuff[len] = p[j]; } } - ++len; + len++; } if (i == 0) { @@ -3688,7 +3691,7 @@ void put_on_cmdline(char_u *str, int len, int redraw) msg_col -= i; if (msg_col < 0) { msg_col += Columns; - --msg_row; + msg_row--; } } } @@ -4234,9 +4237,9 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode if (findex == -1) { findex = xp->xp_numfiles; } - --findex; + findex--; } else { // mode == WILD_NEXT - ++findex; + findex++; } /* @@ -4976,7 +4979,7 @@ char_u *addstar(char_u *fname, size_t len, int context) && vim_strchr((char *)retval, '`') == NULL) { retval[len++] = '*'; } else if (len > 0 && retval[len - 1] == '$') { - --len; + len--; } retval[len] = NUL; } @@ -5124,58 +5127,6 @@ int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, char *** 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); /// Do the expansion based on xp->xp_context and "pat". @@ -5385,8 +5336,8 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***f { EXPAND_SYNTAX, get_syntax_name, true, true }, { EXPAND_SYNTIME, get_syntime_arg, true, true }, { EXPAND_HIGHLIGHT, (ExpandFunc)get_highlight_name, true, true }, - { EXPAND_EVENTS, expand_get_event_name, true, true }, - { EXPAND_AUGROUP, expand_get_augroup_name, true, true }, + { EXPAND_EVENTS, expand_get_event_name, true, false }, + { EXPAND_AUGROUP, expand_get_augroup_name, true, false }, { EXPAND_CSCOPE, get_cscope_name, true, true }, { EXPAND_SIGN, get_sign_name, true, true }, { EXPAND_PROFILE, get_profile_name, true, true }, @@ -5617,7 +5568,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char ***file, int fl } } if (*e != NUL) { - ++e; + e++; } } *file = ga.ga_data; |