mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
vim-patch:8.1.1076: file for Insert mode is much too big
Problem: File for Insert mode is much too big. Solution: Split off the code for Insert completion. (Yegappan Lakshmanan, closes vim/vim#4044)7591bb39d5
Cherry-pick ins_compl_len() -> get_compl_len() from patch 8.2.4001. Reverta71c5e9eb9
: ctrl_x_mode is no longer a global variable, so l_ctrl_x_mode is no longer needed.
This commit is contained in:
@@ -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"
|
||||
|
@@ -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"
|
||||
|
@@ -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"
|
||||
|
3797
src/nvim/edit.c
3797
src/nvim/edit.c
File diff suppressed because it is too large
Load Diff
@@ -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()
|
||||
|
@@ -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"
|
||||
@@ -1091,7 +1092,7 @@ static void f_complete_check(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
|
||||
RedrawingDisabled = 0;
|
||||
ins_compl_check_keys(0, true);
|
||||
rettv->vval.v_number = compl_interrupted;
|
||||
rettv->vval.v_number = ins_compl_interrupted();
|
||||
RedrawingDisabled = saved;
|
||||
}
|
||||
|
||||
|
@@ -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"
|
||||
|
@@ -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"
|
||||
|
@@ -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);
|
||||
|
3827
src/nvim/insexpand.c
Normal file
3827
src/nvim/insexpand.c
Normal file
File diff suppressed because it is too large
Load Diff
17
src/nvim/insexpand.h
Normal file
17
src/nvim/insexpand.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef NVIM_INSEXPAND_H
|
||||
#define NVIM_INSEXPAND_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
|
@@ -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"
|
||||
|
@@ -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();
|
||||
|
@@ -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"
|
||||
|
@@ -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"
|
||||
|
@@ -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"
|
||||
|
@@ -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"));
|
||||
|
@@ -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;
|
||||
|
@@ -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"
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user