Merge pull request #19415 from zeertzjq/vim-8.1.1076

vim-patch:8.1.{1076,1849}: file for Insert mode is much too big
This commit is contained in:
zeertzjq 2022-07-20 06:33:55 +08:00 committed by GitHub
commit 1ef84547a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 3968 additions and 3840 deletions

View File

@ -37,6 +37,7 @@
#include "nvim/highlight.h"
#include "nvim/highlight_defs.h"
#include "nvim/highlight_group.h"
#include "nvim/insexpand.h"
#include "nvim/lua/executor.h"
#include "nvim/mapping.h"
#include "nvim/mark.h"

View File

@ -18,6 +18,7 @@
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/getchar.h"
#include "nvim/insexpand.h"
#include "nvim/lua/executor.h"
#include "nvim/map.h"
#include "nvim/option.h"

View File

@ -17,6 +17,7 @@
#include "nvim/fold.h"
#include "nvim/indent.h"
#include "nvim/indent_c.h"
#include "nvim/insexpand.h"
#include "nvim/mark.h"
#include "nvim/memline.h"
#include "nvim/move.h"

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,9 @@
#ifndef NVIM_EDIT_H
#define NVIM_EDIT_H
#include "nvim/autocmd.h"
#include "nvim/vim.h"
/*
* Array indexes used for cptext argument of ins_compl_add().
*/
#define CPT_ABBR 0 // "abbr"
#define CPT_MENU 1 // "menu"
#define CPT_KIND 2 // "kind"
#define CPT_INFO 3 // "info"
#define CPT_COUNT 4 // Number of entries
// values for cp_flags
typedef enum {
CP_ORIGINAL_TEXT = 1, // the original text when the expansion begun
CP_FREE_FNAME = 2, // cp_fname is allocated
CP_CONT_S_IPOS = 4, // use CONT_S_IPOS for compl_cont_status
CP_EQUAL = 8, // ins_compl_equal() always returns true
CP_ICASE = 16, // ins_compl_equal ignores case
CP_FAST = 32, // use fast_breakcheck instead of os_breakcheck
} cp_flags_T;
typedef int (*IndentGetter)(void);
// Values for in_cinkeys()

View File

