Karsten Hopp 760944
To: vim_dev@googlegroups.com
Karsten Hopp 760944
Subject: Patch 7.3.352
Karsten Hopp 760944
Fcc: outbox
Karsten Hopp 760944
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 760944
Mime-Version: 1.0
Karsten Hopp 760944
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 760944
Content-Transfer-Encoding: 8bit
Karsten Hopp 760944
------------
Karsten Hopp 760944
Karsten Hopp 760944
Patch 7.3.352
Karsten Hopp 760944
Problem:    When completing methods dict functions and script-local functions
Karsten Hopp 760944
	    get in the way.
Karsten Hopp 760944
Solution:   Sort function names starting with "<" to the end. (Yasuhiro
Karsten Hopp 760944
	    Matsumoto)
Karsten Hopp 760944
Files:	    src/ex_getln.c
Karsten Hopp 760944
Karsten Hopp 760944
Karsten Hopp 760944
*** ../vim-7.3.351/src/ex_getln.c	2011-09-30 17:46:14.000000000 +0200
Karsten Hopp 760944
--- src/ex_getln.c	2011-10-26 21:37:53.000000000 +0200
Karsten Hopp 760944
***************
Karsten Hopp 760944
*** 121,126 ****
Karsten Hopp 760944
--- 121,134 ----
Karsten Hopp 760944
  static int	ex_window __ARGS((void));
Karsten Hopp 760944
  #endif
Karsten Hopp 760944
  
Karsten Hopp 760944
+ #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
Karsten Hopp 760944
+ static int
Karsten Hopp 760944
+ #ifdef __BORLANDC__
Karsten Hopp 760944
+ _RTLENTRYF
Karsten Hopp 760944
+ #endif
Karsten Hopp 760944
+ sort_func_compare __ARGS((const void *s1, const void *s2));
Karsten Hopp 760944
+ #endif
Karsten Hopp 760944
+ 
Karsten Hopp 760944
  /*
Karsten Hopp 760944
   * getcmdline() - accept a command line starting with firstc.
Karsten Hopp 760944
   *
Karsten Hopp 760944
***************
Karsten Hopp 760944
*** 3286,3291 ****
Karsten Hopp 760944
--- 3294,3317 ----
Karsten Hopp 760944
      return check_abbr(c, ccline.cmdbuff, ccline.cmdpos, 0);
Karsten Hopp 760944
  }
Karsten Hopp 760944
  
Karsten Hopp 760944
+ #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
Karsten Hopp 760944
+     static int
Karsten Hopp 760944
+ #ifdef __BORLANDC__
Karsten Hopp 760944
+ _RTLENTRYF
Karsten Hopp 760944
+ #endif
Karsten Hopp 760944
+ sort_func_compare(s1, s2)
Karsten Hopp 760944
+     const void *s1;
Karsten Hopp 760944
+     const void *s2;
Karsten Hopp 760944
+ {
Karsten Hopp 760944
+     char_u *p1 = *(char_u **)s1;
Karsten Hopp 760944
+     char_u *p2 = *(char_u **)s2;
Karsten Hopp 760944
+ 
Karsten Hopp 760944
+     if (*p1 != '<' && *p2 == '<') return -1;
Karsten Hopp 760944
+     if (*p1 == '<' && *p2 != '<') return 1;
Karsten Hopp 760944
+     return STRCMP(p1, p2);
Karsten Hopp 760944
+ }
Karsten Hopp 760944
+ #endif
Karsten Hopp 760944
+ 
Karsten Hopp 760944
  /*
Karsten Hopp 760944
   * Return FAIL if this is not an appropriate context in which to do
Karsten Hopp 760944
   * completion of anything, return OK if it is (even if there are no matches).
Karsten Hopp 760944
***************
Karsten Hopp 760944
*** 4735,4741 ****
Karsten Hopp 760944
  
Karsten Hopp 760944
      /* Sort the results.  Keep menu's in the specified order. */
Karsten Hopp 760944
      if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS)
Karsten Hopp 760944
! 	sort_strings(*file, *num_file);
Karsten Hopp 760944
  
Karsten Hopp 760944
  #ifdef FEAT_CMDL_COMPL
Karsten Hopp 760944
      /* Reset the variables used for special highlight names expansion, so that
Karsten Hopp 760944
--- 4761,4776 ----
Karsten Hopp 760944
  
Karsten Hopp 760944
      /* Sort the results.  Keep menu's in the specified order. */
Karsten Hopp 760944
      if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS)
Karsten Hopp 760944
!     {
Karsten Hopp 760944
! 	if (xp->xp_context == EXPAND_EXPRESSION
Karsten Hopp 760944
! 		|| xp->xp_context == EXPAND_FUNCTIONS
Karsten Hopp 760944
! 		|| xp->xp_context == EXPAND_USER_FUNC)
Karsten Hopp 760944
! 	    /* <SNR> functions should be sorted to the end. */
Karsten Hopp 760944
! 	    qsort((void *)*file, (size_t)*num_file, sizeof(char_u *),
Karsten Hopp 760944
! 							   sort_func_compare);
Karsten Hopp 760944
! 	else
Karsten Hopp 760944
! 	    sort_strings(*file, *num_file);
Karsten Hopp 760944
!     }
Karsten Hopp 760944
  
Karsten Hopp 760944
  #ifdef FEAT_CMDL_COMPL
Karsten Hopp 760944
      /* Reset the variables used for special highlight names expansion, so that
Karsten Hopp 760944
*** ../vim-7.3.351/src/version.c	2011-10-26 17:04:23.000000000 +0200
Karsten Hopp 760944
--- src/version.c	2011-10-26 21:49:53.000000000 +0200
Karsten Hopp 760944
***************
Karsten Hopp 760944
*** 716,717 ****
Karsten Hopp 760944
--- 716,719 ----
Karsten Hopp 760944
  {   /* Add new patch number below this line */
Karsten Hopp 760944
+ /**/
Karsten Hopp 760944
+     352,
Karsten Hopp 760944
  /**/
Karsten Hopp 760944
Karsten Hopp 760944
-- 
Karsten Hopp 760944
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 760944
94. Now admit it... How many of you have made "modem noises" into
Karsten Hopp 760944
    the phone just to see if it was possible? :-)
Karsten Hopp 760944
Karsten Hopp 760944
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 760944
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 760944
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 760944
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///