Permalink
Browse files

Merged from the latest developing branch.

git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1419 2a77ed30-b011-0410-a7ad-c7884a0aa172
  • Loading branch information...
1 parent 4980981 commit c3412be9776114118eb0a03468fc79760a988efc edyfox committed Mar 19, 2009
Showing with 208 additions and 20 deletions.
  1. +14 −3 runtime/doc/if_cscop.txt
  2. +8 −0 src/ex_docmd.c
  3. +3 −0 src/ex_getln.c
  4. +5 −0 src/fileio.c
  5. +17 −0 src/gui_beval.c
  6. +118 −5 src/if_cscope.c
  7. +6 −2 src/misc1.c
  8. +21 −9 src/option.c
  9. +2 −0 src/proto/if_cscope.pro
  10. +1 −1 src/screen.c
  11. +12 −0 src/version.c
  12. +1 −0 src/vim.h
View
@@ -1,4 +1,4 @@
-*if_cscop.txt* For Vim version 7.2. Last change: 2005 Mar 29
+*if_cscop.txt* For Vim version 7.2. Last change: 2009 Mar 18
VIM REFERENCE MANUAL by Andy Kahn
@@ -131,11 +131,22 @@ The available subcommands are:
7 or f: Find this file
8 or i: Find files #including this file
+ For all types, except 4 and 6, leading white space for {name} is
+ removed. For 4 and 6 there is exactly one space between {querytype}
+ and {name}. Further white space is included in {name}.
+
EXAMPLES >
:cscope find c vim_free
- :cscope find 3 vim_free
+ :cscope find 3 vim_free
+<
+ These two examples perform the same query: functions calling
+ "vim_free". >
+
+ :cscope find t initOnce
+ :cscope find t initOnce
<
- These two examples perform the same query. >
+ The first one searches for the text "initOnce", the second one for
+ " initOnce". >
:cscope find 0 DEFAULT_TERM
<
View
@@ -3683,6 +3683,11 @@ set_one_cmd_context(xp, buff)
case CMD_highlight:
set_context_in_highlight_cmd(xp, arg);
break;
+#ifdef FEAT_CSCOPE
+ case CMD_cscope:
+ set_context_in_cscope_cmd(xp, arg);
+ break;
+#endif
#ifdef FEAT_LISTCMDS
case CMD_bdelete:
case CMD_bwipeout:
@@ -5187,6 +5192,9 @@ static struct
{EXPAND_AUGROUP, "augroup"},
{EXPAND_BUFFERS, "buffer"},
{EXPAND_COMMANDS, "command"},
+#if defined(FEAT_CSCOPE)
+ {EXPAND_CSCOPE, "cscope"},
+#endif
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
{EXPAND_USER_DEFINED, "custom"},
{EXPAND_USER_LIST, "customlist"},
View
@@ -4518,6 +4518,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
{EXPAND_EVENTS, get_event_name, TRUE},
{EXPAND_AUGROUP, get_augroup_name, TRUE},
#endif
+#ifdef FEAT_CSCOPE
+ {EXPAND_CSCOPE, get_cscope_name, TRUE},
+#endif
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
{EXPAND_LANGUAGE, get_lang_arg, TRUE},
View
@@ -6647,6 +6647,11 @@ buf_check_timestamp(buf, focus)
tbuf = alloc((unsigned)(STRLEN(path) + STRLEN(mesg)
+ STRLEN(mesg2) + 2));
sprintf((char *)tbuf, mesg, path);
+#ifdef FEAT_EVAL
+ /* Set warningmsg here, before the unimportant and output-specific
+ * mesg2 has been appended. */
+ set_vim_var_string(VV_WARNINGMSG, tbuf, -1);
+#endif
#if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
if (can_reload)
{
View
@@ -1291,6 +1291,23 @@ drawBalloon(beval)
XtNy, ty,
NULL);
#endif
+ /* Set tooltip colors */
+ {
+ Arg args[2];
+
+#ifdef FEAT_GUI_MOTIF
+ args[0].name = XmNbackground;
+ args[0].value = gui.tooltip_bg_pixel;
+ args[1].name = XmNforeground;
+ args[1].value = gui.tooltip_fg_pixel;
+#else /* Athena */
+ args[0].name = XtNbackground;
+ args[0].value = gui.tooltip_bg_pixel;
+ args[1].name = XtNforeground;
+ args[1].value = gui.tooltip_fg_pixel;
+#endif
+ XtSetValues(beval->balloonLabel, &args[0], XtNumber(args));
+ }
XtPopup(beval->balloonShell, XtGrabNone);
View
@@ -93,12 +93,117 @@ cs_usage_msg(x)
(void)EMSG2(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage);
}
+#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
+
+static enum
+{
+ EXP_CSCOPE_SUBCMD, /* expand ":cscope" sub-commands */
+ EXP_CSCOPE_FIND, /* expand ":cscope find" arguments */
+ EXP_CSCOPE_KILL /* expand ":cscope kill" arguments */
+} expand_what;
+
+/*
+ * Function given to ExpandGeneric() to obtain the cscope command
+ * expansion.
+ */
+/*ARGSUSED*/
+ char_u *
+get_cscope_name(xp, idx)
+ expand_T *xp;
+ int idx;
+{
+ switch (expand_what)
+ {
+ case EXP_CSCOPE_SUBCMD:
+ /* Complete with sub-commands of ":cscope":
+ * add, find, help, kill, reset, show */
+ return (char_u *)cs_cmds[idx].name;
+ case EXP_CSCOPE_FIND:
+ {
+ const char *query_type[] =
+ {
+ "c", "d", "e", "f", "g", "i", "s", "t", NULL
+ };
+
+ /* Complete with query type of ":cscope find {query_type}".
+ * {query_type} can be letters (c, d, ... t) or numbers (0, 1,
+ * ..., 8) but only complete with letters, since numbers are
+ * redundant. */
+ return (char_u *)query_type[idx];
+ }
+ case EXP_CSCOPE_KILL:
+ {
+ int i;
+ int current_idx = 0;
+ static char_u connection[2];
+
+ /* ":cscope kill" accepts connection numbers or partial names of
+ * the pathname of the cscope database as argument. Only complete
+ * with connection numbers. -1 can also be used to kill all
+ * connections. */
+ for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
+ {
+ if (csinfo[i].fname == NULL)
+ continue;
+ if (current_idx++ == idx)
+ {
+ /* Connection number fits in one character since
+ * CSCOPE_MAX_CONNECTIONS is < 10 */
+ connection[0] = i + '0';
+ connection[1] = NUL;
+ return connection;
+ }
+ }
+ return (current_idx == idx && idx > 0) ? (char_u *)"-1" : NULL;
+ }
+ default:
+ return NULL;
+ }
+}
+
+/*
+ * Handle command line completion for :cscope command.
+ */
+ void
+set_context_in_cscope_cmd(xp, arg)
+ expand_T *xp;
+ char_u *arg;
+{
+ char_u *p;
+
+ /* Default: expand subcommands */
+ xp->xp_context = EXPAND_CSCOPE;
+ expand_what = EXP_CSCOPE_SUBCMD;
+ xp->xp_pattern = arg;
+
+ /* (part of) subcommand already typed */
+ if (*arg != NUL)
+ {
+ p = skiptowhite(arg);
+ if (*p != NUL) /* past first word */
+ {
+ xp->xp_pattern = skipwhite(p);
+ if (*skiptowhite(xp->xp_pattern) != NUL)
+ xp->xp_context = EXPAND_NOTHING;
+ else if (STRNICMP(arg, "add", p - arg) == 0)
+ xp->xp_context = EXPAND_FILES;
+ else if (STRNICMP(arg, "kill", p - arg) == 0)
+ expand_what = EXP_CSCOPE_KILL;
+ else if (STRNICMP(arg, "find", p - arg) == 0)
+ expand_what = EXP_CSCOPE_FIND;
+ else
+ xp->xp_context = EXPAND_NOTHING;
+ }
+ }
+}
+
+#endif /* FEAT_CMDL_COMPL */
+
/*
* PRIVATE: do_cscope_general
*
- * find the command, print help if invalid, and the then call the
- * corresponding command function,
- * called from do_cscope and do_scscope
+ * Find the command, print help if invalid, and then call the corresponding
+ * command function.
*/
static void
do_cscope_general(eap, make_split)
@@ -659,6 +764,7 @@ cs_create_cmd(csoption, pattern)
{
char *cmd;
short search;
+ char *pat;
switch (csoption[0])
{
@@ -692,10 +798,17 @@ cs_create_cmd(csoption, pattern)
return NULL;
}
- if ((cmd = (char *)alloc((unsigned)(strlen(pattern) + 2))) == NULL)
+ /* Skip white space before the patter, except for text and pattern search,
+ * they may want to use the leading white space. */
+ pat = pattern;
+ if (search != 4 && search != 6)
+ while vim_iswhite(*pat)
+ ++pat;
+
+ if ((cmd = (char *)alloc((unsigned)(strlen(pat) + 2))) == NULL)
return NULL;
- (void)sprintf(cmd, "%d%s", search, pattern);
+ (void)sprintf(cmd, "%d%s", search, pat);
return cmd;
} /* cs_create_cmd */
View
@@ -2955,6 +2955,8 @@ change_warning(col)
int col; /* column for message; non-zero when in insert
mode and 'showmode' is on */
{
+ static char *w_readonly = N_("W10: Warning: Changing a readonly file");
+
if (curbuf->b_did_warn == FALSE
&& curbufIsChanged() == 0
#ifdef FEAT_AUTOCMD
@@ -2977,8 +2979,10 @@ change_warning(col)
if (msg_row == Rows - 1)
msg_col = col;
msg_source(hl_attr(HLF_W));
- MSG_PUTS_ATTR(_("W10: Warning: Changing a readonly file"),
- hl_attr(HLF_W) | MSG_HIST);
+ MSG_PUTS_ATTR(_(w_readonly), hl_attr(HLF_W) | MSG_HIST);
+#ifdef FEAT_EVAL
+ set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_readonly), -1);
+#endif
msg_clr_eos();
(void)msg_end();
if (msg_silent == 0 && !silent_mode)
View
@@ -6022,15 +6022,23 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
/* ":set t_Co=0" and ":set t_Co=1" do ":set t_Co=" */
if (varp == &T_CCO)
{
- t_colors = atoi((char *)T_CCO);
- if (t_colors <= 1)
+ int colors = atoi((char *)T_CCO);
+
+ /* Only reinitialize colors if t_Co value has really changed to
+ * avoid expensive reload of colorscheme if t_Co is set to the
+ * same value multiple times. */
+ if (colors != t_colors)
{
- if (new_value_alloced)
- vim_free(T_CCO);
- T_CCO = empty_option;
+ t_colors = colors;
+ if (t_colors <= 1)
+ {
+ if (new_value_alloced)
+ vim_free(T_CCO);
+ T_CCO = empty_option;
+ }
+ /* We now have a different color setup, initialize it again. */
+ init_highlight(TRUE, FALSE);
}
- /* We now have a different color setup, initialize it again. */
- init_highlight(TRUE, FALSE);
}
ttest(FALSE);
if (varp == &T_ME)
@@ -7555,9 +7563,13 @@ set_bool_option(opt_idx, varp, value, opt_flags)
* set. */
if (STRCMP(p_enc, "utf-8") != 0)
{
+ static char *w_arabic = N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'");
+
msg_source(hl_attr(HLF_W));
- MSG_ATTR(_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"),
- hl_attr(HLF_W));
+ MSG_ATTR(_(w_arabic), hl_attr(HLF_W));
+#ifdef FEAT_EVAL
+ set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1);
+#endif
}
# ifdef FEAT_MBYTE
View
@@ -1,4 +1,6 @@
/* if_cscope.c */
+char_u *get_cscope_name __ARGS((expand_T *xp, int idx));
+void set_context_in_cscope_cmd __ARGS((expand_T *xp, char_u *arg));
void do_cscope __ARGS((exarg_T *eap));
void do_scscope __ARGS((exarg_T *eap));
void do_cstag __ARGS((exarg_T *eap));
View
@@ -4665,7 +4665,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
--n_skip;
/* Only advance the "vcol" when after the 'number' column. */
- if (draw_state >= WL_SBR
+ if (draw_state > WL_NR
#ifdef FEAT_DIFF
&& filler_todo <= 0
#endif
View
@@ -677,6 +677,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 147,
+/**/
+ 146,
+/**/
+ 145,
+/**/
+ 144,
+/**/
+ 143,
+/**/
+ 142,
+/**/
141,
/**/
140,
View
@@ -708,6 +708,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define EXPAND_USER_DEFINED 30
#define EXPAND_USER_LIST 31
#define EXPAND_SHELLCMD 32
+#define EXPAND_CSCOPE 33
/* Values for exmode_active (0 is no exmode) */
#define EXMODE_NORMAL 1

0 comments on commit c3412be

Please sign in to comment.