diff src/evalfunc.c @ 29894:d8fc1effa724 v9.0.0285

patch 9.0.0285: it is not easy to change the command line from a plugin Commit: https://github.com/vim/vim/commit/07ea5f1509fe8dafe3262ed2702b4d0fc99e288b Author: Shougo Matsushita <Shougo.Matsu@gmail.com> Date: Sat Aug 27 12:22:25 2022 +0100 patch 9.0.0285: it is not easy to change the command line from a plugin Problem: It is not easy to change the command line from a plugin. Solution: Add setcmdline(). (Shougo Matsushita, closes https://github.com/vim/vim/issues/10869)
author Bram Moolenaar <Bram@vim.org>
date Sat, 27 Aug 2022 13:30:04 +0200
parents a63d3a0e9aba
children 34151eb6ae25
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2369,6 +2369,8 @@ static funcentry_T global_functions[] =
 			ret_number_bool,    f_setcharpos},
     {"setcharsearch",	1, 1, FEARG_1,	    arg1_dict_any,
 			ret_void,	    f_setcharsearch},
+    {"setcmdline",	1, 2, FEARG_1,	    arg2_string_number,
+			ret_number_bool,    f_setcmdline},
     {"setcmdpos",	1, 1, FEARG_1,	    arg1_number,
 			ret_number_bool,    f_setcmdpos},
     {"setcursorcharpos", 1, 3, FEARG_1,	    arg13_cursor,
@@ -3607,7 +3609,6 @@ f_debugbreak(typval_T *argvars, typval_T
 f_deepcopy(typval_T *argvars, typval_T *rettv)
 {
     varnumber_T	noref = 0;
-    int		copyID;
 
     if (in_vim9script()
 	    && (check_for_opt_bool_arg(argvars, 1) == FAIL))
@@ -3618,10 +3619,8 @@ f_deepcopy(typval_T *argvars, typval_T *
     if (noref < 0 || noref > 1)
 	semsg(_(e_using_number_as_bool_nr), noref);
     else
-    {
-	copyID = get_copyID();
-	item_copy(&argvars[0], rettv, TRUE, TRUE, noref == 0 ? copyID : 0);
-    }
+	item_copy(&argvars[0], rettv, TRUE, TRUE,
+						noref == 0 ? get_copyID() : 0);
 }
 
 /*