diff src/search.c @ 5735:50dbef5e774a v7.4.212

updated for version 7.4.212 Problem: Now that the +visual feature is always enabled the #ifdefs for it are not useful. Solution: Remove the checks for FEAT_VISUAL.
author Bram Moolenaar <bram@vim.org>
date Sun, 23 Mar 2014 15:13:05 +0100
parents fa53233519c6
children 01d9ffdd6e6f
line wrap: on
line diff
--- a/src/search.c
+++ b/src/search.c
@@ -506,7 +506,7 @@ last_pat_prog(regmatch)
 #endif
 
 /*
- * lowest level search function.
+ * Lowest level search function.
  * Search for 'count'th occurrence of pattern 'pat' in direction 'dir'.
  * Start at position 'pos' and return the found position in 'pos'.
  *
@@ -3198,7 +3198,6 @@ current_word(oap, count, include, bigwor
     cls_bigword = bigword;
     clearpos(&start_pos);
 
-#ifdef FEAT_VISUAL
     /* Correct cursor when 'selection' is exclusive */
     if (VIsual_active && *p_sel == 'e' && lt(VIsual, curwin->w_cursor))
 	dec_cursor();
@@ -3208,7 +3207,6 @@ current_word(oap, count, include, bigwor
      * character, select the word and/or white space under the cursor.
      */
     if (!VIsual_active || equalpos(curwin->w_cursor, VIsual))
-#endif
     {
 	/*
 	 * Go to start of current word or white space.
@@ -3245,7 +3243,6 @@ current_word(oap, count, include, bigwor
 		include_white = TRUE;
 	}
 
-#ifdef FEAT_VISUAL
 	if (VIsual_active)
 	{
 	    /* should do something when inclusive == FALSE ! */
@@ -3253,7 +3250,6 @@ current_word(oap, count, include, bigwor
 	    redraw_curbuf_later(INVERTED);	/* update the inversion */
 	}
 	else
-#endif
 	{
 	    oap->start = start_pos;
 	    oap->motion_type = MCHAR;
@@ -3267,7 +3263,6 @@ current_word(oap, count, include, bigwor
     while (count > 0)
     {
 	inclusive = TRUE;
-#ifdef FEAT_VISUAL
 	if (VIsual_active && lt(curwin->w_cursor, VIsual))
 	{
 	    /*
@@ -3288,7 +3283,6 @@ current_word(oap, count, include, bigwor
 	    }
 	}
 	else
-#endif
 	{
 	    /*
 	     * Move cursor forward one word and/or white area.
@@ -3334,18 +3328,15 @@ current_word(oap, count, include, bigwor
 	    back_in_line();
 	    if (cls() == 0 && curwin->w_cursor.col > 0)
 	    {
-#ifdef FEAT_VISUAL
 		if (VIsual_active)
 		    VIsual = curwin->w_cursor;
 		else
-#endif
 		    oap->start = curwin->w_cursor;
 	    }
 	}
 	curwin->w_cursor = pos;	/* put cursor back at end */
     }
 
-#ifdef FEAT_VISUAL
     if (VIsual_active)
     {
 	if (*p_sel == 'e' && inclusive && ltoreq(VIsual, curwin->w_cursor))
@@ -3357,7 +3348,6 @@ current_word(oap, count, include, bigwor
 	}
     }
     else
-#endif
 	oap->inclusive = inclusive;
 
     return OK;
@@ -3384,7 +3374,6 @@ current_sent(oap, count, include)
     pos = start_pos;
     findsent(FORWARD, 1L);	/* Find start of next sentence. */
 
-#ifdef FEAT_VISUAL
     /*
      * When the Visual area is bigger than one character: Extend it.
      */
@@ -3471,7 +3460,6 @@ extend:
 	}
 	return OK;
     }
-#endif
 
     /*
      * If the cursor started on a blank, check if it is just before the start
@@ -3521,7 +3509,6 @@ extend:
 	    find_first_blank(&start_pos);
     }
 
-#ifdef FEAT_VISUAL
     if (VIsual_active)
     {
 	/* Avoid getting stuck with "is" on a single space before a sentence. */
@@ -3534,7 +3521,6 @@ extend:
 	redraw_curbuf_later(INVERTED);	/* update the inversion */
     }
     else
-#endif
     {
 	/* include a newline after the sentence, if there is one */
 	if (incl(&curwin->w_cursor) == -1)
@@ -3574,9 +3560,7 @@ current_block(oap, count, include, what,
     /*
      * If we start on '(', '{', ')', '}', etc., use the whole block inclusive.
      */
-#ifdef FEAT_VISUAL
     if (!VIsual_active || equalpos(VIsual, curwin->w_cursor))
-#endif
     {
 	setpcmark();
 	if (what == '{')		/* ignore indent */
@@ -3587,7 +3571,6 @@ current_block(oap, count, include, what,
 	    /* cursor on '(' or '{', move cursor just after it */
 	    ++curwin->w_cursor.col;
     }
-#ifdef FEAT_VISUAL
     else if (lt(VIsual, curwin->w_cursor))
     {
 	old_start = VIsual;
@@ -3595,7 +3578,6 @@ current_block(oap, count, include, what,
     }
     else
 	old_end = VIsual;
-#endif
 
     /*
      * Search backwards for unclosed '(', '{', etc..
@@ -3641,7 +3623,6 @@ current_block(oap, count, include, what,
 		if (decl(&curwin->w_cursor) != 0)
 		    break;
 	    }
-#ifdef FEAT_VISUAL
 	/*
 	 * In Visual mode, when the resulting area is not bigger than what we
 	 * started with, extend it to the next block, and then exclude again.
@@ -3666,11 +3647,9 @@ current_block(oap, count, include, what,
 	    curwin->w_cursor = *end_pos;
 	}
 	else
-#endif
 	    break;
     }
 
-#ifdef FEAT_VISUAL
     if (VIsual_active)
     {
 	if (*p_sel == 'e')
@@ -3683,7 +3662,6 @@ current_block(oap, count, include, what,
 	showmode();
     }
     else
-#endif
     {
 	oap->start = start_pos;
 	oap->motion_type = MCHAR;
@@ -3807,17 +3785,13 @@ current_tagblock(oap, count_arg, include
     old_pos = curwin->w_cursor;
     old_end = curwin->w_cursor;		    /* remember where we started */
     old_start = old_end;
-#ifdef FEAT_VISUAL
     if (!VIsual_active || *p_sel == 'e')
-#endif
 	decl(&old_end);			    /* old_end is inclusive */
 
     /*
      * If we start on "<aaa>" select that block.
      */
-#ifdef FEAT_VISUAL
     if (!VIsual_active || equalpos(VIsual, curwin->w_cursor))
-#endif
     {
 	setpcmark();
 
@@ -3843,7 +3817,6 @@ current_tagblock(oap, count_arg, include
 	    old_end = curwin->w_cursor;
 	}
     }
-#ifdef FEAT_VISUAL
     else if (lt(VIsual, curwin->w_cursor))
     {
 	old_start = VIsual;
@@ -3851,7 +3824,6 @@ current_tagblock(oap, count_arg, include
     }
     else
 	old_end = VIsual;
-#endif
 
 again:
     /*
@@ -3951,7 +3923,6 @@ again:
 	}
     }
 
-#ifdef FEAT_VISUAL
     if (VIsual_active)
     {
 	/* If the end is before the start there is no text between tags, select
@@ -3966,7 +3937,6 @@ again:
 	showmode();
     }
     else
-#endif
     {
 	oap->start = start_pos;
 	oap->motion_type = MCHAR;
@@ -4010,7 +3980,6 @@ current_par(oap, count, include, type)
 
     start_lnum = curwin->w_cursor.lnum;
 
-#ifdef FEAT_VISUAL
     /*
      * When visual area is more than one line: extend it.
      */
@@ -4064,7 +4033,6 @@ extend:
 	curwin->w_cursor.col = 0;
 	return retval;
     }
-#endif
 
     /*
      * First move back to the start_lnum of the paragraph or white lines
@@ -4136,7 +4104,6 @@ extend:
 	while (start_lnum > 1 && linewhite(start_lnum - 1))
 	    --start_lnum;
 
-#ifdef FEAT_VISUAL
     if (VIsual_active)
     {
 	/* Problem: when doing "Vipipip" nothing happens in a single white
@@ -4149,7 +4116,6 @@ extend:
 	showmode();
     }
     else
-#endif
     {
 	oap->start.lnum = start_lnum;
 	oap->start.col = 0;
@@ -4247,7 +4213,6 @@ current_quote(oap, count, include, quote
     int		col_end;
     int		col_start = curwin->w_cursor.col;
     int		inclusive = FALSE;
-#ifdef FEAT_VISUAL
     int		vis_empty = TRUE;	/* Visual selection <= 1 char */
     int		vis_bef_curs = FALSE;	/* Visual starts before cursor */
     int		inside_quotes = FALSE;	/* Looks like "i'" done before */
@@ -4331,17 +4296,11 @@ current_quote(oap, count, include, quote
 	}
     }
     else
-#endif
-
-    if (line[col_start] == quotechar
-#ifdef FEAT_VISUAL
-	    || !vis_empty
-#endif
-	    )
+
+    if (line[col_start] == quotechar || !vis_empty)
     {
 	int	first_col = col_start;
 
-#ifdef FEAT_VISUAL
 	if (!vis_empty)
 	{
 	    if (vis_bef_curs)
@@ -4349,7 +4308,7 @@ current_quote(oap, count, include, quote
 	    else
 		first_col = find_prev_quote(line, col_start, quotechar, NULL);
 	}
-#endif
+
 	/* The cursor is on a quote, we don't know if it's the opening or
 	 * closing quote.  Search from the start of the line to find out.
 	 * Also do this when there is a Visual area, a' may leave the cursor
@@ -4406,14 +4365,9 @@ current_quote(oap, count, include, quote
 
     /* Set start position.  After vi" another i" must include the ".
      * For v2i" include the quotes. */
-    if (!include && count < 2
-#ifdef FEAT_VISUAL
-	    && (vis_empty || !inside_quotes)
-#endif
-	    )
+    if (!include && count < 2 && (vis_empty || !inside_quotes))
 	++col_start;
     curwin->w_cursor.col = col_start;
-#ifdef FEAT_VISUAL
     if (VIsual_active)
     {
 	/* Set the start of the Visual area when the Visual area was empty, we
@@ -4433,7 +4387,6 @@ current_quote(oap, count, include, quote
 	}
     }
     else
-#endif
     {
 	oap->start = curwin->w_cursor;
 	oap->motion_type = MCHAR;
@@ -4441,14 +4394,10 @@ current_quote(oap, count, include, quote
 
     /* Set end position. */
     curwin->w_cursor.col = col_end;
-    if ((include || count > 1
-#ifdef FEAT_VISUAL
-		/* After vi" another i" must include the ". */
+    if ((include || count > 1 /* After vi" another i" must include the ". */
 		|| (!vis_empty && inside_quotes)
-#endif
 	) && inc_cursor() == 2)
 	inclusive = TRUE;
-#ifdef FEAT_VISUAL
     if (VIsual_active)
     {
 	if (vis_empty || vis_bef_curs)
@@ -4480,7 +4429,6 @@ current_quote(oap, count, include, quote
 	}
     }
     else
-#endif
     {
 	/* Set inclusive and other oap's flags. */
 	oap->inclusive = inclusive;
@@ -4491,7 +4439,6 @@ current_quote(oap, count, include, quote
 
 #endif /* FEAT_TEXTOBJ */
 
-#if defined(FEAT_VISUAL) || defined(PROTO)
 static int is_one_char __ARGS((char_u *pattern));
 
 /*
@@ -4690,7 +4637,6 @@ is_one_char(pattern)
     vim_regfree(regmatch.regprog);
     return result;
 }
-#endif /* FEAT_VISUAL */
 
 #if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(FEAT_TEXTOBJ) \
 	|| defined(PROTO)