diff src/edit.c @ 497:73f10d8124f4 v7.0136

updated for version 7.0136
author vimboss
date Wed, 24 Aug 2005 22:16:11 +0000
parents f012c4ed8c38
children 08012a1ff8d4
line wrap: on
line diff
--- a/src/edit.c
+++ b/src/edit.c
@@ -137,6 +137,7 @@ static void start_arrow __ARGS((pos_T *e
 #ifdef FEAT_SYN_HL
 static void check_spell_redraw __ARGS((void));
 static void spell_back_to_badword __ARGS((void));
+static int  spell_bad_len = 0;	/* length of located bad word */
 #endif
 static void stop_insert __ARGS((pos_T *end_insert_pos, int esc));
 static int  echeck_abbr __ARGS((int));
@@ -3536,8 +3537,11 @@ ins_complete(c)
 	else if (ctrl_x_mode == CTRL_X_SPELL)
 	{
 #ifdef FEAT_SYN_HL
-	    compl_col = spell_word_start(startcol);
-	    if (compl_col == (colnr_T)startcol)
+	    if (spell_bad_len > 0)
+		compl_col = curs_col - spell_bad_len;
+	    else
+		compl_col = spell_word_start(startcol);
+	    if (compl_col >= (colnr_T)startcol)
 		return FAIL;
 	    compl_length = (int)curs_col - compl_col;
 	    compl_pattern = vim_strnsave(line + compl_col, compl_length);
@@ -4806,7 +4810,7 @@ spell_back_to_badword()
 {
     pos_T	tpos = curwin->w_cursor;
 
-    spell_move_to(BACKWARD, TRUE, TRUE);
+    spell_bad_len = spell_move_to(BACKWARD, TRUE, TRUE);
     if (curwin->w_cursor.col != tpos.col)
 	start_arrow(&tpos);
 }