patch 9.1.0770: current command line completion is a bit limited

Problem:  current command completion is a bit limited
Solution: Add the shellcmdline completion type and getmdcomplpat()
          function (Ruslan Russkikh).

closes: #15823

Signed-off-by: Ruslan Russkikh <dvrussk@yandex.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 980faf8..b7804d1 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4205,6 +4205,40 @@
 }
 
 /*
+ * Get the current command-line completion pattern.
+ */
+    static char_u *
+get_cmdline_completion_pattern(void)
+{
+    cmdline_info_T *p;
+    int		xp_context;
+
+    if (cmdline_star > 0)
+	return NULL;
+
+    p = get_ccline_ptr();
+    if (p == NULL || p->xpc == NULL)
+	return NULL;
+
+    xp_context = p->xpc->xp_context;
+    if (xp_context == EXPAND_NOTHING)
+    {
+	set_expand_context(p->xpc);
+	xp_context = p->xpc->xp_context;
+	p->xpc->xp_context = EXPAND_NOTHING;
+    }
+    if (xp_context == EXPAND_UNSUCCESSFUL)
+	return NULL;
+
+    char_u *compl_pat = p->xpc->xp_pattern;
+
+    if (compl_pat == NULL)
+	return NULL;
+
+    return vim_strsave(compl_pat);
+}
+
+/*
  * Get the current command-line completion type.
  */
     static char_u *
@@ -4248,6 +4282,16 @@
 }
 
 /*
+ * "getcmdcomplpat()" function
+ */
+    void
+f_getcmdcomplpat(typval_T *argvars UNUSED, typval_T *rettv)
+{
+    rettv->v_type = VAR_STRING;
+    rettv->vval.v_string = get_cmdline_completion_pattern();
+}
+
+/*
  * "getcmdcompltype()" function
  */
     void