comparison src/edit.c @ 484:f012c4ed8c38 v7.0132

updated for version 7.0132
author vimboss
date Fri, 19 Aug 2005 20:40:30 +0000
parents f8b75b8f1988
children 73f10d8124f4
comparison
equal deleted inserted replaced
483:70afa17bfc01 484:f012c4ed8c38
134 static void check_auto_format __ARGS((int)); 134 static void check_auto_format __ARGS((int));
135 static void redo_literal __ARGS((int c)); 135 static void redo_literal __ARGS((int c));
136 static void start_arrow __ARGS((pos_T *end_insert_pos)); 136 static void start_arrow __ARGS((pos_T *end_insert_pos));
137 #ifdef FEAT_SYN_HL 137 #ifdef FEAT_SYN_HL
138 static void check_spell_redraw __ARGS((void)); 138 static void check_spell_redraw __ARGS((void));
139 static void spell_back_to_badword __ARGS((void));
139 #endif 140 #endif
140 static void stop_insert __ARGS((pos_T *end_insert_pos, int esc)); 141 static void stop_insert __ARGS((pos_T *end_insert_pos, int esc));
141 static int echeck_abbr __ARGS((int)); 142 static int echeck_abbr __ARGS((int));
142 static void replace_push_off __ARGS((int c)); 143 static void replace_push_off __ARGS((int c));
143 static int replace_pop __ARGS((void)); 144 static int replace_pop __ARGS((void));
2363 ctrl_x_mode = CTRL_X_OCCULT; 2364 ctrl_x_mode = CTRL_X_OCCULT;
2364 break; 2365 break;
2365 case 's': 2366 case 's':
2366 case Ctrl_S: 2367 case Ctrl_S:
2367 ctrl_x_mode = CTRL_X_SPELL; 2368 ctrl_x_mode = CTRL_X_SPELL;
2369 #ifdef FEAT_SYN_HL
2370 spell_back_to_badword();
2371 #endif
2368 break; 2372 break;
2369 case Ctrl_RSB: 2373 case Ctrl_RSB:
2370 ctrl_x_mode = CTRL_X_TAGS; 2374 ctrl_x_mode = CTRL_X_TAGS;
2371 break; 2375 break;
2372 #ifdef FEAT_FIND_ID 2376 #ifdef FEAT_FIND_ID
3531 } 3535 }
3532 else if (ctrl_x_mode == CTRL_X_SPELL) 3536 else if (ctrl_x_mode == CTRL_X_SPELL)
3533 { 3537 {
3534 #ifdef FEAT_SYN_HL 3538 #ifdef FEAT_SYN_HL
3535 compl_col = spell_word_start(startcol); 3539 compl_col = spell_word_start(startcol);
3536 if (compl_col == startcol) 3540 if (compl_col == (colnr_T)startcol)
3537 return FAIL; 3541 return FAIL;
3538 compl_length = (int)curs_col - compl_col; 3542 compl_length = (int)curs_col - compl_col;
3539 compl_pattern = vim_strnsave(line + compl_col, compl_length); 3543 compl_pattern = vim_strnsave(line + compl_col, compl_length);
3540 if (compl_pattern == NULL) 3544 if (compl_pattern == NULL)
3541 #endif 3545 #endif
4757 AppendCharToRedobuff(c); 4761 AppendCharToRedobuff(c);
4758 } 4762 }
4759 4763
4760 /* 4764 /*
4761 * start_arrow() is called when an arrow key is used in insert mode. 4765 * start_arrow() is called when an arrow key is used in insert mode.
4762 * It resembles hitting the <ESC> key. 4766 * For undo/redo it resembles hitting the <ESC> key.
4763 */ 4767 */
4764 static void 4768 static void
4765 start_arrow(end_insert_pos) 4769 start_arrow(end_insert_pos)
4766 pos_T *end_insert_pos; 4770 pos_T *end_insert_pos;
4767 { 4771 {
4789 linenr_T lnum = spell_redraw_lnum; 4793 linenr_T lnum = spell_redraw_lnum;
4790 4794
4791 spell_redraw_lnum = 0; 4795 spell_redraw_lnum = 0;
4792 redrawWinline(lnum, FALSE); 4796 redrawWinline(lnum, FALSE);
4793 } 4797 }
4798 }
4799
4800 /*
4801 * Called when starting CTRL_X_SPELL mode: Move backwards to a previous badly
4802 * spelled word, if there is one.
4803 */
4804 static void
4805 spell_back_to_badword()
4806 {
4807 pos_T tpos = curwin->w_cursor;
4808
4809 spell_move_to(BACKWARD, TRUE, TRUE);
4810 if (curwin->w_cursor.col != tpos.col)
4811 start_arrow(&tpos);
4794 } 4812 }
4795 #endif 4813 #endif
4796 4814
4797 /* 4815 /*
4798 * stop_arrow() is called before a change is made in insert mode. 4816 * stop_arrow() is called before a change is made in insert mode.