patch 9.1.1338: Calling expand() interferes with cmdcomplete_info()

Commit: 
https://github.com/vim/vim/commit/ec270a5f5554c62517246281afb547b5c2fe65af
Author: zeertzjq <zeert...@outlook.com>
Date:   Wed Apr 23 20:50:23 2025 +0200

    patch 9.1.1338: Calling expand() interferes with cmdcomplete_info()
    
    Problem:  Calling expand() interferes with cmdcomplete_info()
              (after 9.1.1329).
    Solution: Only clear cmdline_orig when starting/ending cmdline mode
              (zeertzjq).
    
    closes: #17192
    
    Signed-off-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index e8bc0805c..4dbd10ee8 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -1115,7 +1115,6 @@ ExpandInit(expand_T *xp)
     xp->xp_backslash = XP_BS_NONE;
     xp->xp_prefix = XP_PREFIX_NONE;
     xp->xp_numfiles = -1;
-    VIM_CLEAR(cmdline_orig);
 }
 
 /*
@@ -1132,6 +1131,12 @@ ExpandCleanup(expand_T *xp)
     VIM_CLEAR(xp->xp_orig);
 }
 
+    void
+clear_cmdline_orig(void)
+{
+    VIM_CLEAR(cmdline_orig);
+}
+
 /*
  * Display one line of completion matches. Multiple matches are displayed in
  * each line (used by wildmode=list and CTRL-D)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 8445236ac..1be5a0c1f 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1663,6 +1663,7 @@ getcmdline_int(
 
     ExpandInit(&xpc);
     ccline.xpc = &xpc;
+    clear_cmdline_orig();
 
 #ifdef FEAT_RIGHTLEFT
     if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
@@ -2567,6 +2568,7 @@ returncmd:
 
     ExpandCleanup(&xpc);
     ccline.xpc = NULL;
+    clear_cmdline_orig();
 
 #ifdef FEAT_SEARCH_EXTRA
     finish_incsearch_highlighting(gotesc, &is_state, FALSE);
diff --git a/src/proto/cmdexpand.pro b/src/proto/cmdexpand.pro
index 73db378bf..92e9dcb02 100644
--- a/src/proto/cmdexpand.pro
+++ b/src/proto/cmdexpand.pro
@@ -11,6 +11,7 @@ int cmdline_compl_is_fuzzy(void);
 char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int 
mode);
 void ExpandInit(expand_T *xp);
 void ExpandCleanup(expand_T *xp);
+void clear_cmdline_orig(void);
 int showmatches(expand_T *xp, int wildmenu);
 char_u *addstar(char_u *fname, int len, int context);
 void set_expand_context(expand_T *xp);
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 364909cc5..c66a4273e 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -4268,10 +4268,12 @@ func Test_cd_bslash_completion_windows()
   let &shellslash = save_shellslash
 endfunc
 
-" Testg cmdcomplete_info() with CmdlineLeavePre autocmd
+" Test cmdcomplete_info() with CmdlineLeavePre autocmd
 func Test_cmdcomplete_info()
   augroup test_CmdlineLeavePre
     autocmd!
+    " Calling expand() should not interfere with cmdcomplete_info().
+    autocmd CmdlineLeavePre * call expand('test_cmdline.*')
     autocmd CmdlineLeavePre * let g:cmdcomplete_info = 
string(cmdcomplete_info())
   augroup END
   new
diff --git a/src/version.c b/src/version.c
index fec0e0d18..e9dc252ea 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 */
+/**/
+    1338,
 /**/
     1337,
 /**/

-- 
-- 
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/E1u7fKN-003Xcq-0g%40256bit.org.

Raspunde prin e-mail lui