Mirror of the Vim source from https://github.com/vim/vim
Révision | b0dabd584b8f89ac32af9758c221e948016e2b0e (tree) |
---|---|
l'heure | 2007-12-10 04:26:44 |
Auteur | vimboss |
Commiter | vimboss |
updated for version 7.1-175
@@ -8189,6 +8189,29 @@ | ||
8189 | 8189 | AppendCharToRedobuff(K_DEL); |
8190 | 8190 | } |
8191 | 8191 | |
8192 | +static void ins_bs_one __ARGS((colnr_T *vcolp)); | |
8193 | + | |
8194 | +/* | |
8195 | + * Delete one character for ins_bs(). | |
8196 | + */ | |
8197 | + static void | |
8198 | +ins_bs_one(vcolp) | |
8199 | + colnr_T *vcolp; | |
8200 | +{ | |
8201 | + dec_cursor(); | |
8202 | + getvcol(curwin, &curwin->w_cursor, vcolp, NULL, NULL); | |
8203 | + if (State & REPLACE_FLAG) | |
8204 | + { | |
8205 | + /* Don't delete characters before the insert point when in | |
8206 | + * Replace mode */ | |
8207 | + if (curwin->w_cursor.lnum != Insstart.lnum | |
8208 | + || curwin->w_cursor.col >= Insstart.col) | |
8209 | + replace_do_bs(); | |
8210 | + } | |
8211 | + else | |
8212 | + (void)del_char(FALSE); | |
8213 | +} | |
8214 | + | |
8192 | 8215 | /* |
8193 | 8216 | * Handle Backspace, delete-word and delete-line in Insert mode. |
8194 | 8217 | * Return TRUE when backspace was actually used. |
@@ -8418,9 +8441,7 @@ | ||
8418 | 8441 | int ts; |
8419 | 8442 | colnr_T vcol; |
8420 | 8443 | colnr_T want_vcol; |
8421 | -#if 0 | |
8422 | - int extra = 0; | |
8423 | -#endif | |
8444 | + colnr_T start_vcol; | |
8424 | 8445 | |
8425 | 8446 | *inserted_space_p = FALSE; |
8426 | 8447 | if (p_sta && in_indent) |
@@ -8431,6 +8452,7 @@ | ||
8431 | 8452 | * 'showbreak' may get in the way, need to get the last column of |
8432 | 8453 | * the previous character. */ |
8433 | 8454 | getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); |
8455 | + start_vcol = vcol; | |
8434 | 8456 | dec_cursor(); |
8435 | 8457 | getvcol(curwin, &curwin->w_cursor, NULL, NULL, &want_vcol); |
8436 | 8458 | inc_cursor(); |
@@ -8439,30 +8461,7 @@ | ||
8439 | 8461 | /* delete characters until we are at or before want_vcol */ |
8440 | 8462 | while (vcol > want_vcol |
8441 | 8463 | && (cc = *(ml_get_cursor() - 1), vim_iswhite(cc))) |
8442 | - { | |
8443 | - dec_cursor(); | |
8444 | - getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); | |
8445 | - if (State & REPLACE_FLAG) | |
8446 | - { | |
8447 | - /* Don't delete characters before the insert point when in | |
8448 | - * Replace mode */ | |
8449 | - if (curwin->w_cursor.lnum != Insstart.lnum | |
8450 | - || curwin->w_cursor.col >= Insstart.col) | |
8451 | - { | |
8452 | -#if 0 /* what was this for? It causes problems when sw != ts. */ | |
8453 | - if (State == REPLACE && (int)vcol < want_vcol) | |
8454 | - { | |
8455 | - (void)del_char(FALSE); | |
8456 | - extra = 2; /* don't pop too much */ | |
8457 | - } | |
8458 | - else | |
8459 | -#endif | |
8460 | - replace_do_bs(); | |
8461 | - } | |
8462 | - } | |
8463 | - else | |
8464 | - (void)del_char(FALSE); | |
8465 | - } | |
8464 | + ins_bs_one(&vcol); | |
8466 | 8465 | |
8467 | 8466 | /* insert extra spaces until we are at want_vcol */ |
8468 | 8467 | while (vcol < want_vcol) |
@@ -8479,22 +8478,16 @@ | ||
8479 | 8478 | #endif |
8480 | 8479 | { |
8481 | 8480 | ins_str((char_u *)" "); |
8482 | - if ((State & REPLACE_FLAG) /* && extra <= 1 */) | |
8483 | - { | |
8484 | -#if 0 | |
8485 | - if (extra) | |
8486 | - replace_push_off(NUL); | |
8487 | - else | |
8488 | -#endif | |
8489 | - replace_push(NUL); | |
8490 | - } | |
8491 | -#if 0 | |
8492 | - if (extra == 2) | |
8493 | - extra = 1; | |
8494 | -#endif | |
8481 | + if ((State & REPLACE_FLAG)) | |
8482 | + replace_push(NUL); | |
8495 | 8483 | } |
8496 | 8484 | getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); |
8497 | 8485 | } |
8486 | + | |
8487 | + /* If we are now back where we started delete one character. Can | |
8488 | + * happen when using 'sts' and 'linebreak'. */ | |
8489 | + if (vcol >= start_vcol) | |
8490 | + ins_bs_one(&vcol); | |
8498 | 8491 | } |
8499 | 8492 | |
8500 | 8493 | /* |
@@ -667,6 +667,8 @@ | ||
667 | 667 | static int included_patches[] = |
668 | 668 | { /* Add new patch number below this line */ |
669 | 669 | /**/ |
670 | + 175, | |
671 | +/**/ | |
670 | 672 | 174, |
671 | 673 | /**/ |
672 | 674 | 173, |