patch 9.1.1057: Superfluous cleanup steps in test_ins_complete.vim

Commit: 
https://github.com/vim/vim/commit/8297e2cee337c626c6691e81b25e1f1897c71b86
Author: zeertzjq <zeert...@outlook.com>
Date:   Thu Jan 30 11:04:47 2025 +0100

    patch 9.1.1057: Superfluous cleanup steps in test_ins_complete.vim
    
    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: #16542
    
    Signed-off-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/insexpand.c b/src/insexpand.c
index 3b9494bb2..63b779dd1 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -4374,16 +4374,17 @@ ins_compl_insert(int in_compl_func, int move_cursor)
 {
     int            compl_len = get_compl_len();
     int            preinsert = ins_compl_has_preinsert();
-    char_u  *str = compl_shown_match->cp_str.string;
-    int            leader_len = ins_compl_leader_len();
+    char_u  *cp_str = compl_shown_match->cp_str.string;
+    size_t  cp_str_len = compl_shown_match->cp_str.length;
+    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.length)
+    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)
-           curwin->w_cursor.col -= ((size_t)STRLEN(str) - leader_len);
+           curwin->w_cursor.col -= (colnr_T)(cp_str_len - leader_len);
     }
     if (match_at_original_text(compl_shown_match) || preinsert)
        compl_used_match = FALSE;
diff --git a/src/testdir/test_ins_complete.vim 
b/src/testdir/test_ins_complete.vim
index e4bc98ac9..d0f90c881 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -2988,7 +2988,6 @@ func Test_complete_info_matches()
     \], g:compl_info['items'])
   call assert_false(has_key(g:compl_info, 'matches'))
 
-  bw!
   bw!
   unlet g:what
   delfunc ShownInfo
@@ -3019,7 +3018,6 @@ func Test_complete_info_completed()
   call feedkeys("Go\<C-X>\<C-N>\<F5>\<Esc>dd", 'tx')
   call assert_equal({}, g:compl_info)
 
-  bw!
   bw!
   delfunc ShownInfo
   set cot&
@@ -3082,7 +3080,7 @@ function Test_completeopt_preinsert()
   call assert_equal("hello  fobar wo", getline('.'))
   call feedkeys("\<C-E>\<ESC>", 'tx')
 
-  " confrim
+  " confirm
   call feedkeys("S\<C-X>\<C-O>f\<C-Y>", 'tx')
   call assert_equal("fobar", getline('.'))
   call assert_equal(5, col('.'))
@@ -3134,12 +3132,10 @@ function Test_completeopt_preinsert()
   call assert_equal("fobar", getline('.'))
   call assert_equal(5, col('.'))
 
-  bw!
   bw!
   set cot&
   set omnifunc&
   delfunc Omni_test
-  autocmd! CompleteChanged
 endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab nofoldenable
diff --git a/src/version.c b/src/version.c
index 836f0a844..edec15eeb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1057,
 /**/
     1056,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1tdRZk-00BWf2-CW%40256bit.org.

Raspunde prin e-mail lui