comparison src/edit.c @ 648:9032e4668296 v7.0189

updated for version 7.0189
author vimboss
date Mon, 30 Jan 2006 00:14:18 +0000
parents e4fa26ce8769
children b112ec5c73f0
comparison
equal deleted inserted replaced
647:19106f131c87 648:9032e4668296
109 static int has_compl_option __ARGS((int dict_opt)); 109 static int has_compl_option __ARGS((int dict_opt));
110 static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int dir)); 110 static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int dir));
111 static int ins_compl_make_cyclic __ARGS((void)); 111 static int ins_compl_make_cyclic __ARGS((void));
112 static void ins_compl_upd_pum __ARGS((void)); 112 static void ins_compl_upd_pum __ARGS((void));
113 static void ins_compl_del_pum __ARGS((void)); 113 static void ins_compl_del_pum __ARGS((void));
114 static int pum_wanted __ARGS((void)); 114 static int pum_wanted __ARGS((void));
115 static void ins_compl_show_pum __ARGS((void));
116 static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int dir, int flags, int thesaurus)); 115 static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int dir, int flags, int thesaurus));
117 static void ins_compl_free __ARGS((void)); 116 static void ins_compl_free __ARGS((void));
118 static void ins_compl_clear __ARGS((void)); 117 static void ins_compl_clear __ARGS((void));
119 static int ins_compl_prep __ARGS((int c)); 118 static int ins_compl_prep __ARGS((int c));
120 static buf_T *ins_compl_next_buf __ARGS((buf_T *buf, int flag)); 119 static buf_T *ins_compl_next_buf __ARGS((buf_T *buf, int flag));
2191 } 2190 }
2192 2191
2193 /* 2192 /*
2194 * Show the popup menu for the list of matches. 2193 * Show the popup menu for the list of matches.
2195 */ 2194 */
2196 static void 2195 void
2197 ins_compl_show_pum() 2196 ins_compl_show_pum()
2198 { 2197 {
2199 compl_T *compl; 2198 compl_T *compl;
2200 int i; 2199 int i;
2201 int cur = -1; 2200 int cur = -1;
2264 curwin->w_cursor.col = compl_col; 2263 curwin->w_cursor.col = compl_col;
2265 validate_cursor_col(); 2264 validate_cursor_col();
2266 pum_display(compl_match_array, compl_match_arraysize, cur, 2265 pum_display(compl_match_array, compl_match_arraysize, cur,
2267 curwin->w_cline_row + W_WINROW(curwin), 2266 curwin->w_cline_row + W_WINROW(curwin),
2268 curwin->w_cline_height, 2267 curwin->w_cline_height,
2269 curwin->w_wcol + W_WINCOL(curwin)); 2268 curwin->w_wcol + W_WINCOL(curwin) - curwin->w_leftcol);
2270 curwin->w_cursor.col = col; 2269 curwin->w_cursor.col = col;
2271 } 2270 }
2272 } 2271 }
2273 2272
2274 #define DICT_FIRST (1) /* use just first element in "dict" */ 2273 #define DICT_FIRST (1) /* use just first element in "dict" */
2275 #define DICT_EXACT (2) /* "dict" is the exact name of a file */ 2274 #define DICT_EXACT (2) /* "dict" is the exact name of a file */
2275
2276 /* 2276 /*
2277 * Add any identifiers that match the given pattern to the list of 2277 * Add any identifiers that match the given pattern to the list of
2278 * completions. 2278 * completions.
2279 */ 2279 */
2280 static void 2280 static void
2840 if (ga_grow(&ga, 1) == FAIL) 2840 if (ga_grow(&ga, 1) == FAIL)
2841 break; 2841 break;
2842 ((char_u **)ga.ga_data)[ga.ga_len] = vim_strsave(p); 2842 ((char_u **)ga.ga_data)[ga.ga_len] = vim_strsave(p);
2843 ++ga.ga_len; 2843 ++ga.ga_len;
2844 } 2844 }
2845 else if (did_emsg)
2846 break;
2845 } 2847 }
2846 2848
2847 list_unref(matchlist); 2849 list_unref(matchlist);
2848 *matches = (char_u **)ga.ga_data; 2850 *matches = (char_u **)ga.ga_data;
2849 return ga.ga_len; 2851 return ga.ga_len;
3365 if (!allow_get_expansion) 3367 if (!allow_get_expansion)
3366 { 3368 {
3367 /* may undisplay the popup menu first */ 3369 /* may undisplay the popup menu first */
3368 ins_compl_upd_pum(); 3370 ins_compl_upd_pum();
3369 3371
3370 /* Display the current match. */
3371 update_screen(0);
3372
3373 /* display the updated popup menu */ 3372 /* display the updated popup menu */
3374 ins_compl_show_pum(); 3373 ins_compl_show_pum();
3375 3374
3376 /* Delete old text to be replaced, since we're still searching and 3375 /* Delete old text to be replaced, since we're still searching and
3377 * don't want to match ourselves! */ 3376 * don't want to match ourselves! */
7214 /* 7213 /*
7215 * Handle deleting one 'shiftwidth' or 'softtabstop'. 7214 * Handle deleting one 'shiftwidth' or 'softtabstop'.
7216 */ 7215 */
7217 if ( mode == BACKSPACE_CHAR 7216 if ( mode == BACKSPACE_CHAR
7218 && ((p_sta && in_indent) 7217 && ((p_sta && in_indent)
7219 || (curbuf->b_p_sts 7218 || (curbuf->b_p_sts != 0
7220 && (*(ml_get_cursor() - 1) == TAB 7219 && (*(ml_get_cursor() - 1) == TAB
7221 || (*(ml_get_cursor() - 1) == ' ' 7220 || (*(ml_get_cursor() - 1) == ' '
7222 && (!*inserted_space_p 7221 && (!*inserted_space_p
7223 || arrow_used)))))) 7222 || arrow_used))))))
7224 { 7223 {
7226 colnr_T vcol; 7225 colnr_T vcol;
7227 colnr_T want_vcol; 7226 colnr_T want_vcol;
7228 int extra = 0; 7227 int extra = 0;
7229 7228
7230 *inserted_space_p = FALSE; 7229 *inserted_space_p = FALSE;
7231 if (p_sta) 7230 if (p_sta && in_indent)
7232 ts = curbuf->b_p_sw; 7231 ts = curbuf->b_p_sw;
7233 else 7232 else
7234 ts = curbuf->b_p_sts; 7233 ts = curbuf->b_p_sts;
7235 /* Compute the virtual column where we want to be. Since 7234 /* Compute the virtual column where we want to be. Since
7236 * 'showbreak' may get in the way, need to get the last column of 7235 * 'showbreak' may get in the way, need to get the last column of