diff src/evalfunc.c @ 17652:9efb4dda9720

patch 8.1.1823: command line history code is spread out commit https://github.com/vim/vim/commit/d7663c22c6c1ff0f86b81371586fbc851d3a3e9e Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 6 21:59:57 2019 +0200 patch 8.1.1823: command line history code is spread out Problem: Command line history code is spread out. Solution: Put the code in a new file. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4779) Also graduate the +cmdline_hist feature.
author Bram Moolenaar <Bram@vim.org>
date Tue, 06 Aug 2019 22:00:08 +0200
parents 1687c8935ab6
children 1be29c149103
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -182,10 +182,6 @@ static void f_glob2regpat(typval_T *argv
 static void f_has(typval_T *argvars, typval_T *rettv);
 static void f_haslocaldir(typval_T *argvars, typval_T *rettv);
 static void f_hasmapto(typval_T *argvars, typval_T *rettv);
-static void f_histadd(typval_T *argvars, typval_T *rettv);
-static void f_histdel(typval_T *argvars, typval_T *rettv);
-static void f_histget(typval_T *argvars, typval_T *rettv);
-static void f_histnr(typval_T *argvars, typval_T *rettv);
 static void f_hlID(typval_T *argvars, typval_T *rettv);
 static void f_hlexists(typval_T *argvars, typval_T *rettv);
 static void f_hostname(typval_T *argvars, typval_T *rettv);
@@ -6114,9 +6110,7 @@ f_has(typval_T *argvars, typval_T *rettv
 #ifdef FEAT_CMDL_COMPL
 	"cmdline_compl",
 #endif
-#ifdef FEAT_CMDHIST
 	"cmdline_hist",
-#endif
 #ifdef FEAT_COMMENTS
 	"comments",
 #endif
@@ -6688,117 +6682,6 @@ f_hasmapto(typval_T *argvars, typval_T *
 }
 
 /*
- * "histadd()" function
- */
-    static void
-f_histadd(typval_T *argvars UNUSED, typval_T *rettv)
-{
-#ifdef FEAT_CMDHIST
-    int		histype;
-    char_u	*str;
-    char_u	buf[NUMBUFLEN];
-#endif
-
-    rettv->vval.v_number = FALSE;
-    if (check_secure())
-	return;
-#ifdef FEAT_CMDHIST
-    str = tv_get_string_chk(&argvars[0]);	/* NULL on type error */
-    histype = str != NULL ? get_histtype(str) : -1;
-    if (histype >= 0)
-    {
-	str = tv_get_string_buf(&argvars[1], buf);
-	if (*str != NUL)
-	{
-	    init_history();
-	    add_to_history(histype, str, FALSE, NUL);
-	    rettv->vval.v_number = TRUE;
-	    return;
-	}
-    }
-#endif
-}
-
-/*
- * "histdel()" function
- */
-    static void
-f_histdel(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
-{
-#ifdef FEAT_CMDHIST
-    int		n;
-    char_u	buf[NUMBUFLEN];
-    char_u	*str;
-
-    str = tv_get_string_chk(&argvars[0]);	/* NULL on type error */
-    if (str == NULL)
-	n = 0;
-    else if (argvars[1].v_type == VAR_UNKNOWN)
-	/* only one argument: clear entire history */
-	n = clr_history(get_histtype(str));
-    else if (argvars[1].v_type == VAR_NUMBER)
-	/* index given: remove that entry */
-	n = del_history_idx(get_histtype(str),
-					  (int)tv_get_number(&argvars[1]));
-    else
-	/* string given: remove all matching entries */
-	n = del_history_entry(get_histtype(str),
-				      tv_get_string_buf(&argvars[1], buf));
-    rettv->vval.v_number = n;
-#endif
-}
-
-/*
- * "histget()" function
- */
-    static void
-f_histget(typval_T *argvars UNUSED, typval_T *rettv)
-{
-#ifdef FEAT_CMDHIST
-    int		type;
-    int		idx;
-    char_u	*str;
-
-    str = tv_get_string_chk(&argvars[0]);	/* NULL on type error */
-    if (str == NULL)
-	rettv->vval.v_string = NULL;
-    else
-    {
-	type = get_histtype(str);
-	if (argvars[1].v_type == VAR_UNKNOWN)
-	    idx = get_history_idx(type);
-	else
-	    idx = (int)tv_get_number_chk(&argvars[1], NULL);
-						    /* -1 on type error */
-	rettv->vval.v_string = vim_strsave(get_history_entry(type, idx));
-    }
-#else
-    rettv->vval.v_string = NULL;
-#endif
-    rettv->v_type = VAR_STRING;
-}
-
-/*
- * "histnr()" function
- */
-    static void
-f_histnr(typval_T *argvars UNUSED, typval_T *rettv)
-{
-    int		i;
-
-#ifdef FEAT_CMDHIST
-    char_u	*history = tv_get_string_chk(&argvars[0]);
-
-    i = history == NULL ? HIST_CMD - 1 : get_histtype(history);
-    if (i >= HIST_CMD && i < HIST_COUNT)
-	i = get_history_idx(i);
-    else
-#endif
-	i = -1;
-    rettv->vval.v_number = i;
-}
-
-/*
  * "highlightID(name)" function
  */
     static void