comparison src/evalvars.c @ 27338:c62006deb5c1 v8.2.4197

patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest' Commit: https://github.com/vim/vim/commit/2a7aa834583dea157eccf3e69827d2ff1d9fe9c7 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 23 17:59:06 2022 +0000 patch 8.2.4197: cannot use an import in the "expr" part of 'spellsuggest' Problem: Cannot use an import in the "expr" part of 'spellsuggest'. Solution: Set the script context when evaluating "expr" of 'spellsuggest'.
author Bram Moolenaar <Bram@vim.org>
date Sun, 23 Jan 2022 19:00:02 +0100
parents aeadf4315bef
children 2ca6dd1f62af
comparison
equal deleted inserted replaced
27337:65bdfff0b00a 27338:c62006deb5c1
493 { 493 {
494 typval_T save_val; 494 typval_T save_val;
495 typval_T rettv; 495 typval_T rettv;
496 list_T *list = NULL; 496 list_T *list = NULL;
497 char_u *p = skipwhite(expr); 497 char_u *p = skipwhite(expr);
498 sctx_T saved_sctx = current_sctx;
499 sctx_T *ctx;
498 500
499 // Set "v:val" to the bad word. 501 // Set "v:val" to the bad word.
500 prepare_vimvar(VV_VAL, &save_val); 502 prepare_vimvar(VV_VAL, &save_val);
501 set_vim_var_string(VV_VAL, badword, -1); 503 set_vim_var_string(VV_VAL, badword, -1);
502 if (p_verbose == 0) 504 if (p_verbose == 0)
503 ++emsg_off; 505 ++emsg_off;
506 ctx = get_option_sctx("spellsuggest");
507 if (ctx != NULL)
508 current_sctx = *ctx;
504 509
505 if (eval1(&p, &rettv, &EVALARG_EVALUATE) == OK) 510 if (eval1(&p, &rettv, &EVALARG_EVALUATE) == OK)
506 { 511 {
507 if (rettv.v_type != VAR_LIST) 512 if (rettv.v_type != VAR_LIST)
508 clear_tv(&rettv); 513 clear_tv(&rettv);
512 517
513 if (p_verbose == 0) 518 if (p_verbose == 0)
514 --emsg_off; 519 --emsg_off;
515 clear_tv(get_vim_var_tv(VV_VAL)); 520 clear_tv(get_vim_var_tv(VV_VAL));
516 restore_vimvar(VV_VAL, &save_val); 521 restore_vimvar(VV_VAL, &save_val);
522 current_sctx = saved_sctx;
517 523
518 return list; 524 return list;
519 } 525 }
520 526
521 /* 527 /*