summaryrefslogtreecommitdiff
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-02-03 15:14:22 +0100
committerBram Moolenaar <Bram@vim.org>2010-02-03 15:14:22 +0100
commitf86f26c06a397b634a7c919a363c028c04f794f4 (patch)
tree4f5c4891c2e65ab55ae3fd73859d0ab38902cf05 /src/ex_cmds2.c
parent4d526ad35aae3e637aa3fd9f5042196120e456a2 (diff)
downloadvim-git-f86f26c06a397b634a7c919a363c028c04f794f4.tar.gz
updated for version 7.2.353v7.2.353
Problem: No command line completion for ":profile". Solution: Complete the subcommand and file name.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 81feac835..94c1f74b6 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1115,6 +1115,79 @@ ex_profile(eap)
}
}
+/* Command line expansion for :profile. */
+static enum
+{
+ PEXP_SUBCMD, /* expand :profile sub-commands */
+ PEXP_FUNC, /* expand :profile func {funcname} */
+} pexpand_what;
+
+static char *pexpand_cmds[] = {
+ "start",
+#define PROFCMD_START 0
+ "pause",
+#define PROFCMD_PAUSE 1
+ "continue",
+#define PROFCMD_CONTINUE 2
+ "func",
+#define PROFCMD_FUNC 3
+ "file",
+#define PROFCMD_FILE 4
+ NULL
+#define PROFCMD_LAST 5
+};
+
+/*
+ * Function given to ExpandGeneric() to obtain the profile command
+ * specific expansion.
+ */
+ char_u *
+get_profile_name(xp, idx)
+ expand_T *xp UNUSED;
+ int idx;
+{
+ switch (pexpand_what)
+ {
+ case PEXP_SUBCMD:
+ return (char_u *)pexpand_cmds[idx];
+ /* case PEXP_FUNC: TODO */
+ default:
+ return NULL;
+ }
+}
+
+/*
+ * Handle command line completion for :profile command.
+ */
+ void
+set_context_in_profile_cmd(xp, arg)
+ expand_T *xp;
+ char_u *arg;
+{
+ char_u *end_subcmd;
+ int len;
+
+ /* Default: expand subcommands. */
+ xp->xp_context = EXPAND_PROFILE;
+ pexpand_what = PEXP_SUBCMD;
+ xp->xp_pattern = arg;
+
+ end_subcmd = skiptowhite(arg);
+ if (*end_subcmd == NUL)
+ return;
+
+ len = end_subcmd - arg;
+ if (len == 5 && STRNCMP(arg, "start", 5) == 0)
+ {
+ xp->xp_context = EXPAND_FILES;
+ xp->xp_pattern = skipwhite(end_subcmd);
+ return;
+ }
+
+ /* TODO: expand function names after "func" */
+ xp->xp_context = EXPAND_NOTHING;
+}
+
/*
* Dump the profiling info.
*/