Mirror of the Vim source from https://github.com/vim/vim
Revision | 75ab683fdb50e83cb9037454f5dd8d602e08e4c1 (tree) |
---|---|
Time | 2008-01-18 21:16:16 |
Author | vimboss |
Commiter | vimboss |
updated for version 7.1-233
@@ -4655,7 +4655,7 @@ | ||
4655 | 4655 | static void * call_user_expand_func __ARGS((void *(*user_expand_func) __ARGS((char_u *, int, char_u **, int)), expand_T *xp, int *num_file, char_u ***file)); |
4656 | 4656 | |
4657 | 4657 | /* |
4658 | - * call "user_expand_func()" to invoke a user defined VimL function and return | |
4658 | + * Call "user_expand_func()" to invoke a user defined VimL function and return | |
4659 | 4659 | * the result (either a string or a List). |
4660 | 4660 | */ |
4661 | 4661 | static void * |
@@ -4677,11 +4677,22 @@ | ||
4677 | 4677 | *num_file = 0; |
4678 | 4678 | *file = NULL; |
4679 | 4679 | |
4680 | - keep = ccline.cmdbuff[ccline.cmdlen]; | |
4681 | - ccline.cmdbuff[ccline.cmdlen] = 0; | |
4682 | - sprintf((char *)num, "%d", ccline.cmdpos); | |
4680 | + if (ccline.cmdbuff == NULL) | |
4681 | + { | |
4682 | + /* Completion from Insert mode, pass fake arguments. */ | |
4683 | + keep = 0; | |
4684 | + sprintf((char *)num, "%d", STRLEN(xp->xp_pattern)); | |
4685 | + args[1] = xp->xp_pattern; | |
4686 | + } | |
4687 | + else | |
4688 | + { | |
4689 | + /* Completion on the command line, pass real arguments. */ | |
4690 | + keep = ccline.cmdbuff[ccline.cmdlen]; | |
4691 | + ccline.cmdbuff[ccline.cmdlen] = 0; | |
4692 | + sprintf((char *)num, "%d", ccline.cmdpos); | |
4693 | + args[1] = ccline.cmdbuff; | |
4694 | + } | |
4683 | 4695 | args[0] = xp->xp_pattern; |
4684 | - args[1] = ccline.cmdbuff; | |
4685 | 4696 | args[2] = num; |
4686 | 4697 | |
4687 | 4698 | /* Save the cmdline, we don't know what the function may do. */ |
@@ -4694,8 +4705,8 @@ | ||
4694 | 4705 | |
4695 | 4706 | ccline = save_ccline; |
4696 | 4707 | current_SID = save_current_SID; |
4697 | - | |
4698 | - ccline.cmdbuff[ccline.cmdlen] = keep; | |
4708 | + if (ccline.cmdbuff != NULL) | |
4709 | + ccline.cmdbuff[ccline.cmdlen] = keep; | |
4699 | 4710 | |
4700 | 4711 | return ret; |
4701 | 4712 | } |
@@ -667,6 +667,8 @@ | ||
667 | 667 | static int included_patches[] = |
668 | 668 | { /* Add new patch number below this line */ |
669 | 669 | /**/ |
670 | + 233, | |
671 | +/**/ | |
670 | 672 | 232, |
671 | 673 | /**/ |
672 | 674 | 231, |