comparison src/evalfunc.c @ 17704:73a93aae5f68 v8.1.1849

patch 8.1.1849 commit https://github.com/vim/vim/commit/9bca58f36d1f6a2ac0e4022caa5f355d39357a05 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 15 21:31:52 2019 +0200 patch 8.1.1849
author Bram Moolenaar <Bram@vim.org>
date Thu, 15 Aug 2019 21:45:04 +0200
parents 55704f587945
children 68ea27d26d5b
comparison
equal deleted inserted replaced
17703:6d74651e8dca 17704:73a93aae5f68
73 static void f_changenr(typval_T *argvars, typval_T *rettv); 73 static void f_changenr(typval_T *argvars, typval_T *rettv);
74 static void f_char2nr(typval_T *argvars, typval_T *rettv); 74 static void f_char2nr(typval_T *argvars, typval_T *rettv);
75 static void f_chdir(typval_T *argvars, typval_T *rettv); 75 static void f_chdir(typval_T *argvars, typval_T *rettv);
76 static void f_cindent(typval_T *argvars, typval_T *rettv); 76 static void f_cindent(typval_T *argvars, typval_T *rettv);
77 static void f_col(typval_T *argvars, typval_T *rettv); 77 static void f_col(typval_T *argvars, typval_T *rettv);
78 #if defined(FEAT_INS_EXPAND)
79 static void f_complete(typval_T *argvars, typval_T *rettv);
80 static void f_complete_add(typval_T *argvars, typval_T *rettv);
81 static void f_complete_check(typval_T *argvars, typval_T *rettv);
82 static void f_complete_info(typval_T *argvars, typval_T *rettv);
83 #endif
84 static void f_confirm(typval_T *argvars, typval_T *rettv); 78 static void f_confirm(typval_T *argvars, typval_T *rettv);
85 static void f_copy(typval_T *argvars, typval_T *rettv); 79 static void f_copy(typval_T *argvars, typval_T *rettv);
86 #ifdef FEAT_FLOAT 80 #ifdef FEAT_FLOAT
87 static void f_cos(typval_T *argvars, typval_T *rettv); 81 static void f_cos(typval_T *argvars, typval_T *rettv);
88 static void f_cosh(typval_T *argvars, typval_T *rettv); 82 static void f_cosh(typval_T *argvars, typval_T *rettv);
2292 } 2286 }
2293 } 2287 }
2294 rettv->vval.v_number = col; 2288 rettv->vval.v_number = col;
2295 } 2289 }
2296 2290
2297 #if defined(FEAT_INS_EXPAND)
2298 /*
2299 * "complete()" function
2300 */
2301 static void
2302 f_complete(typval_T *argvars, typval_T *rettv UNUSED)
2303 {
2304 int startcol;
2305
2306 if ((State & INSERT) == 0)
2307 {
2308 emsg(_("E785: complete() can only be used in Insert mode"));
2309 return;
2310 }
2311
2312 /* Check for undo allowed here, because if something was already inserted
2313 * the line was already saved for undo and this check isn't done. */
2314 if (!undo_allowed())
2315 return;
2316
2317 if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL)
2318 {
2319 emsg(_(e_invarg));
2320 return;
2321 }
2322
2323 startcol = (int)tv_get_number_chk(&argvars[0], NULL);
2324 if (startcol <= 0)
2325 return;
2326
2327 set_completion(startcol - 1, argvars[1].vval.v_list);
2328 }
2329
2330 /*
2331 * "complete_add()" function
2332 */
2333 static void
2334 f_complete_add(typval_T *argvars, typval_T *rettv)
2335 {
2336 rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0);
2337 }
2338
2339 /*
2340 * "complete_check()" function
2341 */
2342 static void
2343 f_complete_check(typval_T *argvars UNUSED, typval_T *rettv)
2344 {
2345 int saved = RedrawingDisabled;
2346
2347 RedrawingDisabled = 0;
2348 ins_compl_check_keys(0, TRUE);
2349 rettv->vval.v_number = ins_compl_interrupted();
2350 RedrawingDisabled = saved;
2351 }
2352
2353 /*
2354 * "complete_info()" function
2355 */
2356 static void
2357 f_complete_info(typval_T *argvars, typval_T *rettv)
2358 {
2359 list_T *what_list = NULL;
2360
2361 if (rettv_dict_alloc(rettv) != OK)
2362 return;
2363
2364 if (argvars[0].v_type != VAR_UNKNOWN)
2365 {
2366 if (argvars[0].v_type != VAR_LIST)
2367 {
2368 emsg(_(e_listreq));
2369 return;
2370 }
2371 what_list = argvars[0].vval.v_list;
2372 }
2373 get_complete_info(what_list, rettv->vval.v_dict);
2374 }
2375 #endif
2376
2377 /* 2291 /*
2378 * "confirm(message, buttons[, default [, type]])" function 2292 * "confirm(message, buttons[, default [, type]])" function
2379 */ 2293 */
2380 static void 2294 static void
2381 f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED) 2295 f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED)