diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-21 14:37:09 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-21 14:37:09 +0200 |
commit | e2c453d38f6512ac4cff7cd26aa7780b4e2534d7 (patch) | |
tree | 8458a35d59ac43121bfd2d24d5e9f7f54969d0dc /src | |
parent | d933c82ff4e2c910bd533ed9a50377699c3f5ec9 (diff) |
patch 8.1.1901: the +insert_expand feature is not always availablev8.1.1901
Problem: The +insert_expand feature is not always available.
Solution: Graduate the +insert_expand feature.
Diffstat (limited to 'src')
-rw-r--r-- | src/autocmd.c | 9 | ||||
-rw-r--r-- | src/buffer.c | 6 | ||||
-rw-r--r-- | src/change.c | 5 | ||||
-rw-r--r-- | src/charset.c | 6 | ||||
-rw-r--r-- | src/edit.c | 81 | ||||
-rw-r--r-- | src/evalfunc.c | 10 | ||||
-rw-r--r-- | src/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/ex_getln.c | 2 | ||||
-rw-r--r-- | src/feature.h | 13 | ||||
-rw-r--r-- | src/getchar.c | 9 | ||||
-rw-r--r-- | src/globals.h | 20 | ||||
-rw-r--r-- | src/gui.c | 7 | ||||
-rw-r--r-- | src/highlight.c | 6 | ||||
-rw-r--r-- | src/indent.c | 2 | ||||
-rw-r--r-- | src/insexpand.c | 17 | ||||
-rw-r--r-- | src/misc2.c | 4 | ||||
-rw-r--r-- | src/move.c | 18 | ||||
-rw-r--r-- | src/option.c | 68 | ||||
-rw-r--r-- | src/option.h | 12 | ||||
-rw-r--r-- | src/popupmnu.c | 36 | ||||
-rw-r--r-- | src/proto.h | 2 | ||||
-rw-r--r-- | src/screen.c | 30 | ||||
-rw-r--r-- | src/search.c | 46 | ||||
-rw-r--r-- | src/spell.c | 2 | ||||
-rw-r--r-- | src/structs.h | 8 | ||||
-rw-r--r-- | src/tag.c | 4 | ||||
-rw-r--r-- | src/term.c | 2 | ||||
-rw-r--r-- | src/userfunc.c | 2 | ||||
-rw-r--r-- | src/version.c | 6 | ||||
-rw-r--r-- | src/vim.h | 4 |
30 files changed, 78 insertions, 361 deletions
diff --git a/src/autocmd.c b/src/autocmd.c index 640032b608..8a6896bae8 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -1678,10 +1678,7 @@ trigger_cursorhold(void) && has_cursorhold() && reg_recording == 0 && typebuf.tb_len == 0 -#ifdef FEAT_INS_EXPAND - && !ins_compl_active() -#endif - ) + && !ins_compl_active()) { state = get_real_state(); if (state == NORMAL_BUSY || (state & INSERT) != 0) @@ -1726,7 +1723,6 @@ has_textchangedI(void) return (first_autopat[(int)EVENT_TEXTCHANGEDI] != NULL); } -#if defined(FEAT_INS_EXPAND) || defined(PROTO) /* * Return TRUE when there is a TextChangedP autocommand defined. */ @@ -1735,7 +1731,6 @@ has_textchangedP(void) { return (first_autopat[(int)EVENT_TEXTCHANGEDP] != NULL); } -#endif /* * Return TRUE when there is an InsertCharPre autocommand defined. @@ -2044,9 +2039,7 @@ apply_autocmds_group( if (!autocmd_busy) { save_search_patterns(); -#ifdef FEAT_INS_EXPAND if (!ins_compl_active()) -#endif { saveRedobuff(&save_redo); did_save_redobuff = TRUE; diff --git a/src/buffer.c b/src/buffer.c index f9686a7bd8..a9aa30c3e3 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -310,9 +310,7 @@ open_buffer( /* Set last_changedtick to avoid triggering a TextChanged autocommand right * after it was added. */ curbuf->b_last_changedtick = CHANGEDTICK(curbuf); -#ifdef FEAT_INS_EXPAND curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf); -#endif /* require "!" to overwrite the file, because it wasn't read completely */ #ifdef FEAT_EVAL @@ -2228,9 +2226,7 @@ free_buf_options( #if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT) clear_string_option(&buf->b_p_cinw); #endif -#ifdef FEAT_INS_EXPAND clear_string_option(&buf->b_p_cpt); -#endif #ifdef FEAT_COMPL_FUNC clear_string_option(&buf->b_p_cfu); clear_string_option(&buf->b_p_ofu); @@ -2247,10 +2243,8 @@ free_buf_options( #ifdef FEAT_EVAL clear_string_option(&buf->b_p_tfu); #endif -#ifdef FEAT_INS_EXPAND clear_string_option(&buf->b_p_dict); clear_string_option(&buf->b_p_tsr); -#endif #ifdef FEAT_TEXTOBJ clear_string_option(&buf->b_p_qe); #endif diff --git a/src/change.c b/src/change.c index 23c95871ee..ac2cc30be0 100644 --- a/src/change.c +++ b/src/change.c @@ -1008,10 +1008,7 @@ ins_char_bytes(char_u *buf, int charlen) // show the match for right parens and braces. if (p_sm && (State & INSERT) && msg_silent == 0 -#ifdef FEAT_INS_EXPAND - && !ins_compl_active() -#endif - ) + && !ins_compl_active()) { if (has_mbyte) showmatch(mb_ptr2char(buf)); diff --git a/src/charset.c b/src/charset.c index 50ca617dc2..d47ccfd691 100644 --- a/src/charset.c +++ b/src/charset.c @@ -314,8 +314,6 @@ trans_characters( } } -#if defined(FEAT_EVAL) || defined(FEAT_TITLE) || defined(FEAT_INS_EXPAND) \ - || defined(PROTO) /* * Translate a string into allocated memory, replacing special chars with * printable chars. Returns NULL when out of memory. @@ -382,9 +380,7 @@ transstr(char_u *s) } return res; } -#endif -#if defined(FEAT_SYN_HL) || defined(FEAT_INS_EXPAND) || defined(PROTO) /* * Convert the string "str[orglen]" to do ignore-case comparing. Uses the * current locale. @@ -495,7 +491,6 @@ str_foldcase( return (char_u *)ga.ga_data; return buf; } -#endif /* * Catch 22: g_chartab[] can't be initialized before the options are @@ -2015,6 +2010,7 @@ backslash_halve(char_u *p) /* * backslash_halve() plus save the result in allocated memory. + * However, returns "p" when out of memory. */ char_u * backslash_halve_save(char_u *p) diff --git a/src/edit.c b/src/edit.c index 83b4be784d..cc41d49cc7 100644 --- a/src/edit.c +++ b/src/edit.c @@ -18,11 +18,9 @@ #define BACKSPACE_WORD_NOT_SPACE 3 #define BACKSPACE_LINE 4 -#ifdef FEAT_INS_EXPAND /* Set when doing something for completion that may call edit() recursively, * which is not allowed. */ static int compl_busy = FALSE; -#endif /* FEAT_INS_EXPAND */ static void ins_ctrl_v(void); @@ -194,7 +192,6 @@ edit( return FALSE; } -#ifdef FEAT_INS_EXPAND /* Don't allow recursive insert mode when busy with completion. */ if (ins_compl_active() || compl_busy || pum_visible()) { @@ -202,7 +199,6 @@ edit( return FALSE; } ins_compl_clear(); /* clear stuff for CTRL-X mode */ -#endif /* * Trigger InsertEnter autocommands. Do not do this for "r<CR>" or "grx". @@ -462,11 +458,7 @@ edit( if (update_Insstart_orig) Insstart_orig = Insstart; - if (stop_insert_mode -#ifdef FEAT_INS_EXPAND - && !pum_visible() -#endif - ) + if (stop_insert_mode && !pum_visible()) { /* ":stopinsert" used or 'insertmode' reset */ count = 0; @@ -631,7 +623,6 @@ edit( c = hkmap(c); /* Hebrew mode mapping */ #endif -#ifdef FEAT_INS_EXPAND /* * Special handling of keys while the popup menu is visible or wanted * and the cursor is still in the completed word. Only when there is @@ -701,7 +692,6 @@ edit( ins_compl_init_get_longest(); if (ins_compl_prep(c)) continue; -#endif /* CTRL-\ CTRL-N goes to Normal mode, * CTRL-\ CTRL-G goes to mode selected with 'insertmode', @@ -740,10 +730,8 @@ edit( c = do_digraph(c); #endif -#ifdef FEAT_INS_EXPAND if ((c == Ctrl_V || c == Ctrl_Q) && ctrl_x_mode_cmdline()) goto docomplete; -#endif if (c == Ctrl_V || c == Ctrl_Q) { ins_ctrl_v(); @@ -752,11 +740,7 @@ edit( } #ifdef FEAT_CINDENT - if (cindent_on() -# ifdef FEAT_INS_EXPAND - && ctrl_x_mode_none() -# endif - ) + if (cindent_on() && ctrl_x_mode_none()) { /* A key name preceded by a bang means this key is not to be * inserted. Skip ahead to the re-indenting below. @@ -950,21 +934,20 @@ doESCkey: #endif case Ctrl_D: /* Make indent one shiftwidth smaller. */ -#if defined(FEAT_INS_EXPAND) && defined(FEAT_FIND_ID) +#if defined(FEAT_FIND_ID) if (ctrl_x_mode_path_defines()) goto docomplete; #endif /* FALLTHROUGH */ case Ctrl_T: /* Make indent one shiftwidth greater. */ -# ifdef FEAT_INS_EXPAND if (c == Ctrl_T && ctrl_x_mode_thesaurus()) { if (has_compl_option(FALSE)) goto docomplete; break; } -# endif + ins_shift(c, lastc); auto_format(FALSE, TRUE); inserted_space = FALSE; @@ -1131,10 +1114,8 @@ doESCkey: break; case K_UP: /* <Up> */ -#ifdef FEAT_INS_EXPAND if (pum_visible()) goto docomplete; -#endif if (mod_mask & MOD_MASK_SHIFT) ins_pageup(); else @@ -1144,18 +1125,14 @@ doESCkey: case K_S_UP: /* <S-Up> */ case K_PAGEUP: case K_KPAGEUP: -#ifdef FEAT_INS_EXPAND if (pum_visible()) goto docomplete; -#endif ins_pageup(); break; case K_DOWN: /* <Down> */ -#ifdef FEAT_INS_EXPAND if (pum_visible()) goto docomplete; -#endif if (mod_mask & MOD_MASK_SHIFT) ins_pagedown(); else @@ -1165,10 +1142,8 @@ doESCkey: case K_S_DOWN: /* <S-Down> */ case K_PAGEDOWN: case K_KPAGEDOWN: -#ifdef FEAT_INS_EXPAND if (pum_visible()) goto docomplete; -#endif ins_pagedown(); break; @@ -1183,7 +1158,7 @@ doESCkey: /* FALLTHROUGH */ case TAB: /* TAB or Complete patterns along path */ -#if defined(FEAT_INS_EXPAND) && defined(FEAT_FIND_ID) +#if defined(FEAT_FIND_ID) if (ctrl_x_mode_path_patterns()) goto docomplete; #endif @@ -1235,25 +1210,20 @@ doESCkey: inserted_space = FALSE; break; -#if defined(FEAT_DIGRAPHS) || defined(FEAT_INS_EXPAND) case Ctrl_K: /* digraph or keyword completion */ -# ifdef FEAT_INS_EXPAND if (ctrl_x_mode_dictionary()) { if (has_compl_option(TRUE)) goto docomplete; break; } -# endif -# ifdef FEAT_DIGRAPHS +#ifdef FEAT_DIGRAPHS c = ins_digraph(); if (c == NUL) break; -# endif - goto normalchar; #endif + goto normalchar; -#ifdef FEAT_INS_EXPAND case Ctrl_X: /* Enter CTRL-X mode */ ins_ctrl_x(); break; @@ -1273,12 +1243,9 @@ doESCkey: if (!ctrl_x_mode_spell()) goto normalchar; goto docomplete; -#endif case Ctrl_L: /* Whole line completion after ^X */ -#ifdef FEAT_INS_EXPAND if (!ctrl_x_mode_whole_line()) -#endif { /* CTRL-L with 'insertmode' set: Leave Insert mode */ if (p_im) @@ -1289,7 +1256,6 @@ doESCkey: } goto normalchar; } -#ifdef FEAT_INS_EXPAND /* FALLTHROUGH */ case Ctrl_P: /* Do previous/next pattern completion */ @@ -1313,7 +1279,6 @@ docomplete: #endif compl_busy = FALSE; break; -#endif /* FEAT_INS_EXPAND */ case Ctrl_Y: /* copy from previous line or scroll down */ case Ctrl_E: /* copy from next line or scroll up */ @@ -1419,11 +1384,7 @@ normalchar: inserted_space = FALSE; #ifdef FEAT_CINDENT - if (can_cindent && cindent_on() -# ifdef FEAT_INS_EXPAND - && ctrl_x_mode_normal() -# endif - ) + if (can_cindent && cindent_on() && ctrl_x_mode_normal()) { force_cindent: /* @@ -1478,10 +1439,7 @@ ins_redraw(int ready) // not busy with something # endif ) && !EQUAL_POS(last_cursormoved, curwin->w_cursor) -# ifdef FEAT_INS_EXPAND - && !pum_visible() -# endif - ) + && !pum_visible()) { # ifdef FEAT_SYN_HL /* Need to update the screen first, to make sure syntax @@ -1516,10 +1474,7 @@ ins_redraw(int ready) // not busy with something /* Trigger TextChangedI if b_changedtick differs. */ if (ready && has_textchangedI() && curbuf->b_last_changedtick != CHANGEDTICK(curbuf) -#ifdef FEAT_INS_EXPAND - && !pum_visible() -#endif - ) + && !pum_visible()) { aco_save_T aco; varnumber_T tick = CHANGEDTICK(curbuf); @@ -1534,7 +1489,6 @@ ins_redraw(int ready) // not busy with something (linenr_T)(curwin->w_cursor.lnum + 1)); } -#ifdef FEAT_INS_EXPAND /* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes * TextChangedI will need to trigger for backwards compatibility, thus use * different b_last_changedtick* variables. */ @@ -1554,7 +1508,6 @@ ins_redraw(int ready) // not busy with something u_save(curwin->w_cursor.lnum, (linenr_T)(curwin->w_cursor.lnum + 1)); } -#endif #if defined(FEAT_CONCEAL) if ((conceal_update_lines @@ -4328,10 +4281,8 @@ ins_ctrl_g(void) { int c; -#ifdef FEAT_INS_EXPAND - /* Right after CTRL-X the cursor will be after the ruler. */ + // Right after CTRL-X the cursor will be after the ruler. setcursor(); -#endif /* * Don't map the second key. This also prevents the mode message to be @@ -5253,9 +5204,7 @@ ins_mousescroll(int dir) { pos_T tpos; win_T *old_curwin = curwin, *wp; -# ifdef FEAT_INS_EXPAND int did_scroll = FALSE; -# endif tpos = curwin->w_cursor; @@ -5276,10 +5225,8 @@ ins_mousescroll(int dir) if (curwin == old_curwin) undisplay_dollar(); -# ifdef FEAT_INS_EXPAND /* Don't scroll the window in which completion is being done. */ if (!pum_visible() || curwin != old_curwin) -# endif { if (dir == MSCR_DOWN || dir == MSCR_UP) { @@ -5306,9 +5253,7 @@ ins_mousescroll(int dir) gui_do_horiz_scroll(val, TRUE); } #endif -# ifdef FEAT_INS_EXPAND did_scroll = TRUE; -# endif } curwin->w_redr_status = TRUE; @@ -5316,7 +5261,6 @@ ins_mousescroll(int dir) curwin = old_curwin; curbuf = curwin->w_buffer; -# ifdef FEAT_INS_EXPAND /* The popup menu may overlay the window, need to redraw it. * TODO: Would be more efficient to only redraw the windows that are * overlapped by the popup menu. */ @@ -5325,7 +5269,6 @@ ins_mousescroll(int dir) redraw_all_later(NOT_VALID); ins_compl_show_pum(); } -# endif if (!EQUAL_POS(curwin->w_cursor, tpos)) { @@ -6256,7 +6199,6 @@ ins_ctrl_ey(int tc) { int c = tc; -#ifdef FEAT_INS_EXPAND if (ctrl_x_mode_scroll()) { if (c == Ctrl_Y) @@ -6266,7 +6208,6 @@ ins_ctrl_ey(int tc) redraw_later(VALID); } else -#endif { c = ins_copychar(curwin->w_cursor.lnum + (c == Ctrl_Y ? -1 : 1)); if (c != NUL) diff --git a/src/evalfunc.c b/src/evalfunc.c index 2f66b173a9..d2a0c64bdc 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -499,12 +499,10 @@ static funcentry_T global_functions[] = {"cindent", 1, 1, 0, f_cindent}, {"clearmatches", 0, 1, 0, f_clearmatches}, {"col", 1, 1, 0, f_col}, -#if defined(FEAT_INS_EXPAND) {"complete", 2, 2, 0, f_complete}, {"complete_add", 1, 1, 0, f_complete_add}, {"complete_check", 0, 0, 0, f_complete_check}, {"complete_info", 0, 1, 0, f_complete_info}, -#endif {"confirm", 1, 4, 0, f_confirm}, {"copy", 1, 1, FEARG_1, f_copy}, #ifdef FEAT_FLOAT @@ -5951,9 +5949,7 @@ f_has(typval_T *argvars, typval_T *rettv) #if defined(HAVE_ICONV_H) && defined(USE_ICONV) "iconv", #endif -#ifdef FEAT_INS_EXPAND "insert_expand", -#endif #ifdef FEAT_JOB_CHANNEL "job", #endif @@ -7638,12 +7634,10 @@ f_mode(typval_T *argvars, typval_T *rettv) buf[0] = 'R'; else buf[0] = 'i'; -#ifdef FEAT_INS_EXPAND if (ins_compl_active()) buf[1] = 'c'; else if (ctrl_x_mode_not_defined_yet()) buf[1] = 'x'; -#endif } } else if ((State & CMDLINE) || exmode_active) @@ -7886,9 +7880,7 @@ f_pum_getpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { if (rettv_dict_alloc(rettv) != OK) return; -#ifdef FEAT_INS_EXPAND pum_set_event_info(rettv->vval.v_dict); -#endif } /* @@ -7897,10 +7889,8 @@ f_pum_getpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED) static void f_pumvisible(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { -#ifdef FEAT_INS_EXPAND if (pum_visible()) rettv->vval.v_number = 1; -#endif } #ifdef FEAT_PYTHON3 diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 77d39434f5..ee3291c110 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -4391,12 +4391,10 @@ do_sub(exarg_T *eap) subflags.do_ask = FALSE; break; } -#ifdef FEAT_INS_EXPAND if (typed == Ctrl_E) scrollup_clamp(); else if (typed == Ctrl_Y) scrolldown_clamp(); -#endif } State = save_State; #ifdef FEAT_MOUSE diff --git a/src/ex_getln.c b/src/ex_getln.c index 6418ffe904..5d1c8efb7f 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4040,11 +4040,9 @@ open_cmdwin(void) /* Don't execute autocommands while creating the window. */ block_autocmds(); -#if defined(FEAT_INS_EXPAND) // When using completion in Insert mode with <C-R>=<C-F> one can open the // command line window, but we don't want the popup menu then. pum_undisplay(); -#endif /* don't use a new tab page */ cmdmod.tab = 0; diff --git a/src/feature.h b/src/feature.h index 1c5128a7d6..8afa98797a 100644 --- a/src/feature.h +++ b/src/feature.h @@ -106,6 +106,7 @@ * +user_commands Allow the user to define his own commands. * +multi_byte Generic multi-byte character handling. * +cmdline_compl completion of mappings/abbreviations in cmdline mode. + * +insert_expand CTRL-N/CTRL-P/CTRL-X in insert mode. * * Obsolete: * +tag_old_static Old style static tags: "file:tag file ..". @@ -170,14 +171,6 @@ # define FEAT_KEYMAP #endif -/* - * +insert_expand CTRL-N/CTRL-P/CTRL-X in insert mode. Takes about - * 4Kbyte of code. - */ -#ifdef FEAT_NORMAL -# define FEAT_INS_EXPAND -#endif - #ifdef FEAT_NORMAL # define VIM_BACKTICK /* internal backtick expansion */ #endif @@ -343,7 +336,7 @@ /* * Insert mode completion with 'completefunc'. */ -#if defined(FEAT_INS_EXPAND) && defined(FEAT_EVAL) +#if defined(FEAT_EVAL) # define FEAT_COMPL_FUNC #endif @@ -621,7 +614,7 @@ /* * popup menu in a terminal */ -#if defined(FEAT_MENU) && !defined(ALWAYS_USE_GUI) && defined(FEAT_INS_EXPAND) +#if defined(FEAT_MENU) && !defined(ALWAYS_USE_GUI) # define FEAT_TERM_POPUP_MENU #endif diff --git a/src/getchar.c b/src/getchar.c index 2fb8438e85..eeb33420bc 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1481,7 +1481,6 @@ close_all_scripts(void) } #endif -#if defined(FEAT_INS_EXPAND) || defined(PROTO) /* * Return TRUE when reading keys from a script file. */ @@ -1490,7 +1489,6 @@ using_script(void) { return scriptin[curscript] != NULL; } -#endif /* * This function is called just before doing a blocking wait. Thus after @@ -1866,7 +1864,6 @@ vpeekc_nomap(void) } #endif -#if defined(FEAT_INS_EXPAND) || defined(FEAT_EVAL) || defined(PROTO) /* * Check if any character is available, also half an escape sequence. * Trick: when no typeahead found, but there is something in the typeahead @@ -1882,7 +1879,6 @@ vpeekc_any(void) c = ESC; return c; } -#endif /* * Call vpeekc() without causing anything to be mapped. @@ -1963,12 +1959,9 @@ handle_mapping( && !(State == HITRETURN && (tb_c1 == CAR || tb_c1 == ' ')) && State != ASKMORE && State != CONFIRM -#ifdef FEAT_INS_EXPAND && !((ctrl_x_mode_not_default() && vim_is_ctrl_x_key(tb_c1)) || ((compl_cont_status & CONT_LOCAL) - && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P))) -#endif - ) + && (tb_c1 == Ctrl_N || tb_c1 == Ctrl_P)))) { #ifdef FEAT_LANGMAP if (tb_c1 == K_SPECIAL) diff --git a/src/globals.h b/src/globals.h index 61cb2b2839..d0837d3ff2 100644 --- a/src/globals.h +++ b/src/globals.h @@ -129,7 +129,6 @@ EXTERN int screen_cleared INIT(= FALSE); // screen has been cleared */ EXTERN colnr_T dollar_vcol INIT(= -1); -#ifdef FEAT_INS_EXPAND /* * Variables for Insert mode completion. */ @@ -150,7 +149,11 @@ EXTERN int compl_cont_status INIT(= 0); // word-wise expansion, not set for ^X^L # define CONT_LOCAL 32 // for ctrl_x_mode 0, ^X^P/^X^N do a local // expansion, (eg use complete=.) -#endif + +EXTERN char_u *edit_submode INIT(= NULL); // msg for CTRL-X submode +EXTERN char_u *edit_submode_pre INIT(= NULL); // prepended to edit_submode +EXTERN char_u *edit_submode_extra INIT(= NULL);// appended to edit_submode +EXTERN hlf_T edit_submode_highl; // highl. method for extra info /* * Functions for putting characters in the command line, @@ -987,12 +990,6 @@ EXTERN int arrow_used; // Normally FALSE, set to TRUE after // to call u_sync() EXTERN int ins_at_eol INIT(= FALSE); // put cursor after eol when // restarting edit after CTRL-O -#ifdef FEAT_INS_EXPAND -EXTERN char_u *edit_submode INIT(= NULL); // msg for CTRL-X submode -EXTERN char_u *edit_submode_pre INIT(= NULL); // prepended to edit_submode -EXTERN char_u *edit_submode_extra INIT(= NULL);// appended to edit_submode -EXTERN hlf_T edit_submode_highl; // highl. method for extra info -#endif EXTERN int no_abbr INIT(= TRUE); // TRUE when no abbreviations loaded @@ -1532,9 +1529,7 @@ EXTERN char e_openerrf[] INIT(= N_("E40: Can't open errorfile %s")); EXTERN char e_opendisp[] INIT(= N_("E233: cannot open display")); #endif EXTERN char e_outofmem[] INIT(= N_("E41: Out of memory!")); -#ifdef FEAT_INS_EXPAND -EXTERN char e_patnotf[] INIT(= N_("Pattern not found")); -#endif +EXTERN char e_patnotf[] INIT(= N_("Pattern not found")); EXTERN char e_patnotf2[] INIT(= N_("E486: Pattern not found: %s")); EXTERN char e_positive[] INIT(= N_("E487: Argument must be positive")); #if defined(UNIX) || defined(FEAT_SESSION) @@ -1609,8 +1604,7 @@ EXTERN char e_nobufnr[] INIT(= N_("E86: Buffer %ld does not exist")); EXTERN char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter")); EXTERN char e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer")); -#if defined(FEAT_SYN_HL) || \ - (defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC)) +#if defined(FEAT_SYN_HL) || defined(FEAT_COMPL_FUNC) EXTERN char e_notset[] INIT(= N_("E764: Option '%s' is not set")); #endif #ifndef FEAT_CLIPBOARD @@ -4019,12 +4019,10 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging) if (dont_scroll) return; #endif -#ifdef FEAT_INS_EXPAND /* Disallow scrolling the current window when the completion popup menu is * visible. */ if ((sb->wp == NULL || sb->wp == curwin) && pum_visible()) return; -#endif #ifdef FEAT_RIGHTLEFT if (sb->wp == NULL && curwin->w_p_rl) @@ -4485,13 +4483,12 @@ gui_do_scroll(void) { int type = VALID; -#ifdef FEAT_INS_EXPAND if (pum_visible()) { type = NOT_VALID; wp->w_lines_valid = 0; } -#endif + /* Don't set must_redraw here, it may cause the popup menu to * disappear when losing focus after a scrollbar drag. */ if (wp->w_redr_type < type) @@ -4501,11 +4498,9 @@ gui_do_scroll(void) mch_enable_flush(); } -#ifdef FEAT_INS_EXPAND /* May need to redraw the popup menu. */ if (pum_visible()) pum_redraw(); -#endif return (wp == curwin && !EQUAL_POS(curwin->w_cursor, old_cursor)); } diff --git a/src/highlight.c b/src/highlight.c index f32081d8ab..8901994eb7 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -140,10 +140,8 @@ static char *(highlight_init_both[]) = { CENT("DiffText term=reverse cterm=bold ctermbg=Red", "DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red"), #endif -#ifdef FEAT_INS_EXPAND CENT("PmenuSbar ctermbg=Grey", "PmenuSbar ctermbg=Grey guibg=Grey"), -#endif CENT("TabLineSel term=bold cterm=bold", "TabLineSel term=bold cterm=bold gui=bold"), CENT("TabLineFill term=reverse cterm=reverse", @@ -181,14 +179,12 @@ static char *(highlight_init_light[]) = { CENT("SpellLocal term=underline ctermbg=Cyan", "SpellLocal term=underline ctermbg=Cyan guisp=DarkCyan gui=undercurl"), #endif -#ifdef FEAT_INS_EXPAND CENT("PmenuThumb ctermbg=Black", "PmenuThumb ctermbg=Black guibg=Black"), CENT("Pmenu ctermbg=LightMagenta ctermfg=Black", "Pmenu ctermbg=LightMagenta ctermfg=Black guibg=LightMagenta"), CENT("PmenuSel ctermbg=LightGrey ctermfg=Black", "PmenuSel ctermbg=LightGrey ctermfg=Black guibg=Grey"), -#endif CENT("SpecialKey term=bold ctermfg=DarkBlue", "SpecialKey term=bold ctermfg=DarkBlue guifg=Blue"), CENT("Title term=bold ctermfg=DarkMagenta", @@ -276,14 +272,12 @@ static char *(highlight_init_dark[]) = { CENT("SpellLocal term=underline ctermbg=Cyan", "SpellLocal term=underline ctermbg=Cyan guisp=Cyan gui=undercurl"), #endif -#ifdef FEAT_INS_EXPAND CENT("PmenuThumb ctermbg=White", "PmenuThumb ctermbg=White guibg=White"), CENT("Pmenu ctermbg=Magenta ctermfg=Black", "Pmenu ctermbg=Magenta ctermfg=Black guibg=Magenta"), CENT("PmenuSel ctermbg=Black ctermfg=DarkGrey", "PmenuSel ctermbg=Black ctermfg=DarkGrey guibg=DarkGrey"), -#endif CENT("Title term=bold ctermfg=LightMagenta", "Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta"), CENT("WarningMsg term=standout ctermfg=LightRed", diff --git a/src/indent.c b/src/indent.c index 2ae580a97e..b74864cb44 100644 --- a/src/indent.c +++ b/src/indent.c @@ -4110,7 +4110,6 @@ in_cinkeys( { int match = FALSE; -#ifdef FEAT_INS_EXPAND if (keytyped == KEY_COMPLETE) { char_u *s; @@ -4140,7 +4139,6 @@ in_cinkeys( match = TRUE; } else -#endif // TODO: multi-byte if (keytyped == (int)p[-1] || (icase && keytyped < 256 && TOLOWER_LOC(keytyped) == TOLOWER_LOC((int)p[-1]))) diff --git a/src/insexpand.c b/src/insexpand.c index a86630f621..280c2c6e4c 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -13,7 +13,6 @@ #include "vim.h" -#ifdef FEAT_INS_EXPAND /* * Definitions used for CTRL-X submode. * Note: If you change CTRL-X submode, you must also maintain ctrl_x_msgs[] and @@ -209,14 +208,12 @@ static int ins_compl_pum_key(int c); static int ins_compl_key2count(int c); static void show_pum(int prev_w_wrow, int prev_w_leftcol); static unsigned quote_meta(char_u *dest, char_u *str, int len); -#endif // FEAT_INS_EXPAND #ifdef FEAT_SPELL static void spell_back_to_badword(void); static int spell_bad_len = 0; // length of located bad word #endif -#if defined(FEAT_INS_EXPAND) || defined(PROTO) /* * CTRL-X pressed in Insert mode. */ @@ -288,9 +285,9 @@ ctrl_x_mode_not_defined_yet(void) has_compl_option(int dict_opt) { if (dict_opt ? (*curbuf->b_p_dict == NUL && *p_dict == NUL -# ifdef FEAT_SPELL +#ifdef FEAT_SPELL && !curwin->w_p_spell -# endif +#endif ) : (*curbuf->b_p_tsr == NUL && *p_tsr == NUL)) { @@ -4154,15 +4151,15 @@ quote_meta(char_u *dest, char_u *src, int len) return m; } -# if defined(EXITFREE) || defined(PROTO) +#if defined(EXITFREE) || defined(PROTO) void free_insexpand_stuff(void) { VIM_CLEAR(compl_orig_text); } -# endif +#endif -# ifdef FEAT_SPELL +#ifdef FEAT_SPELL /* * Called when starting CTRL_X_SPELL mode: Move backwards to a previous badly * spelled word, if there is one. @@ -4176,6 +4173,4 @@ |