aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/cmdexpand.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-15 06:40:49 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-01-15 07:59:45 +0800
commit064fdad98c6eed5f42b72eeeb3efe458fefb377d (patch)
treef5e7e5b7e0ec6e4e0a5da3b38f5d759ff06c0c54 /src/nvim/cmdexpand.c
parentf2056e4045a667447392f5e17c27b0f72ec7b8e0 (diff)
downloadrneovim-064fdad98c6eed5f42b72eeeb3efe458fefb377d.tar.gz
rneovim-064fdad98c6eed5f42b72eeeb3efe458fefb377d.tar.bz2
rneovim-064fdad98c6eed5f42b72eeeb3efe458fefb377d.zip
vim-patch:8.2.4570: no command line completion for :profile and :profdel
Problem: No command line completion for :profile and :profdel. Solution: Implement completion. (Yegappan Lakshmanan, closes vim/vim#9955) https://github.com/vim/vim/commit/1fdf84e033f8c4eead3b4ccebb1969cfbc7d10db Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/cmdexpand.c')
-rw-r--r--src/nvim/cmdexpand.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 9d00851336..ca19d6de95 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -1659,8 +1659,9 @@ static const char *set_context_in_lang_cmd(expand_T *xp, const char *arg)
}
static enum {
- EXP_BREAKPT_ADD, // expand ":breakadd" sub-commands
- EXP_BREAKPT_DEL, // expand ":breakdel" sub-commands
+ EXP_BREAKPT_ADD, ///< expand ":breakadd" sub-commands
+ EXP_BREAKPT_DEL, ///< expand ":breakdel" sub-commands
+ EXP_PROFDEL, ///< expand ":profdel" sub-commands
} breakpt_expand_what;
/// Set the completion context for the :breakadd command. Always returns NULL.
@@ -1671,8 +1672,10 @@ static const char *set_context_in_breakadd_cmd(expand_T *xp, const char *arg, cm
if (cmdidx == CMD_breakadd) {
breakpt_expand_what = EXP_BREAKPT_ADD;
- } else {
+ } else if (cmdidx == CMD_breakdel) {
breakpt_expand_what = EXP_BREAKPT_DEL;
+ } else {
+ breakpt_expand_what = EXP_PROFDEL;
}
const char *p = skipwhite(arg);
@@ -1681,8 +1684,7 @@ static const char *set_context_in_breakadd_cmd(expand_T *xp, const char *arg, cm
}
const char *subcmd_start = p;
- if (strncmp("file ", p, 5) == 0
- || strncmp("func ", p, 5) == 0) {
+ if (strncmp("file ", p, 5) == 0 || strncmp("func ", p, 5) == 0) {
// :breakadd file [lnum] <filename>
// :breakadd func [lnum] <funcname>
p += 4;
@@ -2067,6 +2069,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
break;
case CMD_breakadd:
+ case CMD_profdel:
case CMD_breakdel:
return set_context_in_breakadd_cmd(xp, arg, cmdidx);
@@ -2424,12 +2427,19 @@ static char *get_breakadd_arg(expand_T *xp FUNC_ATTR_UNUSED, int idx)
char *opts[] = { "expr", "file", "func", "here" };
if (idx >= 0 && idx <= 3) {
+ // breakadd {expr, file, func, here}
if (breakpt_expand_what == EXP_BREAKPT_ADD) {
return opts[idx];
- } else {
+ } else if (breakpt_expand_what == EXP_BREAKPT_DEL) {
+ // breakdel {func, file, here}
if (idx <= 2) {
return opts[idx + 1];
}
+ } else {
+ // profdel {func, file}
+ if (idx <= 1) {
+ return opts[idx + 1];
+ }
}
}
return NULL;