mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
vim-patch:9.1.1161: preinsert requires bot "menu" and "menuone" to be set
Problem: preinsert requires bot "menu" and "menuone" to be set,
but "menu" is redundant (after v9.1.1160)
Solution: preinsert only requires menuone (glepnir)
closes: vim/vim#16763
94a045ed56
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -1574,9 +1574,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
preinsert
|
||||
Preinsert the portion of the first candidate word that is
|
||||
not part of the current completion leader and using the
|
||||
|hl-ComplMatchIns| highlight group. Does not work when
|
||||
"fuzzy" is set. Requires both "menu" and "menuone" to be
|
||||
set.
|
||||
|hl-ComplMatchIns| highlight group. In order for it to
|
||||
work, "fuzzy" must not bet set and "menuone" must be set.
|
||||
|
||||
preview Show extra information about the currently selected
|
||||
completion in the preview window. Only works in
|
||||
|
5
runtime/lua/vim/_meta/options.lua
generated
5
runtime/lua/vim/_meta/options.lua
generated
@@ -1101,9 +1101,8 @@ vim.go.cia = vim.go.completeitemalign
|
||||
--- preinsert
|
||||
--- Preinsert the portion of the first candidate word that is
|
||||
--- not part of the current completion leader and using the
|
||||
--- `hl-ComplMatchIns` highlight group. Does not work when
|
||||
--- "fuzzy" is set. Requires both "menu" and "menuone" to be
|
||||
--- set.
|
||||
--- `hl-ComplMatchIns` highlight group. In order for it to
|
||||
--- work, "fuzzy" must not bet set and "menuone" must be set.
|
||||
---
|
||||
--- preview Show extra information about the currently selected
|
||||
--- completion in the preview window. Only works in
|
||||
|
@@ -1808,13 +1808,12 @@ int ins_compl_len(void)
|
||||
return compl_length;
|
||||
}
|
||||
|
||||
/// Return TRUE when preinsert is set AND both 'menu' and 'menuone' flags
|
||||
/// are also set, otherwise return FALSE.
|
||||
/// Return true when the 'completeopt' "preinsert" flag is in effect,
|
||||
/// otherwise return false.
|
||||
static bool ins_compl_has_preinsert(void)
|
||||
{
|
||||
return (get_cot_flags()
|
||||
& (kOptCotFlagFuzzy|kOptCotFlagPreinsert|kOptCotFlagMenu|kOptCotFlagMenuone))
|
||||
== (kOptCotFlagPreinsert|kOptCotFlagMenu|kOptCotFlagMenuone);
|
||||
return (get_cot_flags() & (kOptCotFlagFuzzy|kOptCotFlagPreinsert|kOptCotFlagMenuone))
|
||||
== (kOptCotFlagPreinsert|kOptCotFlagMenuone);
|
||||
}
|
||||
|
||||
/// Returns true if the pre-insert effect is valid and the cursor is within
|
||||
|
@@ -1543,9 +1543,8 @@ local options = {
|
||||
preinsert
|
||||
Preinsert the portion of the first candidate word that is
|
||||
not part of the current completion leader and using the
|
||||
|hl-ComplMatchIns| highlight group. Does not work when
|
||||
"fuzzy" is set. Requires both "menu" and "menuone" to be
|
||||
set.
|
||||
|hl-ComplMatchIns| highlight group. In order for it to
|
||||
work, "fuzzy" must not bet set and "menuone" must be set.
|
||||
|
||||
preview Show extra information about the currently selected
|
||||
completion in the preview window. Only works in
|
||||
|
@@ -3116,6 +3116,11 @@ function Test_completeopt_preinsert()
|
||||
call assert_equal("foo1bar", getline('.'))
|
||||
call assert_equal(7, col('.'))
|
||||
|
||||
set cot=preinsert,menuone
|
||||
call feedkeys("Sfoo1 foo2\<CR>f\<C-X>\<C-N>", 'tx')
|
||||
call assert_equal("foo1", getline('.'))
|
||||
call assert_equal(1, col('.'))
|
||||
|
||||
bw!
|
||||
set cot&
|
||||
set omnifunc&
|
||||
|
Reference in New Issue
Block a user