home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.1 / 7.1.145 < prev    next >
Encoding:
Internet Message Format  |  2007-11-19  |  6.0 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.1.145
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.1.145
  11. Problem:    Insert mode completion: When using the popup menu, after
  12.         completing a word and typing a non-word character Vim is still
  13.         completing the same word, following CTRL-N doesn't work.
  14.         Insert mode Completion: When using CTRL-X O and there is only
  15.         "struct." before the cursor, typing one char to reduce the
  16.         matches, then BS completion stops.
  17. Solution:   When typing a character that is not part of the item being
  18.         completed, stop complete mode.  For whole line completion also
  19.         accept a space.  For file name completion stop at a path
  20.         separator.
  21.         For omni completion stay in completion mode even if completing
  22.         with empty string.
  23. Files:        src/edit.c
  24.  
  25.  
  26. *** ../vim-7.1.144/src/edit.c    Thu Sep 13 18:25:08 2007
  27. --- src/edit.c    Fri Oct 19 16:04:38 2007
  28. ***************
  29. *** 129,134 ****
  30. --- 129,135 ----
  31.   
  32.   static void ins_ctrl_x __ARGS((void));
  33.   static int  has_compl_option __ARGS((int dict_opt));
  34. + static int  ins_compl_accept_char __ARGS((int c));
  35.   static int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags, int adup));
  36.   static int  ins_compl_equal __ARGS((compl_T *match, char_u *str, int len));
  37.   static void ins_compl_longest_match __ARGS((compl_T *match));
  38. ***************
  39. *** 754,761 ****
  40.               continue;
  41.           }
  42.   
  43. !         /* A printable, non-white character: Add to "compl_leader". */
  44. !         if (vim_isprintc(c) && !vim_iswhite(c))
  45.           {
  46.               ins_compl_addleader(c);
  47.               continue;
  48. --- 755,763 ----
  49.               continue;
  50.           }
  51.   
  52. !         /* A non-white character that fits in with the current
  53. !          * completion: Add to "compl_leader". */
  54. !         if (ins_compl_accept_char(c))
  55.           {
  56.               ins_compl_addleader(c);
  57.               continue;
  58. ***************
  59. *** 2053,2058 ****
  60. --- 2055,2094 ----
  61.   }
  62.   
  63.   /*
  64. +  * Return TRUE when character "c" is part of the item currently being
  65. +  * completed.  Used to decide whether to abandon complete mode when the menu
  66. +  * is visible.
  67. +  */
  68. +     static int
  69. + ins_compl_accept_char(c)
  70. +     int c;
  71. + {
  72. +     if (ctrl_x_mode & CTRL_X_WANT_IDENT)
  73. +     /* When expanding an identifier only accept identifier chars. */
  74. +     return vim_isIDc(c);
  75. +     switch (ctrl_x_mode)
  76. +     {
  77. +     case CTRL_X_FILES:
  78. +         /* When expanding file name only accept file name chars. But not
  79. +          * path separators, so that "proto/<Tab>" expands files in
  80. +          * "proto", not "proto/" as a whole */
  81. +         return vim_isfilec(c) && !vim_ispathsep(c);
  82. +     case CTRL_X_CMDLINE:
  83. +     case CTRL_X_OMNI:
  84. +         /* Command line and Omni completion can work with just about any
  85. +          * printable character, but do stop at white space. */
  86. +         return vim_isprintc(c) && !vim_iswhite(c);
  87. +     case CTRL_X_WHOLE_LINE:
  88. +         /* For while line completion a space can be part of the line. */
  89. +         return vim_isprintc(c);
  90. +     }
  91. +     return vim_iswordc(c);
  92. + }
  93. + /*
  94.    * This is like ins_compl_add(), but if 'ic' and 'inf' are set, then the
  95.    * case of the originally typed text is used, and the case of the completed
  96.    * text is inferred, ie this tries to work out what case you probably wanted
  97. ***************
  98. *** 3128,3135 ****
  99.       p = line + curwin->w_cursor.col;
  100.       mb_ptr_back(line, p);
  101.   
  102. !     /* Stop completion when the whole word was deleted. */
  103. !     if ((int)(p - line) - (int)compl_col <= 0)
  104.       return K_BS;
  105.   
  106.       /* Deleted more than what was used to find matches or didn't finish
  107. --- 3164,3174 ----
  108.       p = line + curwin->w_cursor.col;
  109.       mb_ptr_back(line, p);
  110.   
  111. !     /* Stop completion when the whole word was deleted.  For Omni completion
  112. !      * allow the word to be deleted, we won't match everything. */
  113. !     if ((int)(p - line) - (int)compl_col < 0
  114. !         || ((int)(p - line) - (int)compl_col == 0
  115. !         && (ctrl_x_mode & CTRL_X_OMNI) == 0))
  116.       return K_BS;
  117.   
  118.       /* Deleted more than what was used to find matches or didn't finish
  119. ***************
  120. *** 4591,4604 ****
  121.       curs_col = curwin->w_cursor.col;
  122.       compl_pending = 0;
  123.   
  124. !     /* if this same ctrl_x_mode has been interrupted use the text from
  125.        * "compl_startpos" to the cursor as a pattern to add a new word
  126.        * instead of expand the one before the cursor, in word-wise if
  127. !      * "compl_startpos"
  128. !      * is not in the same line as the cursor then fix it (the line has
  129. !      * been split because it was longer than 'tw').  if SOL is set then
  130. !      * skip the previous pattern, a word at the beginning of the line has
  131. !      * been inserted, we'll look for that  -- Acevedo. */
  132.       if ((compl_cont_status & CONT_INTRPT) == CONT_INTRPT
  133.                           && compl_cont_mode == ctrl_x_mode)
  134.       {
  135. --- 4630,4642 ----
  136.       curs_col = curwin->w_cursor.col;
  137.       compl_pending = 0;
  138.   
  139. !     /* If this same ctrl_x_mode has been interrupted use the text from
  140.        * "compl_startpos" to the cursor as a pattern to add a new word
  141.        * instead of expand the one before the cursor, in word-wise if
  142. !      * "compl_startpos" is not in the same line as the cursor then fix it
  143. !      * (the line has been split because it was longer than 'tw').  if SOL
  144. !      * is set then skip the previous pattern, a word at the beginning of
  145. !      * the line has been inserted, we'll look for that  -- Acevedo. */
  146.       if ((compl_cont_status & CONT_INTRPT) == CONT_INTRPT
  147.                           && compl_cont_mode == ctrl_x_mode)
  148.       {
  149. *** ../vim-7.1.144/src/version.c    Fri Oct 19 18:57:33 2007
  150. --- src/version.c    Fri Oct 19 20:38:21 2007
  151. ***************
  152. *** 668,669 ****
  153. --- 668,671 ----
  154.   {   /* Add new patch number below this line */
  155. + /**/
  156. +     145,
  157.   /**/
  158.  
  159. -- 
  160. Micro$oft: where do you want to go today?
  161.     Linux: where do you want to go tomorrow?
  162.   FreeBSD: are you guys coming, or what?
  163.  
  164.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  165. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  166. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  167.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  168.