To: vim-dev@vim.org Subject: Patch 6.1.348 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.348 Problem: Wildmode with wildmenu: ":set wildmode=list,full", ":colorscheme " results in "zellner" instead of the first entry. (Anand Hariharan) Solution: Don't call ExpandOne() from globpath(). (Flemming Madsen) Files: src/ex_getln.c *** ../vim61.347/src/ex_getln.c Thu Jan 2 21:11:08 2003 --- src/ex_getln.c Mon Feb 17 21:12:21 2003 *************** *** 3454,3473 **** expand_T xpc; char_u *buf; garray_T ga; int len; ! char_u *p; ! char_u **save_cmd_files = cmd_files; ! int save_cmd_numfiles = cmd_numfiles; buf = alloc(MAXPATHL); if (buf == NULL) return NULL; - /* ExpandOne() uses cmd_files and cmd_numfiles, need to save and restore - * them. */ - cmd_files = NULL; - cmd_numfiles = -1; - xpc.xp_context = EXPAND_FILES; xpc.xp_backslash = XP_BS_NONE; ga_init2(&ga, 1, 100); --- 3454,3469 ---- expand_T xpc; char_u *buf; garray_T ga; + int i; int len; ! int num_p; ! char_u **p; ! char_u *cur = NULL; buf = alloc(MAXPATHL); if (buf == NULL) return NULL; xpc.xp_context = EXPAND_FILES; xpc.xp_backslash = XP_BS_NONE; ga_init2(&ga, 1, 100); *************** *** 3481,3520 **** { add_pathsep(buf); STRCAT(buf, file); ! p = ExpandOne(&xpc, buf, NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL); ! if (p != NULL) { ! len = (int)STRLEN(p); ! if (ga.ga_data == NULL) ! { ! ga.ga_data = p; ! ga.ga_room = 0; ! ga.ga_len = len + 1; ! } ! else { ! /* Concatenate new results to previous ones. Insert a NL ! * and keep room for the trailing NUL. */ ! ++len; ! if (ga_grow(&ga, len + 1) == OK) { ! STRCAT(ga.ga_data, "\n"); ! STRCAT(ga.ga_data, p); ! ga.ga_len += len; ! ga.ga_room -= len; } ! vim_free(p); } } } } ! vim_free(buf); ! FreeWild(cmd_numfiles, cmd_files); ! cmd_files = save_cmd_files; ! cmd_numfiles = save_cmd_numfiles; ! ! return ga.ga_data; } #endif --- 3477,3510 ---- { add_pathsep(buf); STRCAT(buf, file); ! if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL ! && num_p > 0) { ! ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT); ! for (len = 0, i = 0; i < num_p; ++i) ! len += (long_u)STRLEN(p[i]) + 1; ! ! /* Concatenate new results to previous ones. */ ! if (ga_grow(&ga, len) == OK) { ! cur = (char_u *)ga.ga_data + ga.ga_len; ! for (i = 0; i < num_p; ++i) { ! STRCPY(cur, p[i]); ! cur += STRLEN(p[i]); ! *cur++ = '\n'; } ! ga.ga_len += len; ! ga.ga_room -= len; } } } } ! if (cur != NULL) ! *--cur = 0; /* Replace trailing newline with NUL */ ! vim_free(buf); ! return (char_u *)ga.ga_data; } #endif *** ../vim61.347/src/version.c Thu Feb 20 21:40:42 2003 --- src/version.c Thu Feb 20 21:42:35 2003 *************** *** 608,609 **** --- 612,615 ---- { /* Add new patch number below this line */ + /**/ + 348, /**/ -- Q: How does a UNIX Guru do Sex ? A: unzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///