Skip to content

Commit a9a4808

Browse files
committed
updated for version 7.3.352
Problem: When completing methods dict functions and script-local functions get in the way. Solution: Sort function names starting with "<" to the end. (Yasuhiro Matsumoto)
1 parent 2c85ee3 commit a9a4808

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

src/ex_getln.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ static int ExpandUserList __ARGS((expand_T *xp, int *num_file, char_u ***file));
121121
static int ex_window __ARGS((void));
122122
#endif
123123

124+
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
125+
static int
126+
#ifdef __BORLANDC__
127+
_RTLENTRYF
128+
#endif
129+
sort_func_compare __ARGS((const void *s1, const void *s2));
130+
#endif
131+
124132
/*
125133
* getcmdline() - accept a command line starting with firstc.
126134
*
@@ -3286,6 +3294,24 @@ ccheck_abbr(c)
32863294
return check_abbr(c, ccline.cmdbuff, ccline.cmdpos, 0);
32873295
}
32883296

3297+
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
3298+
static int
3299+
#ifdef __BORLANDC__
3300+
_RTLENTRYF
3301+
#endif
3302+
sort_func_compare(s1, s2)
3303+
const void *s1;
3304+
const void *s2;
3305+
{
3306+
char_u *p1 = *(char_u **)s1;
3307+
char_u *p2 = *(char_u **)s2;
3308+
3309+
if (*p1 != '<' && *p2 == '<') return -1;
3310+
if (*p1 == '<' && *p2 != '<') return 1;
3311+
return STRCMP(p1, p2);
3312+
}
3313+
#endif
3314+
32893315
/*
32903316
* Return FAIL if this is not an appropriate context in which to do
32913317
* completion of anything, return OK if it is (even if there are no matches).
@@ -4735,7 +4761,16 @@ ExpandGeneric(xp, regmatch, num_file, file, func, escaped)
47354761

47364762
/* Sort the results. Keep menu's in the specified order. */
47374763
if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS)
4738-
sort_strings(*file, *num_file);
4764+
{
4765+
if (xp->xp_context == EXPAND_EXPRESSION
4766+
|| xp->xp_context == EXPAND_FUNCTIONS
4767+
|| xp->xp_context == EXPAND_USER_FUNC)
4768+
/* <SNR> functions should be sorted to the end. */
4769+
qsort((void *)*file, (size_t)*num_file, sizeof(char_u *),
4770+
sort_func_compare);
4771+
else
4772+
sort_strings(*file, *num_file);
4773+
}
47394774

47404775
#ifdef FEAT_CMDL_COMPL
47414776
/* Reset the variables used for special highlight names expansion, so that

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ static char *(features[]) =
714714

715715
static int included_patches[] =
716716
{ /* Add new patch number below this line */
717+
/**/
718+
352,
717719
/**/
718720
351,
719721
/**/

0 commit comments

Comments
 (0)