diff src/ex_getln.c @ 481:66080ac5dab7 v7.0130

updated for version 7.0130
author vimboss
date Mon, 15 Aug 2005 21:41:48 +0000
parents bf5ba8a0cdee
children 52e76e2b5b65
line wrap: on
line diff
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1647,16 +1647,21 @@ cmdline_changed:
 
 	    if (i != 0)
 	    {
+		pos_T	    save_pos = curwin->w_cursor;
+
 		/*
 		 * First move cursor to end of match, then to start.  This
 		 * moves the whole match onto the screen when 'nowrap' is set.
 		 */
-		i = curwin->w_cursor.col;
 		curwin->w_cursor.lnum += search_match_lines;
 		curwin->w_cursor.col = search_match_endcol;
+		if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
+		{
+		    curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
+		    coladvance((colnr_T)MAXCOL);
+		}
 		validate_cursor();
-		curwin->w_cursor.lnum -= search_match_lines;
-		curwin->w_cursor.col = i;
+		curwin->w_cursor = save_pos;
 	    }
 	    validate_cursor();