To: vim-dev@vim.org Subject: Patch 6.1.378 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.378 Problem: When two buffer-local user commands are ambiguous, a full match with a global user command isn't found. (Hari Krishna Dara) Solution: Detect this situation and accept the global command. Files: src/ex_docmd.c *** ../vim61.377/src/ex_docmd.c Sun Mar 9 15:11:38 2003 --- src/ex_docmd.c Sat Mar 8 13:59:20 2003 *************** *** 1348,1354 **** if (p == NULL) { if (!ea.skip) ! errormsg = (char_u *)_("Ambiguous use of user-defined command"); goto doend; } /* Check for wrong commands. */ --- 1348,1354 ---- if (p == NULL) { if (!ea.skip) ! errormsg = (char_u *)_("E464: Ambiguous use of user-defined command"); goto doend; } /* Check for wrong commands. */ *************** *** 2041,2046 **** --- 2041,2049 ---- int found = FALSE, possible = FALSE; char_u *cp, *np; /* Point into typed cmd and test name */ garray_T *gap; + int amb_local = FALSE; /* Found ambiguous buffer-local + command, only full match global + is accepted. */ /* User defined commands may contain numbers */ while (ASCII_ISALNUM(*p)) *************** *** 2069,2075 **** * wasn't a full match and a global command is a full * match. */ if (k == len && found && *np != NUL) ! return NULL; if (!found || (k == len && *np == NUL)) { --- 2072,2082 ---- * wasn't a full match and a global command is a full * match. */ if (k == len && found && *np != NUL) ! { ! if (gap == &ucmds) ! return NULL; ! amb_local = TRUE; ! } if (!found || (k == len && *np == NUL)) { *************** *** 2090,2102 **** eap->useridx = j; /* Do not search for further abbreviations ! * if this is an exact match ! */ matchlen = k; if (k == len && *np == NUL) { if (full != NULL) *full = TRUE; break; } } --- 2097,2109 ---- eap->useridx = j; /* Do not search for further abbreviations ! * if this is an exact match. */ matchlen = k; if (k == len && *np == NUL) { if (full != NULL) *full = TRUE; + amb_local = FALSE; break; } } *************** *** 2109,2114 **** --- 2116,2125 ---- gap = &ucmds; } + /* Only found ambiguous matches. */ + if (amb_local) + return NULL; + /* The match we found may be followed immediately by a * number. Move *p back to point to it. */ *** ../vim61.377/src/version.c Sun Mar 9 15:15:54 2003 --- src/version.c Sun Mar 9 15:17:03 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 378, /**/ -- Often you're less important than your furniture. If you think about it, you can get fired but your furniture stays behind, gainfully employed at the company that didn't need _you_ anymore. (Scott Adams - The Dilbert principle) /// 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 ///