mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
updated for version 7.2.433
Problem: Can't use cscope with QuickFixCmdPre and QuickFixCmdPost. Solution: Add cscope support for these autocmd events. (Bryan Venteicher)
This commit is contained in:
parent
70b11cdd56
commit
f1eeae94fd
@ -678,10 +678,10 @@ MenuPopup Just before showing the popup menu (under the
|
|||||||
QuickFixCmdPre Before a quickfix command is run (|:make|,
|
QuickFixCmdPre Before a quickfix command is run (|:make|,
|
||||||
|:lmake|, |:grep|, |:lgrep|, |:grepadd|,
|
|:lmake|, |:grep|, |:lgrep|, |:grepadd|,
|
||||||
|:lgrepadd|, |:vimgrep|, |:lvimgrep|,
|
|:lgrepadd|, |:vimgrep|, |:lvimgrep|,
|
||||||
|:vimgrepadd|, |:lvimgrepadd|). The pattern is
|
|:vimgrepadd|, |:lvimgrepadd|, |:cscope|).
|
||||||
matched against the command being run. When
|
The pattern is matched against the command
|
||||||
|:grep| is used but 'grepprg' is set to
|
being run. When |:grep| is used but 'grepprg'
|
||||||
"internal" it still matches "grep".
|
is set to "internal" it still matches "grep".
|
||||||
This command cannot be used to set the
|
This command cannot be used to set the
|
||||||
'makeprg' and 'grepprg' variables.
|
'makeprg' and 'grepprg' variables.
|
||||||
If this command causes an error, the quickfix
|
If this command causes an error, the quickfix
|
||||||
|
121
src/if_cscope.c
121
src/if_cscope.c
@ -1113,6 +1113,70 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
|
|||||||
#ifdef FEAT_QUICKFIX
|
#ifdef FEAT_QUICKFIX
|
||||||
char cmdletter;
|
char cmdletter;
|
||||||
char *qfpos;
|
char *qfpos;
|
||||||
|
|
||||||
|
/* get cmd letter */
|
||||||
|
switch (opt[0])
|
||||||
|
{
|
||||||
|
case '0' :
|
||||||
|
cmdletter = 's';
|
||||||
|
break;
|
||||||
|
case '1' :
|
||||||
|
cmdletter = 'g';
|
||||||
|
break;
|
||||||
|
case '2' :
|
||||||
|
cmdletter = 'd';
|
||||||
|
break;
|
||||||
|
case '3' :
|
||||||
|
cmdletter = 'c';
|
||||||
|
break;
|
||||||
|
case '4' :
|
||||||
|
cmdletter = 't';
|
||||||
|
break;
|
||||||
|
case '6' :
|
||||||
|
cmdletter = 'e';
|
||||||
|
break;
|
||||||
|
case '7' :
|
||||||
|
cmdletter = 'f';
|
||||||
|
break;
|
||||||
|
case '8' :
|
||||||
|
cmdletter = 'i';
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
cmdletter = opt[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
qfpos = (char *)vim_strchr(p_csqf, cmdletter);
|
||||||
|
if (qfpos != NULL)
|
||||||
|
{
|
||||||
|
qfpos++;
|
||||||
|
/* next symbol must be + or - */
|
||||||
|
if (strchr(CSQF_FLAGS, *qfpos) == NULL)
|
||||||
|
{
|
||||||
|
char *nf = _("E469: invalid cscopequickfix flag %c for %c");
|
||||||
|
char *buf = (char *)alloc((unsigned)strlen(nf));
|
||||||
|
|
||||||
|
/* strlen will be enough because we use chars */
|
||||||
|
if (buf != NULL)
|
||||||
|
{
|
||||||
|
sprintf(buf, nf, *qfpos, *(qfpos-1));
|
||||||
|
(void)EMSG(buf);
|
||||||
|
vim_free(buf);
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef FEAT_AUTOCMD
|
||||||
|
if (*qfpos != '0')
|
||||||
|
{
|
||||||
|
apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope",
|
||||||
|
curbuf->b_fname, TRUE, curbuf);
|
||||||
|
# ifdef FEAT_EVAL
|
||||||
|
if (did_throw || force_abort)
|
||||||
|
return FALSE;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* create the actual command to send to cscope */
|
/* create the actual command to send to cscope */
|
||||||
@ -1174,58 +1238,6 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_QUICKFIX
|
#ifdef FEAT_QUICKFIX
|
||||||
/* get cmd letter */
|
|
||||||
switch (opt[0])
|
|
||||||
{
|
|
||||||
case '0' :
|
|
||||||
cmdletter = 's';
|
|
||||||
break;
|
|
||||||
case '1' :
|
|
||||||
cmdletter = 'g';
|
|
||||||
break;
|
|
||||||
case '2' :
|
|
||||||
cmdletter = 'd';
|
|
||||||
break;
|
|
||||||
case '3' :
|
|
||||||
cmdletter = 'c';
|
|
||||||
break;
|
|
||||||
case '4' :
|
|
||||||
cmdletter = 't';
|
|
||||||
break;
|
|
||||||
case '6' :
|
|
||||||
cmdletter = 'e';
|
|
||||||
break;
|
|
||||||
case '7' :
|
|
||||||
cmdletter = 'f';
|
|
||||||
break;
|
|
||||||
case '8' :
|
|
||||||
cmdletter = 'i';
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
cmdletter = opt[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
qfpos = (char *)vim_strchr(p_csqf, cmdletter);
|
|
||||||
if (qfpos != NULL)
|
|
||||||
{
|
|
||||||
qfpos++;
|
|
||||||
/* next symbol must be + or - */
|
|
||||||
if (strchr(CSQF_FLAGS, *qfpos) == NULL)
|
|
||||||
{
|
|
||||||
char *nf = _("E469: invalid cscopequickfix flag %c for %c");
|
|
||||||
char *buf = (char *)alloc((unsigned)strlen(nf));
|
|
||||||
|
|
||||||
/* strlen will be enough because we use chars */
|
|
||||||
if (buf != NULL)
|
|
||||||
{
|
|
||||||
sprintf(buf, nf, *qfpos, *(qfpos-1));
|
|
||||||
(void)EMSG(buf);
|
|
||||||
vim_free(buf);
|
|
||||||
}
|
|
||||||
vim_free(nummatches);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (qfpos != NULL && *qfpos != '0' && totmatches > 0)
|
if (qfpos != NULL && *qfpos != '0' && totmatches > 0)
|
||||||
{
|
{
|
||||||
/* fill error list */
|
/* fill error list */
|
||||||
@ -1258,6 +1270,11 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
|
|||||||
postponed_split = 0;
|
postponed_split = 0;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifdef FEAT_AUTOCMD
|
||||||
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)"cscope",
|
||||||
|
curbuf->b_fname, TRUE, curbuf);
|
||||||
|
# endif
|
||||||
if (use_ll)
|
if (use_ll)
|
||||||
/*
|
/*
|
||||||
* In the location list window, use the displayed location
|
* In the location list window, use the displayed location
|
||||||
|
@ -681,6 +681,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
433,
|
||||||
/**/
|
/**/
|
||||||
432,
|
432,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user