summaryrefslogtreecommitdiff
path: root/src/edit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/edit.c b/src/edit.c
index 96ebe717..b31177c5 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -137,6 +137,7 @@ static void start_arrow __ARGS((pos_T *end_insert_pos));
#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);
}