Mercurial > vim
comparison src/edit.c @ 1892:04613e770ec0 v7.2.189
updated for version 7.2-189
author | vimboss |
---|---|
date | Tue, 26 May 2009 09:02:10 +0000 |
parents | e8eeeff19eae |
children | f798c9043986 |
comparison
equal
deleted
inserted
replaced
1891:7a4ad3fb109d | 1892:04613e770ec0 |
---|---|
6418 /* If a space was inserted for auto-formatting, remove it now. */ | 6418 /* If a space was inserted for auto-formatting, remove it now. */ |
6419 check_auto_format(TRUE); | 6419 check_auto_format(TRUE); |
6420 | 6420 |
6421 /* If we just did an auto-indent, remove the white space from the end | 6421 /* If we just did an auto-indent, remove the white space from the end |
6422 * of the line, and put the cursor back. | 6422 * of the line, and put the cursor back. |
6423 * Do this when ESC was used or moving the cursor up/down. */ | 6423 * Do this when ESC was used or moving the cursor up/down. |
6424 * Check for the old position still being valid, just in case the text | |
6425 * got changed unexpectedly. */ | |
6424 if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL | 6426 if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL |
6425 && curwin->w_cursor.lnum != end_insert_pos->lnum))) | 6427 && curwin->w_cursor.lnum != end_insert_pos->lnum)) |
6428 && end_insert_pos->lnum <= curbuf->b_ml.ml_line_count) | |
6426 { | 6429 { |
6427 pos_T tpos = curwin->w_cursor; | 6430 pos_T tpos = curwin->w_cursor; |
6428 | 6431 |
6429 curwin->w_cursor = *end_insert_pos; | 6432 curwin->w_cursor = *end_insert_pos; |
6433 check_cursor_col(); /* make sure it is not past the line */ | |
6430 for (;;) | 6434 for (;;) |
6431 { | 6435 { |
6432 if (gchar_cursor() == NUL && curwin->w_cursor.col > 0) | 6436 if (gchar_cursor() == NUL && curwin->w_cursor.col > 0) |
6433 --curwin->w_cursor.col; | 6437 --curwin->w_cursor.col; |
6434 cc = gchar_cursor(); | 6438 cc = gchar_cursor(); |
6435 if (!vim_iswhite(cc)) | 6439 if (!vim_iswhite(cc)) |
6436 break; | 6440 break; |
6437 (void)del_char(TRUE); | 6441 if (del_char(TRUE) == FAIL) |
6442 break; /* should not happen */ | |
6438 } | 6443 } |
6439 if (curwin->w_cursor.lnum != tpos.lnum) | 6444 if (curwin->w_cursor.lnum != tpos.lnum) |
6440 curwin->w_cursor = tpos; | 6445 curwin->w_cursor = tpos; |
6441 else if (cc != NUL) | 6446 else if (cc != NUL) |
6442 ++curwin->w_cursor.col; /* put cursor back on the NUL */ | 6447 ++curwin->w_cursor.col; /* put cursor back on the NUL */ |