@ -36,6 +36,7 @@
#include "nvim/indent.h"
#include "nvim/indent_c.h"
#include "nvim/input.h"
#include "nvim/insexpand.h"
#include "nvim/lua/executor.h"
#include "nvim/macros.h"
#include "nvim/mapping.h"
@ -1054,64 +1055,6 @@ static void f_col(typval_T *argvars, typval_T *rettv, FunPtr fptr)
get_col(argvars, rettv, false);
}
/// "complete()" function
static void f_complete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if ((State & MODE_INSERT) == 0) {
emsg(_("E785: complete() can only be used in Insert mode"));
return;
}
// Check for undo allowed here, because if something was already inserted
// the line was already saved for undo and this check isn't done.
if (!undo_allowed(curbuf)) {
return;
}
if (argvars[1].v_type != VAR_LIST) {
emsg(_(e_invarg));
} else {
const colnr_T startcol = tv_get_number_chk(&argvars[0], NULL);
if (startcol > 0) {
set_completion(startcol - 1, argvars[1].vval.v_list);
}
}
}
/// "complete_add()" function
static void f_complete_add(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0, false);
}
/// "complete_check()" function
static void f_complete_check(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
int saved = RedrawingDisabled;
RedrawingDisabled = 0;
ins_compl_check_keys(0, true);
rettv->vval.v_number = compl_interrupted;
RedrawingDisabled = saved;
}
/// "complete_info()" function
static void f_complete_info(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
tv_dict_alloc_ret(rettv);
list_T *what_list = NULL;
if (argvars[0].v_type != VAR_UNKNOWN) {
if (argvars[0].v_type != VAR_LIST) {
emsg(_(e_listreq));
return;
}
what_list = argvars[0].vval.v_list;
}
get_complete_info(what_list, rettv->vval.v_dict);
}
/// "confirm(message, buttons[, default [, type]])" function
static void f_confirm(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{

View File

@ -16,6 +16,7 @@
#include "nvim/fileio.h"
#include "nvim/getchar.h"
#include "nvim/globals.h"
#include "nvim/insexpand.h"
#include "nvim/lua/executor.h"
#include "nvim/os/input.h"
#include "nvim/regexp.h"

View File

@ -21,6 +21,7 @@
#include "nvim/garray.h"
#include "nvim/getchar.h"
#include "nvim/input.h"
#include "nvim/insexpand.h"
#include "nvim/keycodes.h"
#include "nvim/lua/executor.h"
#include "nvim/main.h"

View File

@ -163,10 +163,6 @@ EXTERN colnr_T dollar_vcol INIT(= -1);
// by the match.)
EXTERN int compl_length INIT(= 0);
// Set when character typed while looking for matches and it means we should
// stop looking for matches.
EXTERN int compl_interrupted INIT(= false);
// Set when doing something for completion that may call edit() recursively,
// which is not allowed. Also used to disable folding during completion
EXTERN bool compl_busy INIT(= false);

3886
src/nvim/insexpand.c Normal file

File diff suppressed because it is too large Load Diff

18
src/nvim/insexpand.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef NVIM_INSEXPAND_H
#define NVIM_INSEXPAND_H
#include "nvim/eval/funcs.h"
#include "nvim/vim.h"
/// state for pum_ext_select_item.
EXTERN struct {
bool active;
int item;
bool insert;
bool finish;
} pum_want;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "insexpand.h.generated.h"
#endif
#endif // NVIM_INSEXPAND_H

View File

@ -28,6 +28,7 @@
#include "nvim/highlight_group.h"
#include "nvim/iconv.h"
#include "nvim/if_cscope.h"
#include "nvim/insexpand.h"
#include "nvim/lua/executor.h"
#include "nvim/main.h"
#include "nvim/mapping.h"

View File

@ -14,6 +14,7 @@
#include "nvim/eval.h"
#include "nvim/highlight.h"
#include "nvim/highlight_group.h"
#include "nvim/insexpand.h"
#include "nvim/lua/executor.h"
#include "nvim/mapping.h"
#include "nvim/memfile.h"
@ -710,6 +711,7 @@ void free_all_mem(void)
free_search_patterns();
free_old_sub();
free_last_insert();
free_insexpand_stuff();
free_prev_shellcmd();
free_regexp_stuff();
free_tag_stuff();

View File

@ -49,6 +49,7 @@
#include "nvim/highlight.h"
#include "nvim/highlight_group.h"
#include "nvim/indent_c.h"
#include "nvim/insexpand.h"
#include "nvim/keycodes.h"
#include "nvim/macros.h"
#include "nvim/mapping.h"

View File

@ -16,6 +16,7 @@
#include "nvim/edit.h"
#include "nvim/eval/typval.h"
#include "nvim/ex_cmds.h"
#include "nvim/insexpand.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/menu.h"

View File

@ -92,6 +92,7 @@
#include "nvim/highlight.h"
#include "nvim/highlight_group.h"
#include "nvim/indent.h"
#include "nvim/insexpand.h"
#include "nvim/lib/kvec.h"
#include "nvim/log.h"
#include "nvim/lua/executor.h"

View File

@ -27,6 +27,7 @@
#include "nvim/getchar.h"
#include "nvim/indent.h"
#include "nvim/indent_c.h"
#include "nvim/insexpand.h"
#include "nvim/main.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
@ -5849,7 +5850,7 @@ exit_matched:
if (action == ACTION_EXPAND) {
ins_compl_check_keys(30, false);
}
if (got_int || compl_interrupted) {
if (got_int || ins_compl_interrupted()) {
break;
}
@ -5911,7 +5912,7 @@ exit_matched:
}
} else if (!found
&& action != ACTION_EXPAND) {
if (got_int || compl_interrupted) {
if (got_int || ins_compl_interrupted()) {
emsg(_(e_interr));
} else if (type == FIND_DEFINE) {
emsg(_("E388: Couldn't find definition"));

View File

@ -95,6 +95,7 @@
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
#include "nvim/input.h"
#include "nvim/insexpand.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
@ -7012,7 +7013,7 @@ void spell_dump_compl(char_u *pat, int ic, Direction *dir, int dumpflags_arg)
arridx[0] = 0;
curi[0] = 1;
while (depth >= 0 && !got_int
&& (pat == NULL || !compl_interrupted)) {
&& (pat == NULL || !ins_compl_interrupted())) {
if (curi[depth] > byts[arridx[depth]]) {
// Done all bytes at this node, go up one level.
--depth;

View File

@ -5,10 +5,10 @@
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/ex_docmd.h"
#include "nvim/getchar.h"
#include "nvim/insexpand.h"
#include "nvim/lib/kvec.h"
#include "nvim/log.h"
#include "nvim/main.h"

View File

@ -26,6 +26,7 @@
#include "nvim/garray.h"
#include "nvim/if_cscope.h"
#include "nvim/input.h"
#include "nvim/insexpand.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
@ -1648,7 +1649,7 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int
if ((flags & TAG_INS_COMP)) { // Double brackets for gcc
ins_compl_check_keys(30, false);
}
if (got_int || compl_interrupted) {
if (got_int || ins_compl_interrupted()) {
stop_searching = true;
break;
}