changeset 789:b29b006d52d2

updated for version 7.0230
author vimboss
date Mon, 20 Mar 2006 21:50:15 +0000
parents b5aed52a4881
children c8680debe1cc
files src/misc2.c src/quickfix.c
diffstat 2 files changed, 37 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -2855,7 +2855,7 @@ call_shell(cmd, opt)
     }
 
 #ifdef FEAT_PROFILE
-    if (do_profiling)
+    if (do_profiling == PROF_YES)
 	prof_child_enter(&wait_time);
 #endif
 
@@ -2905,7 +2905,7 @@ call_shell(cmd, opt)
 #ifdef FEAT_EVAL
     set_vim_var_nr(VV_SHELL_ERROR, (long)retval);
 # ifdef FEAT_PROFILE
-    if (do_profiling)
+    if (do_profiling == PROF_YES)
 	prof_child_exit(&wait_time);
 # endif
 #endif
@@ -2914,8 +2914,8 @@ call_shell(cmd, opt)
 }
 
 /*
- * VISUAL and OP_PENDING State are never set, they are equal to NORMAL State
- * with a condition.  This function returns the real State.
+ * VISUAL, SELECTMODE and OP_PENDING State are never set, they are equal to
+ * NORMAL State with a condition.  This function returns the real State.
  */
     int
 get_real_state()
@@ -2924,11 +2924,15 @@ get_real_state()
     {
 #ifdef FEAT_VISUAL
 	if (VIsual_active)
+	{
+	    if (VIsual_select)
+		return SELECTMODE;
 	    return VISUAL;
+	}
 	else
 #endif
 	    if (finish_op)
-	    return OP_PENDING;
+		return OP_PENDING;
     }
     return State;
 }
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -79,10 +79,11 @@ static qf_info_T ql_info;	/* global quic
 /*
  * Structure used to hold the info of one part of 'errorformat'
  */
-struct eformat
+typedef struct efm_S efm_T;
+struct efm_S
 {
     regprog_T	    *prog;	/* pre-formatted part of 'errorformat' */
-    struct eformat  *next;	/* pointer to next (NULL if last) */
+    efm_T	    *next;	/* pointer to next (NULL if last) */
     char_u	    addr[FMT_PATTERNS]; /* indices of used % patterns */
     char_u	    prefix;	/* prefix of this format line: */
 				/*   'D' enter directory */
@@ -100,6 +101,7 @@ struct eformat
     char_u	    flags;	/* additional flags given in prefix */
 				/*   '-' do not include this line */
 				/*   '+' include whole line in message */
+    int		    conthere;	/* %> used */
 };
 
 static int	qf_init_ext __ARGS((qf_info_T *qi, char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast));
@@ -198,9 +200,10 @@ qf_init_ext(qi, efile, buf, tv, errorfor
     FILE	    *fd = NULL;
     qfline_T	    *qfprev = NULL;	/* init to make SASC shut up */
     char_u	    *efmp;
-    struct eformat  *fmt_first = NULL;
-    struct eformat  *fmt_last = NULL;
-    struct eformat  *fmt_ptr;
+    efm_T	    *fmt_first = NULL;
+    efm_T	    *fmt_last = NULL;
+    efm_T	    *fmt_ptr;
+    efm_T	    *fmt_start = NULL;
     char_u	    *efm;
     char_u	    *ptr;
     char_u	    *srcptr;
@@ -281,12 +284,12 @@ qf_init_ext(qi, efile, buf, tv, errorfor
     if ((fmtstr = alloc(i)) == NULL)
 	goto error2;
 
-    while (efm[0])
+    while (efm[0] != NUL)
     {
 	/*
 	 * Allocate a new eformat structure and put it at the end of the list
 	 */
-	fmt_ptr = (struct eformat *)alloc((unsigned)sizeof(struct eformat));
+	fmt_ptr = (efm_T *)alloc_clear((unsigned)sizeof(efm_T));
 	if (fmt_ptr == NULL)
 	    goto error2;
 	if (fmt_first == NULL)	    /* first one */
@@ -294,13 +297,6 @@ qf_init_ext(qi, efile, buf, tv, errorfor
 	else
 	    fmt_last->next = fmt_ptr;
 	fmt_last = fmt_ptr;
-	fmt_ptr->prefix = NUL;
-	fmt_ptr->flags = NUL;
-	fmt_ptr->next = NULL;
-	fmt_ptr->prog = NULL;
-	for (round = FMT_PATTERNS; round > 0; )
-	    fmt_ptr->addr[--round] = NUL;
-	/* round is 0 now */
 
 	/*
 	 * Isolate one part in the 'errorformat' option
@@ -314,6 +310,7 @@ qf_init_ext(qi, efile, buf, tv, errorfor
 	 */
 	ptr = fmtstr;
 	*ptr++ = '^';
+	round = 0;
 	for (efmp = efm; efmp < efm + len; ++efmp)
 	{
 	    if (*efmp == '%')
@@ -425,6 +422,8 @@ qf_init_ext(qi, efile, buf, tv, errorfor
 		    *ptr++ = *efmp;		/* regexp magic characters */
 		else if (*efmp == '#')
 		    *ptr++ = '*';
+		else if (*efmp == '>')
+		    fmt_ptr->conthere = TRUE;
 		else if (efmp == efm + 1)		/* analyse prefix */
 		{
 		    if (vim_strchr((char_u *)"+-", *efmp) != NULL)
@@ -561,13 +560,22 @@ qf_init_ext(qi, efile, buf, tv, errorfor
 	    *efmp = NUL;
 #endif
 
+	/* If there was no %> item start at the first pattern */
+	if (fmt_start == NULL)
+	    fmt_ptr = fmt_first;
+	else
+	{
+	    fmt_ptr = fmt_start;
+	    fmt_start = NULL;
+	}
+
 	/*
 	 * Try to match each part of 'errorformat' until we find a complete
 	 * match or no match.
 	 */
 	valid = TRUE;
 restofline:
-	for (fmt_ptr = fmt_first; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next)
+	for ( ; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next)
 	{
 	    idx = fmt_ptr->prefix;
 	    if (multiscan && vim_strchr((char_u *)"OPQ", idx) == NULL)
@@ -651,6 +659,7 @@ restofline:
 	    }
 	}
 	multiscan = FALSE;
+
 	if (fmt_ptr == NULL || idx == 'D' || idx == 'X')
 	{
 	    if (fmt_ptr != NULL)
@@ -677,6 +686,10 @@ restofline:
 	}
 	else if (fmt_ptr != NULL)
 	{
+	    /* honor %> item */
+	    if (fmt_ptr->conthere)
+		fmt_start = fmt_ptr;
+
 	    if (vim_strchr((char_u *)"AEWI", idx) != NULL)
 		multiline = TRUE;	/* start of a multi-line message */
 	    else if (vim_strchr((char_u *)"CZ", idx) != NULL)