comparison src/buffer.c @ 27916:6efa2f193c94 v8.2.4483

patch 8.2.4483: command completion makes two rounds to collect matches Commit: https://github.com/vim/vim/commit/5de4c4372d4366bc85cb66efb3e373439b9471c5 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Feb 28 13:28:38 2022 +0000 patch 8.2.4483: command completion makes two rounds to collect matches Problem: Command completion makes two rounds to collect matches. Solution: Use a growarray to collect matches. (Yegappan Lakshmanan, closes #9860)
author Bram Moolenaar <Bram@vim.org>
date Mon, 28 Feb 2022 14:30:04 +0100
parents ae38d2e81fca
children a52a5e3363c4
comparison
equal deleted inserted replaced
27915:4058d89b7a48 27916:6efa2f193c94
2812 if ((score = fuzzy_match_str(buf->b_ffname, pat)) != 0) 2812 if ((score = fuzzy_match_str(buf->b_ffname, pat)) != 0)
2813 p = buf->b_ffname; 2813 p = buf->b_ffname;
2814 } 2814 }
2815 } 2815 }
2816 2816
2817 if (p != NULL) 2817 if (p == NULL)
2818 continue;
2819
2820 if (round == 1)
2818 { 2821 {
2819 if (round == 1) 2822 ++count;
2820 ++count; 2823 continue;
2824 }
2825
2826 if (options & WILD_HOME_REPLACE)
2827 p = home_replace_save(buf, p);
2828 else
2829 p = vim_strsave(p);
2830
2831 if (!fuzzy)
2832 {
2833 #ifdef FEAT_VIMINFO
2834 if (matches != NULL)
2835 {
2836 matches[count].buf = buf;
2837 matches[count].match = p;
2838 count++;
2839 }
2821 else 2840 else
2822 { 2841 #endif
2823 if (options & WILD_HOME_REPLACE) 2842 (*file)[count++] = p;
2824 p = home_replace_save(buf, p); 2843 }
2825 else 2844 else
2826 p = vim_strsave(p); 2845 {
2827 2846 fuzmatch[count].idx = count;
2828 if (!fuzzy) 2847 fuzmatch[count].str = p;
2829 { 2848 fuzmatch[count].score = score;
2830 #ifdef FEAT_VIMINFO 2849 count++;
2831 if (matches != NULL)
2832 {
2833 matches[count].buf = buf;
2834 matches[count].match = p;
2835 count++;
2836 }
2837 else
2838 #endif
2839 (*file)[count++] = p;
2840 }
2841 else
2842 {
2843 fuzmatch[count].idx = count;
2844 fuzmatch[count].str = p;
2845 fuzmatch[count].score = score;
2846 count++;
2847 }
2848 }
2849 } 2850 }
2850 } 2851 }
2851 if (count == 0) // no match found, break here 2852 if (count == 0) // no match found, break here
2852 break; 2853 break;
2853 if (round == 1) 2854 if (round == 1)