diff src/edit.c @ 829:dc8197342755 v7.0d04

updated for version 7.0d04
author vimboss
date Fri, 14 Apr 2006 20:42:25 +0000
parents 01583c79d5f4
children 8bebcabccc2c
line wrap: on
line diff
--- a/src/edit.c
+++ b/src/edit.c
@@ -2140,7 +2140,7 @@ ins_compl_add(str, len, icase, fname, cp
      * - a copy of fname, FREE_FNAME is set to free later THE allocated mem.
      * - NULL otherwise.	--Acevedo */
     if (fname != NULL
-	    && compl_curr_match
+	    && compl_curr_match != NULL
 	    && compl_curr_match->cp_fname != NULL
 	    && STRCMP(fname, compl_curr_match->cp_fname) == 0)
 	match->cp_fname = compl_curr_match->cp_fname;
@@ -2501,6 +2501,11 @@ ins_compl_show_pum()
 						    * compl_match_arraysize));
 	if (compl_match_array != NULL)
 	{
+	    /* If the current match is the original text don't find the first
+	     * match after it, don't highlight anything. */
+	    if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
+		shown_match_ok = TRUE;
+
 	    i = 0;
 	    compl = compl_first_match;
 	    do
@@ -2571,8 +2576,10 @@ ins_compl_show_pum()
 	    if (compl_match_array[i].pum_text == compl_shown_match->cp_str
 		    || compl_match_array[i].pum_text
 				      == compl_shown_match->cp_text[CPT_ABBR])
+	    {
+		cur = i;
 		break;
-	cur = i;
+	    }
     }
 
     if (compl_match_array != NULL)
@@ -2951,6 +2958,8 @@ ins_compl_bs()
 	ins_compl_free();
 	compl_started = FALSE;
 	compl_matches = 0;
+	compl_cont_status = 0;
+	compl_cont_mode = 0;
     }
 
     line = ml_get_curline();
@@ -2983,6 +2992,15 @@ ins_compl_bs()
 	    }
 	}
 
+	/* Go to the original text, since none of the matches is inserted. */
+	if (compl_first_match->cp_prev != NULL
+		&& (compl_first_match->cp_prev->cp_flags & ORIGINAL_TEXT))
+	    compl_shown_match = compl_first_match->cp_prev;
+	else
+	    compl_shown_match = compl_first_match;
+	compl_curr_match = compl_shown_match;
+	compl_shows_dir = compl_direction;
+
 	/* Show the popup menu with a different set of matches. */
 	ins_compl_show_pum();
 	compl_used_match = FALSE;