4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: The pattern being completed may be in freed memory when the
12 command line is being reallocated. (Dominique Pelle)
13 Solution: Keep a pointer to the expand_T in the command line structure.
14 Don't use <S-Tab> as CTRL-P when there are no results. Clear the
15 completion when using a command line from the history.
19 *** ../vim-7.2.015/src/ex_getln.c Fri Aug 8 12:58:59 2008
20 --- src/ex_getln.c Wed Sep 10 22:43:41 2008
24 int cmdattr; /* attributes for prompt */
25 int overstrike; /* Typing mode on the command line. Shared by
26 getcmdline() and put_on_cmdline(). */
27 + expand_T *xpc; /* struct being used for expansion, xp_pattern
28 + may point into cmdbuff */
29 int xp_context; /* type of expansion */
31 char_u *xp_arg; /* user-defined expansion arg */
37 ! static struct cmdline_info ccline; /* current cmdline_info */
39 static int cmd_showtail; /* Only show path tail in lists ? */
45 ! /* The current cmdline_info. It is initialized in getcmdline() and after that
46 ! * used by other functions. When invoking getcmdline() recursively it needs
47 ! * to be saved with save_cmdline() and restored with restore_cmdline().
48 ! * TODO: make it local to getcmdline() and pass it around. */
49 ! static struct cmdline_info ccline;
51 static int cmd_showtail; /* Only show path tail in lists ? */
62 if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
68 ! * <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
70 ! if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
78 ! * When there are matching completions to select <S-Tab> works like
79 ! * CTRL-P (unless 'wc' is <S-Tab>).
81 ! if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
90 vim_free(ccline.cmdbuff);
91 + xpc.xp_context = EXPAND_NOTHING;
93 p = lookfor; /* back to the old one */
103 #ifdef FEAT_SEARCH_EXTRA
109 mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
112 + if (ccline.xpc != NULL
113 + && ccline.xpc->xp_pattern != NULL
114 + && ccline.xpc->xp_context != EXPAND_NOTHING
115 + && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
117 + int i = ccline.xpc->xp_pattern - p;
119 + /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
120 + * to point into the newly allocated memory. */
121 + if (i >= 0 && i <= ccline.cmdlen)
122 + ccline.xpc->xp_pattern = ccline.cmdbuff + i;
131 prev_ccline = ccline;
132 ccline.cmdbuff = NULL;
133 ccline.cmdprompt = NULL;
144 + xp->xp_pattern = NULL;
145 xp->xp_backslash = XP_BS_NONE;
146 #ifndef BACKSLASH_IN_FILENAME
147 xp->xp_shell = FALSE;
148 *** ../vim-7.2.015/src/version.c Wed Sep 10 18:25:18 2008
149 --- src/version.c Sun Sep 14 14:38:47 2008
153 { /* Add new patch number below this line */
159 hundred-and-one symptoms of being an internet addict:
160 53. To find out what time it is, you send yourself an e-mail and check the
163 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
164 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
165 \\\ download, build and distribute -- http://www.A-A-P.org ///
166 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///