> I don't think that skipping white space before the pattern is a problem.
> I would rather call it an improvement. However, I think your solution
> also has the effect that it's not possible to have a space in the
> pattern. That is undesired.
I found another way to fix it, and preserve old behavior, so that it
allows to search for pattern which contains, start or ends with
space(s). For example ":cs find e a " will successfully match
strings " a " (space, a, space).
I attach the patch to this email. Patch also contain fixes for
a couple of typos.
-- Dominique
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---
Index: if_cscope.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/if_cscope.c,v
retrieving revision 1.22
diff -c -r1.22 if_cscope.c
*** if_cscope.c 11 Mar 2007 14:48:29 -0000 1.22
--- if_cscope.c 18 Aug 2007 22:49:36 -0000
***************
*** 386,392 ****
* PRIVATE: cs_add
*
* add cscope database or a directory name (to look for cscope.out)
! * the the cscope connection list
*
* MAXPATHL 256
*/
--- 386,392 ----
* PRIVATE: cs_add
*
* add cscope database or a directory name (to look for cscope.out)
! * to the cscope connection list
*
* MAXPATHL 256
*/
***************
*** 952,957 ****
--- 952,958 ----
exarg_T *eap;
{
char *opt, *pat;
+ int len;
if (cs_check_for_connections() == FALSE)
{
***************
*** 959,964 ****
--- 960,966 ----
return FALSE;
}
+ len = STRLEN(eap->arg);
if ((opt = strtok((char *)NULL, (const char *)" ")) == NULL)
{
cs_usage_msg(Find);
***************
*** 966,972 ****
}
pat = opt + strlen(opt) + 1;
! if (pat == NULL || (pat != NULL && pat[0] == '\0'))
{
cs_usage_msg(Find);
return FALSE;
--- 968,974 ----
}
pat = opt + strlen(opt) + 1;
! if (pat >= (char *)eap->arg + len)
{
cs_usage_msg(Find);
return FALSE;
***************
*** 1317,1323 ****
#else
/* compare pathnames first */
&& ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME)
! /* if not Windows 9x, test index file atributes too */
|| (!mch_windows95()
&& csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
&& csinfo[j].nIndexHigh == bhfi.nFileIndexHigh
--- 1319,1325 ----
#else
/* compare pathnames first */
&& ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME)
! /* if not Windows 9x, test index file attributes too */
|| (!mch_windows95()
&& csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
&& csinfo[j].nIndexHigh == bhfi.nFileIndexHigh
***************
*** 1396,1406 ****
{
cscmd_T *cmdp;
char *stok;
! size_t len;
if (eap->arg == NULL)
return NULL;
if ((stok = strtok((char *)(eap->arg), (const char *)" ")) == NULL)
return NULL;
--- 1398,1409 ----
{
cscmd_T *cmdp;
char *stok;
! size_t len, len_arg;
if (eap->arg == NULL)
return NULL;
+ len_arg = STRLEN(eap->arg);
if ((stok = strtok((char *)(eap->arg), (const char *)" ")) == NULL)
return NULL;
***************
*** 1408,1416 ****
for (cmdp = cs_cmds; cmdp->name != NULL; ++cmdp)
{
if (strncmp((const char *)(stok), cmdp->name, len) == 0)
! return (cmdp);
}
! return NULL;
} /* cs_lookup_cmd */
--- 1411,1423 ----
for (cmdp = cs_cmds; cmdp->name != NULL; ++cmdp)
{
if (strncmp((const char *)(stok), cmdp->name, len) == 0)
! break;
}
!
! if (len < len_arg)
! stok[len] = ' '; /* restore space to keep eap->arg pristine */
!
! return cmdp->name == NULL ? NULL : cmdp;
} /* cs_lookup_cmd */
***************
*** 2195,2201 ****
cs_add_common(dblist[i], pplist[i], fllist[i]);
if (p_csverbose)
{
! /* dont' use smsg_attr because want to display
* connection number in the same line as
* "Added cscope database..."
*/
--- 2202,2208 ----
cs_add_common(dblist[i], pplist[i], fllist[i]);
if (p_csverbose)
{
! /* don't use smsg_attr because want to display
* connection number in the same line as
* "Added cscope database..."
*/