Mercurial > vim
comparison src/insexpand.c @ 17809:59f8948b7590 v8.1.1901
patch 8.1.1901: the +insert_expand feature is not always available
Commit: https://github.com/vim/vim/commit/e2c453d38f6512ac4cff7cd26aa7780b4e2534d7
Author: Bram Moolenaar <Bram@vim.org>
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 21 Aug 2019 14:45:04 +0200 |
parents | b423bd231f33 |
children | 8ca20b0a3dc3 |
comparison
equal
deleted
inserted
replaced
17808:42561b61bfd8 | 17809:59f8948b7590 |
---|---|
11 * insexpand.c: functions for Insert mode completion | 11 * insexpand.c: functions for Insert mode completion |
12 */ | 12 */ |
13 | 13 |
14 #include "vim.h" | 14 #include "vim.h" |
15 | 15 |
16 #ifdef FEAT_INS_EXPAND | |
17 /* | 16 /* |
18 * Definitions used for CTRL-X submode. | 17 * Definitions used for CTRL-X submode. |
19 * Note: If you change CTRL-X submode, you must also maintain ctrl_x_msgs[] and | 18 * Note: If you change CTRL-X submode, you must also maintain ctrl_x_msgs[] and |
20 * ctrl_x_mode_names[] below. | 19 * ctrl_x_mode_names[] below. |
21 */ | 20 */ |
207 static int ins_compl_key2dir(int c); | 206 static int ins_compl_key2dir(int c); |
208 static int ins_compl_pum_key(int c); | 207 static int ins_compl_pum_key(int c); |
209 static int ins_compl_key2count(int c); | 208 static int ins_compl_key2count(int c); |
210 static void show_pum(int prev_w_wrow, int prev_w_leftcol); | 209 static void show_pum(int prev_w_wrow, int prev_w_leftcol); |
211 static unsigned quote_meta(char_u *dest, char_u *str, int len); | 210 static unsigned quote_meta(char_u *dest, char_u *str, int len); |
212 #endif // FEAT_INS_EXPAND | |
213 | 211 |
214 #ifdef FEAT_SPELL | 212 #ifdef FEAT_SPELL |
215 static void spell_back_to_badword(void); | 213 static void spell_back_to_badword(void); |
216 static int spell_bad_len = 0; // length of located bad word | 214 static int spell_bad_len = 0; // length of located bad word |
217 #endif | 215 #endif |
218 | 216 |
219 #if defined(FEAT_INS_EXPAND) || defined(PROTO) | |
220 /* | 217 /* |
221 * CTRL-X pressed in Insert mode. | 218 * CTRL-X pressed in Insert mode. |
222 */ | 219 */ |
223 void | 220 void |
224 ins_ctrl_x(void) | 221 ins_ctrl_x(void) |
286 */ | 283 */ |
287 int | 284 int |
288 has_compl_option(int dict_opt) | 285 has_compl_option(int dict_opt) |
289 { | 286 { |
290 if (dict_opt ? (*curbuf->b_p_dict == NUL && *p_dict == NUL | 287 if (dict_opt ? (*curbuf->b_p_dict == NUL && *p_dict == NUL |
291 # ifdef FEAT_SPELL | 288 #ifdef FEAT_SPELL |
292 && !curwin->w_p_spell | 289 && !curwin->w_p_spell |
293 # endif | 290 #endif |
294 ) | 291 ) |
295 : (*curbuf->b_p_tsr == NUL && *p_tsr == NUL)) | 292 : (*curbuf->b_p_tsr == NUL && *p_tsr == NUL)) |
296 { | 293 { |
297 ctrl_x_mode = CTRL_X_NORMAL; | 294 ctrl_x_mode = CTRL_X_NORMAL; |
298 edit_submode = NULL; | 295 edit_submode = NULL; |
4152 *dest = NUL; | 4149 *dest = NUL; |
4153 | 4150 |
4154 return m; | 4151 return m; |
4155 } | 4152 } |
4156 | 4153 |
4157 # if defined(EXITFREE) || defined(PROTO) | 4154 #if defined(EXITFREE) || defined(PROTO) |
4158 void | 4155 void |
4159 free_insexpand_stuff(void) | 4156 free_insexpand_stuff(void) |
4160 { | 4157 { |
4161 VIM_CLEAR(compl_orig_text); | 4158 VIM_CLEAR(compl_orig_text); |
4162 } | 4159 } |
4163 # endif | 4160 #endif |
4164 | 4161 |
4165 # ifdef FEAT_SPELL | 4162 #ifdef FEAT_SPELL |
4166 /* | 4163 /* |
4167 * Called when starting CTRL_X_SPELL mode: Move backwards to a previous badly | 4164 * Called when starting CTRL_X_SPELL mode: Move backwards to a previous badly |
4168 * spelled word, if there is one. | 4165 * spelled word, if there is one. |
4169 */ | 4166 */ |
4170 static void | 4167 static void |
4174 | 4171 |
4175 spell_bad_len = spell_move_to(curwin, BACKWARD, TRUE, TRUE, NULL); | 4172 spell_bad_len = spell_move_to(curwin, BACKWARD, TRUE, TRUE, NULL); |
4176 if (curwin->w_cursor.col != tpos.col) | 4173 if (curwin->w_cursor.col != tpos.col) |
4177 start_arrow(&tpos); | 4174 start_arrow(&tpos); |
4178 } | 4175 } |
4179 # endif | 4176 #endif |
4180 | |
4181 #endif // FEAT_INS_EXPAND |