diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-03-14 07:42:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2025-03-27 07:26:42 +0800 |
commit | e39cdafed96813567128c931a6b784b6858dcc13 (patch) | |
tree | 94e60e20ce3f0767d80d70cec9b180e30d0d4c5c /src | |
parent | 5975ddbdb85073ce055a24915de7f6960e201dc4 (diff) | |
download | rneovim-e39cdafed96813567128c931a6b784b6858dcc13.tar.gz rneovim-e39cdafed96813567128c931a6b784b6858dcc13.tar.bz2 rneovim-e39cdafed96813567128c931a6b784b6858dcc13.zip |
vim-patch:9.1.1201: 'completefuzzycollect' does not handle dictionary correctly
Problem: 'completefuzzycollect' does not handle dictionary correctly
Solution: check for ctrl_x_mode_dictionary (glepnir)
closes: vim/vim#16867
https://github.com/vim/vim/commit/587601671cd06ddc4d78f907d98578cdab96003f
Cherry-pick a documentation fix from later.
Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/insexpand.c | 11 | ||||
-rw-r--r-- | src/nvim/options.lua | 17 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 47238468db..422eb409fe 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -792,14 +792,13 @@ int ins_compl_add_infercase(char *str_arg, int len, bool icase, char *fname, Dir /// Check if ctrl_x_mode has been configured in 'completefuzzycollect' static bool cfc_has_mode(void) { - switch (ctrl_x_mode) { - case CTRL_X_NORMAL: + if (ctrl_x_mode_normal() || ctrl_x_mode_dictionary()) { return (cfc_flags & kOptCfcFlagKeyword) != 0; - case CTRL_X_FILES: + } else if (ctrl_x_mode_files()) { return (cfc_flags & kOptCfcFlagFiles) != 0; - case CTRL_X_WHOLE_LINE: + } else if (ctrl_x_mode_whole_line()) { return (cfc_flags & kOptCfcFlagWholeLine) != 0; - default: + } else { return false; } } @@ -1670,7 +1669,7 @@ static void ins_compl_files(int count, char **files, bool thesaurus, int flags, regmatch_T *regmatch, char *buf, Direction *dir) FUNC_ATTR_NONNULL_ARG(2, 7) { - bool in_fuzzy_collect = cfc_has_mode() && ctrl_x_mode_normal(); + bool in_fuzzy_collect = cfc_has_mode(); char *leader = in_fuzzy_collect ? ins_compl_leader() : NULL; int leader_len = in_fuzzy_collect ? (int)ins_compl_leader_len() : 0; diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 96548580ba..f566582c0c 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -1472,17 +1472,18 @@ local options = { find completion candidates instead of the standard prefix-based matching. This option can contain the following values: - keyword keywords in the current file |i_CTRL-X_CTRL-N| - keywords with the ".", "w", "b", "u", "U" and - "k{dict}" flags in 'complete'. |i_CTRL-N| |i_CTRL-P| + keyword keywords in the current file |i_CTRL-X_CTRL-N| + keywords with flags ".", "w", |i_CTRL-N| |i_CTRL-P| + "b", "u", "U" and "k{dict}" in 'complete' + keywords in 'dictionary' |i_CTRL-X_CTRL-K| - files file names |i_CTRL-X_CTRL-F| + files file names |i_CTRL-X_CTRL-F| - whole_line whole lines |i_CTRL-X_CTRL-L| + whole_line whole lines |i_CTRL-X_CTRL-L| - When used with 'completeopt' "longest" option, fuzzy collection can - identify the longest common string among the best fuzzy matches and - automatically insert it. + When using the 'completeopt' "longest" option value, fuzzy collection + can identify the longest common string among the best fuzzy matches + and insert it automatically. ]=], full_name = 'completefuzzycollect', list = 'onecomma', |