mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
vim-patch:9.1.1057: Superfluous cleanup steps in test_ins_complete.vim (#32257)
Problem: Superfluous cleanup steps in test_ins_complete.vim.
Solution: Remove unnecessary :bw! and :autocmd! commands.
Also remove unnecessary STRLEN() in insexpand.c
(zeertzjq)
closes: vim/vim#16542
8297e2cee3
This commit is contained in:
@@ -3755,15 +3755,16 @@ void ins_compl_insert(bool in_compl_func, bool move_cursor)
|
|||||||
{
|
{
|
||||||
int compl_len = get_compl_len();
|
int compl_len = get_compl_len();
|
||||||
bool preinsert = ins_compl_has_preinsert();
|
bool preinsert = ins_compl_has_preinsert();
|
||||||
char *str = compl_shown_match->cp_str.data;
|
char *cp_str = compl_shown_match->cp_str.data;
|
||||||
|
size_t cp_str_len = compl_shown_match->cp_str.size;
|
||||||
size_t leader_len = ins_compl_leader_len();
|
size_t leader_len = ins_compl_leader_len();
|
||||||
|
|
||||||
// Make sure we don't go over the end of the string, this can happen with
|
// Make sure we don't go over the end of the string, this can happen with
|
||||||
// illegal bytes.
|
// illegal bytes.
|
||||||
if (compl_len < (int)compl_shown_match->cp_str.size) {
|
if (compl_len < (int)cp_str_len) {
|
||||||
ins_compl_insert_bytes(str + compl_len, -1);
|
ins_compl_insert_bytes(cp_str + compl_len, -1);
|
||||||
if (preinsert && move_cursor) {
|
if (preinsert && move_cursor) {
|
||||||
curwin->w_cursor.col -= (colnr_T)(strlen(str) - leader_len);
|
curwin->w_cursor.col -= (colnr_T)(cp_str_len - leader_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compl_used_match = !(match_at_original_text(compl_shown_match) || preinsert);
|
compl_used_match = !(match_at_original_text(compl_shown_match) || preinsert);
|
||||||
|
@@ -2927,7 +2927,6 @@ func Test_complete_info_matches()
|
|||||||
\], g:compl_info['items'])
|
\], g:compl_info['items'])
|
||||||
call assert_false(has_key(g:compl_info, 'matches'))
|
call assert_false(has_key(g:compl_info, 'matches'))
|
||||||
|
|
||||||
bw!
|
|
||||||
bw!
|
bw!
|
||||||
unlet g:what
|
unlet g:what
|
||||||
delfunc ShownInfo
|
delfunc ShownInfo
|
||||||
@@ -2958,7 +2957,6 @@ func Test_complete_info_completed()
|
|||||||
call feedkeys("Go\<C-X>\<C-N>\<F5>\<Esc>dd", 'tx')
|
call feedkeys("Go\<C-X>\<C-N>\<F5>\<Esc>dd", 'tx')
|
||||||
call assert_equal({}, g:compl_info)
|
call assert_equal({}, g:compl_info)
|
||||||
|
|
||||||
bw!
|
|
||||||
bw!
|
bw!
|
||||||
delfunc ShownInfo
|
delfunc ShownInfo
|
||||||
set cot&
|
set cot&
|
||||||
@@ -3021,7 +3019,7 @@ function Test_completeopt_preinsert()
|
|||||||
call assert_equal("hello fobar wo", getline('.'))
|
call assert_equal("hello fobar wo", getline('.'))
|
||||||
call feedkeys("\<C-E>\<ESC>", 'tx')
|
call feedkeys("\<C-E>\<ESC>", 'tx')
|
||||||
|
|
||||||
" confrim
|
" confirm
|
||||||
call feedkeys("S\<C-X>\<C-O>f\<C-Y>", 'tx')
|
call feedkeys("S\<C-X>\<C-O>f\<C-Y>", 'tx')
|
||||||
call assert_equal("fobar", getline('.'))
|
call assert_equal("fobar", getline('.'))
|
||||||
call assert_equal(5, col('.'))
|
call assert_equal(5, col('.'))
|
||||||
@@ -3073,12 +3071,10 @@ function Test_completeopt_preinsert()
|
|||||||
call assert_equal("fobar", getline('.'))
|
call assert_equal("fobar", getline('.'))
|
||||||
call assert_equal(5, col('.'))
|
call assert_equal(5, col('.'))
|
||||||
|
|
||||||
bw!
|
|
||||||
bw!
|
bw!
|
||||||
set cot&
|
set cot&
|
||||||
set omnifunc&
|
set omnifunc&
|
||||||
delfunc Omni_test
|
delfunc Omni_test
|
||||||
autocmd! CompleteChanged
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
||||||
|
Reference in New Issue
Block a user