From b3b255396d9fad56c074099b0cdcdbbecab79d4a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Jan 2025 18:59:01 +0800 Subject: 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 https://github.com/vim/vim/commit/8297e2cee337c626c6691e81b25e1f1897c71b86 --- src/nvim/insexpand.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 73b84175d7..01029ddda2 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -3755,15 +3755,16 @@ void ins_compl_insert(bool in_compl_func, bool move_cursor) { int compl_len = get_compl_len(); 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(); // Make sure we don't go over the end of the string, this can happen with // illegal bytes. - if (compl_len < (int)compl_shown_match->cp_str.size) { - ins_compl_insert_bytes(str + compl_len, -1); + if (compl_len < (int)cp_str_len) { + ins_compl_insert_bytes(cp_str + compl_len, -1); 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); -- cgit