# HG changeset patch # User Bram Moolenaar # Date 1566391504 -7200 # Node ID 59f8948b7590c7aff4b1cbdcc2e8aced4cf4c8bb # Parent 42561b61bfd87442429ccd082614b1adfc47f73f patch 8.1.1901: the +insert_expand feature is not always available Commit: https://github.com/vim/vim/commit/e2c453d38f6512ac4cff7cd26aa7780b4e2534d7 Author: Bram Moolenaar Date: Wed Aug 21 14:37:09 2019 +0200 patch 8.1.1901: the +insert_expand feature is not always available Problem: The +insert_expand feature is not always available. Solution: Graduate the +insert_expand feature. diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -691,10 +691,8 @@ The flags that you can use for the subst to quit substituting 'a' to substitute this and all remaining matches 'q' to quit substituting - CTRL-E to scroll the screen up {not available when compiled - without the |+insert_expand| feature} - CTRL-Y to scroll the screen down {not available when compiled - without the |+insert_expand| feature} + CTRL-E to scroll the screen up + CTRL-Y to scroll the screen down If the 'edcompatible' option is on, Vim remembers the [c] flag and toggles it each time you use it, but resets it when you give a new search pattern. diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 8.1. Last change: 2019 Aug 16 +*index.txt* For Vim version 8.1. Last change: 2019 Aug 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -166,7 +166,6 @@ commands in CTRL-X submode *i_CTRL-X_ |i_CTRL-X_CTRL-V| CTRL-X CTRL-V complete like in : command line |i_CTRL-X_CTRL-]| CTRL-X CTRL-] complete tags |i_CTRL-X_s| CTRL-X s spelling suggestions -{not available when compiled without the |+insert_expand| feature} commands in completion mode (see |popupmenu-keys|) diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -300,8 +300,7 @@ character is written at the end of each *i_CTRL-X* *insert_expand* CTRL-X enters a sub-mode where several commands can be used. Most of these -commands do keyword completion; see |ins-completion|. These are not available -when Vim was compiled without the |+insert_expand| feature. +commands do keyword completion; see |ins-completion|. Two commands can be used to scroll the window up or down, without exiting insert mode: @@ -609,9 +608,6 @@ In Insert and Replace mode, there are se keyword or line that has been typed. This is useful if you are using complicated keywords (e.g., function names with capitals and underscores). -These commands are not available when the |+insert_expand| feature was -disabled at compile time. - Completion can be done for: 1. Whole lines |i_CTRL-X_CTRL-L| diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.1. Last change: 2019 Aug 18 +*options.txt* For Vim version 8.1. Last change: 2019 Aug 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1866,7 +1866,7 @@ A jump table for the options with a shor 'completefunc' 'cfu' string (default: empty) local to buffer {not available when compiled without the |+eval| - or |+insert_expand| features} + feature} This option specifies a function to be used for Insert mode completion with CTRL-X CTRL-U. |i_CTRL-X_CTRL-U| See |complete-functions| for an explanation of how the function is @@ -1892,8 +1892,6 @@ A jump table for the options with a shor *'completeopt'* *'cot'* 'completeopt' 'cot' string (default: "menu,preview") global - {not available when compiled without the - |+insert_expand| feature} A comma separated list of options for Insert mode completion |ins-completion|. The supported values are: @@ -5233,8 +5231,6 @@ A jump table for the options with a shor In the "popup" model the right mouse button produces a pop-up menu. You need to define this first, see |popup-menu|. - In a terminal the popup menu works if Vim is compiled with the - |+insert_expand| option. Note that you can further refine the meaning of buttons with mappings. See |gui-mouse-mapping|. But mappings are NOT used for modeless @@ -5419,7 +5415,7 @@ A jump table for the options with a shor 'omnifunc' 'ofu' string (default: empty) local to buffer {not available when compiled without the |+eval| - or |+insert_expand| features} + feature} This option specifies a function to be used for Insert mode omni completion with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O| See |complete-functions| for an explanation of how the function is @@ -5749,8 +5745,6 @@ A jump table for the options with a shor *'pumheight'* *'ph'* 'pumheight' 'ph' number (default 0) global - {not available when compiled without the - |+insert_expand| feature} Determines the maximum number of items to show in the popup menu for Insert mode completion. When zero as much space as available is used. |ins-completion-menu|. @@ -5758,8 +5752,6 @@ A jump table for the options with a shor *'pumwidth'* *'pw'* 'pumwidth' 'pw' number (default 15) global - {not available when compiled without the - |+insert_expand| feature} Determines the minimum width to use for the popup menu for Insert mode completion. |ins-completion-menu|. diff --git a/src/autocmd.c b/src/autocmd.c --- 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 --- 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 --- 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 --- 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 --- 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" 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: /* */ -#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: /* */ case K_PAGEUP: case K_KPAGEUP: -#ifdef FEAT_INS_EXPAND if (pum_visible()) goto docomplete; -#endif ins_pageup(); break; case K_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: /* */ 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 +#endif goto normalchar; -#endif - -#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 wi # 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 wi /* 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 wi (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 wi 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 --- 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 *rett 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, t { 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, t 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 --- 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 --- 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 = 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 --- 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 --- 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 --- a/src/globals.h +++ b/src/globals.h @@ -129,7 +129,6 @@ EXTERN int screen_cleared INIT(= FALSE); */ 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 FAL // 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: 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: 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 diff --git a/src/gui.c b/src/gui.c --- a/src/gui.c +++ b/src/gui.c @@ -4019,12 +4019,10 @@ gui_drag_scrollbar(scrollbar_T *sb, long 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 --- 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 --- 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 --- 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, in return m; } -# if defined(EXITFREE) || defined(PROTO) +#if defined(EXITFREE) || defined(PROTO) void free_insexpand_stuff(void) { VIM_CLEAR(compl_orig_text); } -# endif - -# ifdef FEAT_SPELL +#endif + +#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 @@ spell_back_to_badword(void) if (curwin->w_cursor.col != tpos.col) start_arrow(&tpos); } -# endif - -#endif // FEAT_INS_EXPAND +#endif diff --git a/src/misc2.c b/src/misc2.c --- a/src/misc2.c +++ b/src/misc2.c @@ -1065,7 +1065,7 @@ free_all_mem(void) spell_free_all(); # endif -# if defined(FEAT_INS_EXPAND) && defined(FEAT_BEVAL_TERM) +# if defined(FEAT_BEVAL_TERM) ui_remove_balloon(); # endif @@ -1117,9 +1117,7 @@ free_all_mem(void) free_search_patterns(); free_old_sub(); free_last_insert(); -# if defined(FEAT_INS_EXPAND) free_insexpand_stuff(); -# endif free_prev_shellcmd(); free_regexp_stuff(); free_tag_stuff(); diff --git a/src/move.c b/src/move.c --- a/src/move.c +++ b/src/move.c @@ -136,10 +136,7 @@ redraw_for_cursorline(win_T *wp) #endif ) && (wp->w_valid & VALID_CROW) == 0 -#ifdef FEAT_INS_EXPAND - && !pum_visible() -#endif - ) + && !pum_visible()) { if (wp->w_p_rnu) // win_line() will redraw the number column only. @@ -816,11 +813,7 @@ validate_virtcol_win(win_T *wp) getvvcol(wp, &wp->w_cursor, NULL, &(wp->w_virtcol), NULL); wp->w_valid |= VALID_VIRTCOL; #ifdef FEAT_SYN_HL - if (wp->w_p_cuc -# ifdef FEAT_INS_EXPAND - && !pum_visible() -# endif - ) + if (wp->w_p_cuc && !pum_visible()) redraw_win_later(wp, SOME_VALID); #endif } @@ -1179,10 +1172,7 @@ curs_columns( #ifdef FEAT_SYN_HL /* Redraw when w_virtcol changes and 'cursorcolumn' is set */ if (curwin->w_p_cuc && (curwin->w_valid & VALID_VIRTCOL) == 0 -# ifdef FEAT_INS_EXPAND - && !pum_visible() -# endif - ) + && !pum_visible()) redraw_later(SOME_VALID); #endif @@ -1515,7 +1505,6 @@ max_topfill(void) } #endif -#if defined(FEAT_INS_EXPAND) || defined(PROTO) /* * Scroll the screen one line down, but don't do it if it would move the * cursor off the screen. @@ -1634,7 +1623,6 @@ scrollup_clamp(void) curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE); } } -#endif /* FEAT_INS_EXPAND */ /* * Add one line above "lp->lnum". This can be a filler line, a closed fold or diff --git a/src/option.c b/src/option.c --- a/src/option.c +++ b/src/option.c @@ -83,11 +83,9 @@ #ifdef FEAT_COMMENTS # define PV_COM OPT_BUF(BV_COM) #endif -#ifdef FEAT_INS_EXPAND -# define PV_CPT OPT_BUF(BV_CPT) -# define PV_DICT OPT_BOTH(OPT_BUF(BV_DICT)) -# define PV_TSR OPT_BOTH(OPT_BUF(BV_TSR)) -#endif +#define PV_CPT OPT_BUF(BV_CPT) +#define PV_DICT OPT_BOTH(OPT_BUF(BV_DICT)) +#define PV_TSR OPT_BOTH(OPT_BUF(BV_TSR)) #define PV_CSL OPT_BUF(BV_CSL) #ifdef FEAT_COMPL_FUNC # define PV_CFU OPT_BUF(BV_CFU) @@ -301,9 +299,7 @@ static char_u *p_com; #ifdef FEAT_FOLDING static char_u *p_cms; #endif -#ifdef FEAT_INS_EXPAND static char_u *p_cpt; -#endif #ifdef FEAT_COMPL_FUNC static char_u *p_cfu; static char_u *p_ofu; @@ -850,13 +846,8 @@ static struct vimoption options[] = (char_u *)&p_cp, PV_NONE, {(char_u *)TRUE, (char_u *)FALSE} SCTX_INIT}, {"complete", "cpt", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, -#ifdef FEAT_INS_EXPAND (char_u *)&p_cpt, PV_CPT, {(char_u *)".,w,b,u,t,i", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCTX_INIT}, {"concealcursor","cocu", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, #ifdef FEAT_CONCEAL @@ -885,13 +876,8 @@ static struct vimoption options[] = #endif SCTX_INIT}, {"completeopt", "cot", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, -#ifdef FEAT_INS_EXPAND (char_u *)&p_cot, PV_NONE, {(char_u *)"menu,preview", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif SCTX_INIT}, {"completepopup", "cpp", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, #if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX) @@ -903,7 +889,7 @@ static struct vimoption options[] = #endif SCTX_INIT}, {"completeslash", "csl", P_STRING|P_VI_DEF|P_VIM, -#if defined(FEAT_INS_EXPAND) && defined(BACKSLASH_IN_FILENAME) +#if defined(BACKSLASH_IN_FILENAME) (char_u *)&p_csl, PV_CSL, {(char_u *)"", (char_u *)0L} #else @@ -1023,11 +1009,7 @@ static struct vimoption options[] = (char_u *)&p_deco, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME, -#ifdef FEAT_INS_EXPAND (char_u *)&p_dict, PV_DICT, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)"", (char_u *)0L} SCTX_INIT}, {"diff", NULL, P_BOOL|P_VI_DEF|P_RWIN|P_NOGLOB, #ifdef FEAT_DIFF @@ -2198,18 +2180,10 @@ static struct vimoption options[] = (char_u *)&p_prompt, PV_NONE, {(char_u *)TRUE, (char_u *)0L} SCTX_INIT}, {"pumheight", "ph", P_NUM|P_VI_DEF, -#ifdef FEAT_INS_EXPAND (char_u *)&p_ph, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)0L, (char_u *)0L} SCTX_INIT}, {"pumwidth", "pw", P_NUM|P_VI_DEF, -#ifdef FEAT_INS_EXPAND (char_u *)&p_pw, PV_NONE, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)15L, (char_u *)15L} SCTX_INIT}, {"pythonthreedll", NULL, P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, #if defined(DYNAMIC_PYTHON3) @@ -2796,11 +2770,7 @@ static struct vimoption options[] = (char_u *)&p_tw, PV_TW, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME, -#ifdef FEAT_INS_EXPAND (char_u *)&p_tsr, PV_TSR, -#else - (char_u *)NULL, PV_NONE, -#endif {(char_u *)"", (char_u *)0L} SCTX_INIT}, {"tildeop", "top", P_BOOL|P_VI_DEF|P_VIM, (char_u *)&p_to, PV_NONE, @@ -3248,11 +3218,9 @@ static char *(p_fdm_values[]) = {"manual NULL}; static char *(p_fcl_values[]) = {"all", NULL}; #endif -#ifdef FEAT_INS_EXPAND static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", "popup", "noinsert", "noselect", NULL}; -# ifdef BACKSLASH_IN_FILENAME +#ifdef BACKSLASH_IN_FILENAME static char *(p_csl_values[]) = {"slash", "backslash", NULL}; -# endif #endif #ifdef FEAT_SIGNS static char *(p_scl_values[]) = {"yes", "no", "auto", "number", NULL}; @@ -5794,9 +5762,7 @@ check_buf_options(buf_T *buf) #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) check_string_option(&buf->b_p_cinw); #endif -#ifdef FEAT_INS_EXPAND check_string_option(&buf->b_p_cpt); -#endif #ifdef FEAT_COMPL_FUNC check_string_option(&buf->b_p_cfu); check_string_option(&buf->b_p_ofu); @@ -5816,10 +5782,8 @@ check_buf_options(buf_T *buf) check_string_option(&buf->b_p_path); check_string_option(&buf->b_p_tags); check_string_option(&buf->b_p_tc); -#ifdef FEAT_INS_EXPAND check_string_option(&buf->b_p_dict); check_string_option(&buf->b_p_tsr); -#endif #ifdef FEAT_LISP check_string_option(&buf->b_p_lw); #endif @@ -7381,7 +7345,6 @@ did_set_string_option( } #endif -#ifdef FEAT_INS_EXPAND /* check if it is a valid value for 'complete' -- Acevedo */ else if (gvarp == &p_cpt) { @@ -7434,7 +7397,7 @@ did_set_string_option( completeopt_was_set(); } -# ifdef BACKSLASH_IN_FILENAME +#ifdef BACKSLASH_IN_FILENAME // 'completeslash' else if (gvarp == &p_csl) { @@ -7442,8 +7405,7 @@ did_set_string_option( || check_opt_strings(curbuf->b_p_csl, p_csl_values, FALSE) != OK) errmsg = e_invarg; } -# endif -#endif // FEAT_INS_EXPAND +#endif #ifdef FEAT_SIGNS // 'signcolumn' @@ -10959,14 +10921,12 @@ unset_global_local_option(char_u *name, clear_string_option(&buf->b_p_inc); break; #endif -#ifdef FEAT_INS_EXPAND case PV_DICT: clear_string_option(&buf->b_p_dict); break; case PV_TSR: clear_string_option(&buf->b_p_tsr); break; -#endif case PV_FP: clear_string_option(&buf->b_p_fp); break; @@ -11045,10 +11005,8 @@ get_varp_scope(struct vimoption *p, int case PV_DEF: return (char_u *)&(curbuf->b_p_def); case PV_INC: return (char_u *)&(curbuf->b_p_inc); #endif -#ifdef FEAT_INS_EXPAND case PV_DICT: return (char_u *)&(curbuf->b_p_dict); case PV_TSR: return (char_u *)&(curbuf->b_p_tsr); -#endif #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) case PV_BEXPR: return (char_u *)&(curbuf->b_p_bexpr); #endif @@ -11109,12 +11067,10 @@ get_varp(struct vimoption *p) case PV_INC: return *curbuf->b_p_inc != NUL ? (char_u *)&(curbuf->b_p_inc) : p->var; #endif -#ifdef FEAT_INS_EXPAND case PV_DICT: return *curbuf->b_p_dict != NUL ? (char_u *)&(curbuf->b_p_dict) : p->var; case PV_TSR: return *curbuf->b_p_tsr != NUL ? (char_u *)&(curbuf->b_p_tsr) : p->var; -#endif case PV_FP: return *curbuf->b_p_fp != NUL ? (char_u *)&(curbuf->b_p_fp) : p->var; #ifdef FEAT_QUICKFIX @@ -11229,11 +11185,9 @@ get_varp(struct vimoption *p) #ifdef FEAT_FOLDING case PV_CMS: return (char_u *)&(curbuf->b_p_cms); #endif -#ifdef FEAT_INS_EXPAND case PV_CPT: return (char_u *)&(curbuf->b_p_cpt); -# ifdef BACKSLASH_IN_FILENAME +#ifdef BACKSLASH_IN_FILENAME case PV_CSL: return (char_u *)&(curbuf->b_p_csl); -# endif #endif #ifdef FEAT_COMPL_FUNC case PV_CFU: return (char_u *)&(curbuf->b_p_cfu); @@ -11626,11 +11580,9 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_ml_nobin = p_ml_nobin; buf->b_p_inf = p_inf; buf->b_p_swf = cmdmod.noswapfile ? FALSE : p_swf; -#ifdef FEAT_INS_EXPAND buf->b_p_cpt = vim_strsave(p_cpt); -# ifdef BACKSLASH_IN_FILENAME +#ifdef BACKSLASH_IN_FILENAME buf->b_p_csl = vim_strsave(p_csl); -# endif #endif #ifdef FEAT_COMPL_FUNC buf->b_p_cfu = vim_strsave(p_cfu); @@ -11741,10 +11693,8 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_inex = vim_strsave(p_inex); # endif #endif -#ifdef FEAT_INS_EXPAND buf->b_p_dict = empty_option; buf->b_p_tsr = empty_option; -#endif #ifdef FEAT_TEXTOBJ buf->b_p_qe = vim_strsave(p_qe); #endif diff --git a/src/option.h b/src/option.h --- a/src/option.h +++ b/src/option.h @@ -410,14 +410,12 @@ EXTERN long p_ch; // 'cmdheight' EXTERN int p_confirm; // 'confirm' #endif EXTERN int p_cp; // 'compatible' -#ifdef FEAT_INS_EXPAND EXTERN char_u *p_cot; // 'completeopt' -# ifdef BACKSLASH_IN_FILENAME +#ifdef BACKSLASH_IN_FILENAME EXTERN char_u *p_csl; // 'completeslash' -# endif +#endif EXTERN long p_ph; // 'pumheight' EXTERN long p_pw; // 'pumwidth' -#endif EXTERN char_u *p_cpo; // 'cpoptions' #ifdef FEAT_CSCOPE EXTERN char_u *p_csprg; // 'cscopeprg' @@ -443,9 +441,7 @@ EXTERN char_u *p_dip; // 'diffopt' EXTERN char_u *p_dex; // 'diffexpr' # endif #endif -#ifdef FEAT_INS_EXPAND EXTERN char_u *p_dict; // 'dictionary' -#endif #ifdef FEAT_DIGRAPHS EXTERN int p_dg; // 'digraph' #endif @@ -849,9 +845,7 @@ EXTERN long p_titlelen; // 'titlelen' EXTERN char_u *p_titleold; // 'titleold' EXTERN char_u *p_titlestring; // 'titlestring' #endif -#ifdef FEAT_INS_EXPAND EXTERN char_u *p_tsr; // 'thesaurus' -#endif EXTERN int p_ttimeout; // 'ttimeout' EXTERN long p_ttm; // 'ttimeoutlen' EXTERN int p_tbi; // 'ttybuiltin' @@ -996,11 +990,9 @@ enum #ifdef FEAT_COMMENTS , BV_COM #endif -#ifdef FEAT_INS_EXPAND , BV_CPT , BV_DICT , BV_TSR -#endif #ifdef BACKSLASH_IN_FILENAME , BV_CSL #endif diff --git a/src/popupmnu.c b/src/popupmnu.c --- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -12,8 +12,6 @@ */ #include "vim.h" -#if defined(FEAT_INS_EXPAND) || defined(PROTO) - static pumitem_T *pum_array = NULL; /* items of displayed pum */ static int pum_size; /* nr of items in "pum_array" */ static int pum_selected; /* index of selected item or -1 */ @@ -902,11 +900,11 @@ pum_set_selected(int n, int repeat) } #endif } -# if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX) +#if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX) if (!has_info) // close any popup info window popup_close_preview(TRUE); -# endif +#endif if (!resized) pum_redraw(); @@ -924,7 +922,7 @@ pum_undisplay(void) redraw_all_later(NOT_VALID); redraw_tabline = TRUE; status_redraw_all(); -# if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX) +#if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX) // close any popup info window popup_close_preview(TRUE); #endif @@ -1013,7 +1011,7 @@ pum_set_event_info(dict_T *dict) dict_add_special(dict, "scrollbar", pum_scrollbar ? VVAL_TRUE : VVAL_FALSE); } -# if defined(FEAT_BEVAL_TERM) || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) +#if defined(FEAT_BEVAL_TERM) || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) static void pum_position_at_mouse(int min_width) { @@ -1051,14 +1049,14 @@ pum_position_at_mouse(int min_width) pum_window = NULL; } -# endif +#endif -# if defined(FEAT_BEVAL_TERM) || defined(PROTO) +#if defined(FEAT_BEVAL_TERM) || defined(PROTO) static pumitem_T *balloon_array = NULL; static int balloon_arraysize; -#define BALLOON_MIN_WIDTH 50 -#define BALLOON_MIN_HEIGHT 10 +# define BALLOON_MIN_WIDTH 50 +# define BALLOON_MIN_HEIGHT 10 typedef struct { char_u *start; @@ -1275,9 +1273,9 @@ ui_may_remove_balloon(void) // cell. ui_remove_balloon(); } -# endif +#endif -# if defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) +#if defined(FEAT_TERM_POPUP_MENU) || defined(PROTO) /* * Select the pum entry at the mouse position. */ @@ -1321,9 +1319,9 @@ pum_show_popupmenu(vimmenu_T *menu) vimmenu_T *mp; int idx = 0; pumitem_T *array; -#ifdef FEAT_BEVAL_TERM +# ifdef FEAT_BEVAL_TERM int save_bevalterm = p_bevalterm; -#endif +# endif int mode; pum_undisplay(); @@ -1361,10 +1359,10 @@ pum_show_popupmenu(vimmenu_T *menu) pum_selected = -1; pum_first = 0; -# ifdef FEAT_BEVAL_TERM +# ifdef FEAT_BEVAL_TERM p_bevalterm = TRUE; /* track mouse movement */ mch_setmouse(TRUE); -# endif +# endif for (;;) { @@ -1434,10 +1432,10 @@ pum_show_popupmenu(vimmenu_T *menu) vim_free(array); pum_undisplay(); -# ifdef FEAT_BEVAL_TERM +# ifdef FEAT_BEVAL_TERM p_bevalterm = save_bevalterm; mch_setmouse(TRUE); -# endif +# endif } void @@ -1457,6 +1455,4 @@ pum_make_popup(char_u *path_name, int us if (menu != NULL) pum_show_popupmenu(menu); } -# endif - #endif diff --git a/src/proto.h b/src/proto.h --- a/src/proto.h +++ b/src/proto.h @@ -94,9 +94,7 @@ extern int _stricoll(char *a, char *b); # include "hashtab.pro" # include "highlight.pro" # include "indent.pro" -# ifdef FEAT_INS_EXPAND # include "insexpand.pro" -# endif # include "json.pro" # include "list.pro" # include "blob.pro" diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -785,10 +785,8 @@ update_screen(int type_arg) #if defined(FEAT_SEARCH_EXTRA) end_search_hl(); #endif -#ifdef FEAT_INS_EXPAND /* May need to redraw the popup menu. */ pum_may_redraw(); -#endif /* Reset b_mod_set flags. Going through all windows is probably faster * than going through all buffers (there could be many buffers). */ @@ -6877,12 +6875,9 @@ win_redr_status(win_T *wp, int ignore_pu redraw_cmdline = TRUE; } else if (!redrawing() -#ifdef FEAT_INS_EXPAND // don't update status line when popup menu is visible and may be // drawn over it, unless it will be redrawn later - || (!ignore_pum && pum_visible()) -#endif - ) + || (!ignore_pum && pum_visible())) { /* Don't redraw right now, do it later. */ wp->w_redr_status = TRUE; @@ -7968,16 +7963,14 @@ screen_char(unsigned off, int row, int c if (row >= screen_Rows || col >= screen_Columns) return; -#ifdef FEAT_INS_EXPAND // Skip if under the popup menu. // Popup windows with zindex higher than POPUPMENU_ZINDEX go on top. if (pum_under_menu(row, col) -# ifdef FEAT_TEXT_PROP +#ifdef FEAT_TEXT_PROP && screen_zindex <= POPUPMENU_ZINDEX -# endif +#endif ) return; -#endif #ifdef FEAT_TEXT_PROP if (blocked_by_popup(row, col)) return; @@ -9953,9 +9946,7 @@ showmode(void) int do_mode; int attr; int nwr_save; -#ifdef FEAT_INS_EXPAND int sub_attr; -#endif do_mode = ((p_smd && msg_silent == 0) && ((State & INSERT) @@ -10010,7 +10001,6 @@ showmode(void) } } #endif -#ifdef FEAT_INS_EXPAND /* CTRL-X in Insert mode */ if (edit_submode != NULL && !shortmess(SHM_COMPLETIONMENU)) { @@ -10041,7 +10031,6 @@ showmode(void) } } else -#endif { if (State & VREPLACE_FLAG) msg_puts_attr(_(" VREPLACE"), attr); @@ -10106,10 +10095,7 @@ showmode(void) need_clear = TRUE; } if (reg_recording != 0 -#ifdef FEAT_INS_EXPAND - && edit_submode == NULL /* otherwise it gets too long */ -#endif - ) + && edit_submode == NULL) // otherwise it gets too long { recording_mode(attr); need_clear = TRUE; @@ -10566,14 +10552,12 @@ showruler(int always) { if (!always && !redrawing()) return; -#ifdef FEAT_INS_EXPAND if (pum_visible()) { /* Don't redraw right now, do it later. */ curwin->w_redr_status = TRUE; return; } -#endif #if defined(FEAT_STL_OPT) if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height) redraw_custom_statusline(curwin); @@ -10626,9 +10610,8 @@ win_redr_ruler(win_T *wp, int always, in if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count) return; -#ifdef FEAT_INS_EXPAND - /* Don't draw the ruler while doing insert-completion, it might overwrite - * the (long) mode message. */ + // Don't draw the ruler while doing insert-completion, it might overwrite + // the (long) mode message. if (wp == lastwin && lastwin->w_status_height == 0) if (edit_submode != NULL) return; @@ -10636,7 +10619,6 @@ win_redr_ruler(win_T *wp, int always, in // Except when the popup menu will be redrawn anyway. if (!ignore_pum && pum_visible()) return; -#endif #ifdef FEAT_STL_OPT if (*p_ruf) diff --git a/src/search.c b/src/search.c --- a/src/search.c +++ b/src/search.c @@ -399,10 +399,7 @@ ignorecase_opt(char_u *pat, int ic_in, i int ic = ic_in; if (ic && !no_smartcase && scs -#ifdef FEAT_INS_EXPAND - && !(ctrl_x_mode_not_default() && curbuf->b_p_inf) -#endif - ) + && !(ctrl_x_mode_not_default() && curbuf->b_p_inf)) ic = !pat_has_uppercase(pat); no_smartcase = FALSE; @@ -1614,7 +1611,6 @@ end_do_search: return retval; } -#if defined(FEAT_INS_EXPAND) || defined(PROTO) /* * search_for_exact_line(buf, pos, dir, pat) * @@ -1693,7 +1689,6 @@ search_for_exact_line( } return FAIL; } -#endif /* FEAT_INS_EXPAND */ /* * Character Searches @@ -5092,12 +5087,9 @@ find_pattern_in_path( return; if (type != CHECK_PATH && type != FIND_DEFINE -#ifdef FEAT_INS_EXPAND /* when CONT_SOL is set compare "ptr" with the beginning of the line * is faster than quote_meta/regcomp/regexec "ptr" -- Acevedo */ - && !(compl_cont_status & CONT_SOL) -#endif - ) + && !(compl_cont_status & CONT_SOL)) { pat = alloc(len + 5); if (pat == NULL) @@ -5323,7 +5315,6 @@ find_pattern_in_path( files[depth].name = curr_fname = new_fname; files[depth].lnum = 0; files[depth].matched = FALSE; -#ifdef FEAT_INS_EXPAND if (action == ACTION_EXPAND) { msg_hist_off = TRUE; /* reset in msg_trunc_attr() */ @@ -5332,9 +5323,7 @@ find_pattern_in_path( (char *)new_fname); msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R)); } - else -#endif - if (p_verbose >= 5) + else if (p_verbose >= 5) { verbose_enter(); smsg(_("Searching included file %s"), @@ -5373,11 +5362,7 @@ search_line: */ if (def_regmatch.regprog == NULL || define_matched) { - if (define_matched -#ifdef FEAT_INS_EXPAND - || (compl_cont_status & CONT_SOL) -#endif - ) + if (define_matched || (compl_cont_status & CONT_SOL)) { /* compare the first "len" chars from "ptr" */ startp = skipwhite(p); @@ -5442,7 +5427,6 @@ search_line: } if (matched) { -#ifdef FEAT_INS_EXPAND if (action == ACTION_EXPAND) { int cont_s_ipos = FALSE; @@ -5524,9 +5508,7 @@ search_line: else if (add_r == FAIL) break; } - else -#endif - if (action == ACTION_SHOW_ALL) + else if (action == ACTION_SHOW_ALL) { found = TRUE; if (!did_show) @@ -5638,29 +5620,21 @@ search_line: #endif break; } -#ifdef FEAT_INS_EXPAND exit_matched: -#endif matched = FALSE; /* look for other matches in the rest of the line if we * are not at the end of it already */ if (def_regmatch.regprog == NULL -#ifdef FEAT_INS_EXPAND && action == ACTION_EXPAND && !(compl_cont_status & CONT_SOL) -#endif && *startp != NUL && *(p = startp + MB_PTR2LEN(startp)) != NUL) goto search_line; } line_breakcheck(); -#ifdef FEAT_INS_EXPAND if (action == ACTION_EXPAND) ins_compl_check_keys(30, FALSE); if (got_int || ins_compl_interrupted()) -#else - if (got_int) -#endif break; /* @@ -5721,17 +5695,9 @@ exit_matched: msg(_("No included files")); } } - else if (!found -#ifdef FEAT_INS_EXPAND - && action != ACTION_EXPAND -#endif - ) + else if (!found && action != ACTION_EXPAND) { -#ifdef FEAT_INS_EXPAND if (got_int || ins_compl_interrupted()) -#else - if (got_int) -#endif emsg(_(e_interr)); else if (type == FIND_DEFINE) emsg(_("E388: Couldn't find definition")); diff --git a/src/spell.c b/src/spell.c --- a/src/spell.c +++ b/src/spell.c @@ -8763,7 +8763,6 @@ spell_to_word_end(char_u *start, win_T * return p; } -#if defined(FEAT_INS_EXPAND) || defined(PROTO) /* * For Insert mode completion CTRL-X s: * Find start of the word in front of column "startcol". @@ -8833,6 +8832,5 @@ expand_spelling( *matchp = ga.ga_data; return ga.ga_len; } -#endif #endif /* FEAT_SPELL */ diff --git a/src/structs.h b/src/structs.h --- a/src/structs.h +++ b/src/structs.h @@ -2278,10 +2278,8 @@ struct file_buffer varnumber_T b_last_changedtick; // b:changedtick when TextChanged or // TextChangedI was last triggered. -#ifdef FEAT_INS_EXPAND varnumber_T b_last_changedtick_pum; // b:changedtick when TextChangedP was // last triggered. -#endif int b_saving; // Set to TRUE if we are in the middle of // saving the buffer. @@ -2376,9 +2374,7 @@ struct file_buffer linenr_T b_u_line_lnum; // line number of line in u_line colnr_T b_u_line_colnr; // optional column number -#ifdef FEAT_INS_EXPAND int b_scanned; // ^N/^P have scanned this buffer -#endif // flags for use of ":lmap" and IM control long b_p_iminsert; // input mode for insert @@ -2436,9 +2432,7 @@ struct file_buffer #ifdef FEAT_FOLDING char_u *b_p_cms; // 'commentstring' #endif -#ifdef FEAT_INS_EXPAND char_u *b_p_cpt; // 'complete' -#endif #ifdef BACKSLASH_IN_FILENAME char_u *b_p_csl; // 'completeslash' #endif @@ -2545,10 +2539,8 @@ struct file_buffer char_u *b_p_tags; // 'tags' local value char_u *b_p_tc; // 'tagcase' local value unsigned b_tc_flags; // flags for 'tagcase' -#ifdef FEAT_INS_EXPAND char_u *b_p_dict; // 'dictionary' local value char_u *b_p_tsr; // 'thesaurus' local value -#endif long b_p_ul; // 'undolevels' local value #ifdef FEAT_PERSISTENT_UNDO int b_p_udf; // 'undofile' diff --git a/src/tag.c b/src/tag.c --- a/src/tag.c +++ b/src/tag.c @@ -1901,13 +1901,9 @@ find_tags( else #endif fast_breakcheck(); -#ifdef FEAT_INS_EXPAND if ((flags & TAG_INS_COMP)) /* Double brackets for gcc */ ins_compl_check_keys(30, FALSE); if (got_int || ins_compl_interrupted()) -#else - if (got_int) -#endif { stop_searching = TRUE; break; diff --git a/src/term.c b/src/term.c --- a/src/term.c +++ b/src/term.c @@ -3505,13 +3505,11 @@ set_shellsize(int width, int height, int else { update_topline(); -#if defined(FEAT_INS_EXPAND) if (pum_visible()) { redraw_later(NOT_VALID); ins_compl_show_pum(); } -#endif update_screen(NOT_VALID); if (redrawing()) setcursor(); diff --git a/src/userfunc.c b/src/userfunc.c --- a/src/userfunc.c +++ b/src/userfunc.c @@ -1614,9 +1614,7 @@ call_func( * redo buffer. */ save_search_patterns(); -#ifdef FEAT_INS_EXPAND if (!ins_compl_active()) -#endif { saveRedobuff(&save_redo); did_save_redo = TRUE; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -300,11 +300,7 @@ static char *(features[]) = #else "-iconv", #endif -#ifdef FEAT_INS_EXPAND "+insert_expand", -#else - "-insert_expand", -#endif #ifdef FEAT_JOB_CHANNEL "+job", #else @@ -766,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1901, +/**/ 1900, /**/ 1899, diff --git a/src/vim.h b/src/vim.h --- a/src/vim.h +++ b/src/vim.h @@ -848,9 +848,7 @@ extern int (*dyn_libintl_wputenv)(const #define ACTION_GOTO 2 #define ACTION_SPLIT 3 #define ACTION_SHOW_ALL 4 -#ifdef FEAT_INS_EXPAND -# define ACTION_EXPAND 5 -#endif +#define ACTION_EXPAND 5 #ifdef FEAT_SYN_HL # define SST_MIN_ENTRIES 150 /* minimal size for state stack array */