Mirror of the Vim source from https://github.com/vim/vim
Révision | 2e1e9b708941e1cfc2c0540196719f78e1ab18f5 (tree) |
---|---|
l'heure | 2006-06-23 00:13:21 |
Auteur | vimboss |
Commiter | vimboss |
updated for version 7.0-023
@@ -719,9 +719,14 @@ | ||
719 | 719 | #ifdef FEAT_INS_EXPAND |
720 | 720 | /* |
721 | 721 | * Special handling of keys while the popup menu is visible or wanted |
722 | - * and the cursor is still in the completed word. | |
722 | + * and the cursor is still in the completed word. Only when there is | |
723 | + * a match, skip this when no matches were found. | |
723 | 724 | */ |
724 | - if (compl_started && pum_wanted() && curwin->w_cursor.col >= compl_col) | |
725 | + if (compl_started | |
726 | + && pum_wanted() | |
727 | + && curwin->w_cursor.col >= compl_col | |
728 | + && (compl_shown_match == NULL | |
729 | + || compl_shown_match != compl_shown_match->cp_next)) | |
725 | 730 | { |
726 | 731 | /* BS: Delete one character from "compl_leader". */ |
727 | 732 | if ((c == K_BS || c == Ctrl_H) |
@@ -3393,16 +3398,21 @@ | ||
3393 | 3398 | ptr = compl_leader; |
3394 | 3399 | else |
3395 | 3400 | ptr = compl_orig_text; |
3396 | - p = compl_orig_text; | |
3397 | - for (temp = 0; p[temp] != NUL && p[temp] == ptr[temp]; ++temp) | |
3398 | - ; | |
3401 | + if (compl_orig_text != NULL) | |
3402 | + { | |
3403 | + p = compl_orig_text; | |
3404 | + for (temp = 0; p[temp] != NUL && p[temp] == ptr[temp]; | |
3405 | + ++temp) | |
3406 | + ; | |
3399 | 3407 | #ifdef FEAT_MBYTE |
3400 | - if (temp > 0) | |
3401 | - temp -= (*mb_head_off)(compl_orig_text, p + temp); | |
3402 | -#endif | |
3403 | - for (p += temp; *p != NUL; mb_ptr_adv(p)) | |
3404 | - AppendCharToRedobuff(K_BS); | |
3405 | - AppendToRedobuffLit(ptr + temp, -1); | |
3408 | + if (temp > 0) | |
3409 | + temp -= (*mb_head_off)(compl_orig_text, p + temp); | |
3410 | +#endif | |
3411 | + for (p += temp; *p != NUL; mb_ptr_adv(p)) | |
3412 | + AppendCharToRedobuff(K_BS); | |
3413 | + } | |
3414 | + if (ptr != NULL) | |
3415 | + AppendToRedobuffLit(ptr + temp, -1); | |
3406 | 3416 | } |
3407 | 3417 | |
3408 | 3418 | #ifdef FEAT_CINDENT |
@@ -4650,10 +4660,18 @@ | ||
4650 | 4660 | (int)STRLEN(compl_pattern), curs_col); |
4651 | 4661 | if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL |
4652 | 4662 | || compl_xp.xp_context == EXPAND_NOTHING) |
4653 | - return FAIL; | |
4654 | - startcol = (int)(compl_xp.xp_pattern - compl_pattern); | |
4655 | - compl_col = startcol; | |
4656 | - compl_length = curs_col - startcol; | |
4663 | + { | |
4664 | + compl_col = curs_col; | |
4665 | + compl_length = 0; | |
4666 | + vim_free(compl_pattern); | |
4667 | + compl_pattern = NULL; | |
4668 | + } | |
4669 | + else | |
4670 | + { | |
4671 | + startcol = (int)(compl_xp.xp_pattern - compl_pattern); | |
4672 | + compl_col = startcol; | |
4673 | + compl_length = curs_col - startcol; | |
4674 | + } | |
4657 | 4675 | } |
4658 | 4676 | else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI) |
4659 | 4677 | { |
@@ -4707,11 +4725,17 @@ | ||
4707 | 4725 | else |
4708 | 4726 | compl_col = spell_word_start(startcol); |
4709 | 4727 | if (compl_col >= (colnr_T)startcol) |
4710 | - return FAIL; | |
4711 | - spell_expand_check_cap(compl_col); | |
4728 | + { | |
4729 | + compl_length = 0; | |
4730 | + compl_col = curs_col; | |
4731 | + } | |
4732 | + else | |
4733 | + { | |
4734 | + spell_expand_check_cap(compl_col); | |
4735 | + compl_length = (int)curs_col - compl_col; | |
4736 | + } | |
4712 | 4737 | /* Need to obtain "line" again, it may have become invalid. */ |
4713 | 4738 | line = ml_get(curwin->w_cursor.lnum); |
4714 | - compl_length = (int)curs_col - compl_col; | |
4715 | 4739 | compl_pattern = vim_strnsave(line + compl_col, compl_length); |
4716 | 4740 | if (compl_pattern == NULL) |
4717 | 4741 | #endif |
@@ -667,6 +667,8 @@ | ||
667 | 667 | static int included_patches[] = |
668 | 668 | { /* Add new patch number below this line */ |
669 | 669 | /**/ |
670 | + 23, | |
671 | +/**/ | |
670 | 672 | 22, |
671 | 673 | /**/ |
672 | 674 | 21, |