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.0 / 7.0.035 < prev    next >
Encoding:
Internet Message Format  |  2006-06-22  |  5.8 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.0.035
  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.0.035
  11. Problem:    Insert mode completion works when typed but not when replayed from
  12.         a register. (Hari Krishna Dara)
  13.         Also: Mappings for Insert mode completion don't always work.
  14. Solution:   When finding a non-completion key in the input don't interrupt
  15.         completion when it wasn't typed.
  16.         Do use mappings when checking for typeahead while still finding
  17.         completions.  Avoids that completion is interrupted too soon.
  18.         Use "compl_pending" in a different way.
  19. Files:        src/edit.c
  20.  
  21.  
  22. *** ../vim-7.0.034/src/edit.c    Fri Jun 23 17:59:26 2006
  23. --- src/edit.c    Fri Jun 23 21:32:42 2006
  24. ***************
  25. *** 4166,4173 ****
  26.       {
  27.       if (compl_shows_dir == FORWARD && compl_shown_match->cp_next != NULL)
  28.       {
  29. -         if (compl_pending != 0)
  30. -         --compl_pending;
  31.           compl_shown_match = compl_shown_match->cp_next;
  32.           found_end = (compl_first_match != NULL
  33.                  && (compl_shown_match->cp_next == compl_first_match
  34. --- 4166,4171 ----
  35. ***************
  36. *** 4176,4189 ****
  37.       else if (compl_shows_dir == BACKWARD
  38.                       && compl_shown_match->cp_prev != NULL)
  39.       {
  40. -         if (compl_pending != 0)
  41. -         ++compl_pending;
  42.           found_end = (compl_shown_match == compl_first_match);
  43.           compl_shown_match = compl_shown_match->cp_prev;
  44.           found_end |= (compl_shown_match == compl_first_match);
  45.       }
  46.       else
  47.       {
  48.           if (advance)
  49.           {
  50.           if (compl_shows_dir == BACKWARD)
  51. --- 4174,4197 ----
  52.       else if (compl_shows_dir == BACKWARD
  53.                       && compl_shown_match->cp_prev != NULL)
  54.       {
  55.           found_end = (compl_shown_match == compl_first_match);
  56.           compl_shown_match = compl_shown_match->cp_prev;
  57.           found_end |= (compl_shown_match == compl_first_match);
  58.       }
  59.       else
  60.       {
  61. +         if (!allow_get_expansion)
  62. +         {
  63. +         if (advance)
  64. +         {
  65. +             if (compl_shows_dir == BACKWARD)
  66. +             compl_pending -= todo + 1;
  67. +             else
  68. +             compl_pending += todo + 1;
  69. +         }
  70. +         return -1;
  71. +         }
  72.           if (advance)
  73.           {
  74.           if (compl_shows_dir == BACKWARD)
  75. ***************
  76. *** 4191,4204 ****
  77.           else
  78.               ++compl_pending;
  79.           }
  80. -         if (!allow_get_expansion)
  81. -         return -1;
  82.   
  83.           /* Find matches. */
  84.           num_matches = ins_compl_get_exp(&compl_startpos);
  85. !         if (compl_pending != 0 && compl_direction == compl_shows_dir
  86.                                      && advance)
  87. !         compl_shown_match = compl_curr_match;
  88.           found_end = FALSE;
  89.       }
  90.       if ((compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0
  91. --- 4199,4225 ----
  92.           else
  93.               ++compl_pending;
  94.           }
  95.   
  96.           /* Find matches. */
  97.           num_matches = ins_compl_get_exp(&compl_startpos);
  98. !         /* handle any pending completions */
  99. !         while (compl_pending != 0 && compl_direction == compl_shows_dir
  100.                                      && advance)
  101. !         {
  102. !         if (compl_pending > 0 && compl_shown_match->cp_next != NULL)
  103. !         {
  104. !             compl_shown_match = compl_shown_match->cp_next;
  105. !             --compl_pending;
  106. !         }
  107. !         if (compl_pending < 0 && compl_shown_match->cp_prev != NULL)
  108. !         {
  109. !             compl_shown_match = compl_shown_match->cp_prev;
  110. !             ++compl_pending;
  111. !         }
  112. !         else
  113. !             break;
  114. !         }
  115.           found_end = FALSE;
  116.       }
  117.       if ((compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0
  118. ***************
  119. *** 4307,4315 ****
  120.       return;
  121.       count = 0;
  122.   
  123. !     ++no_mapping;
  124.       c = vpeekc_any();
  125. -     --no_mapping;
  126.       if (c != NUL)
  127.       {
  128.       if (vim_is_ctrl_x_key(c) && c != Ctrl_X && c != Ctrl_R)
  129. --- 4328,4336 ----
  130.       return;
  131.       count = 0;
  132.   
  133. !     /* Check for a typed key.  Do use mappings, otherwise vim_is_ctrl_x_key()
  134. !      * can't do its work correctly. */
  135.       c = vpeekc_any();
  136.       if (c != NUL)
  137.       {
  138.       if (vim_is_ctrl_x_key(c) && c != Ctrl_X && c != Ctrl_R)
  139. ***************
  140. *** 4319,4330 ****
  141.           (void)ins_compl_next(FALSE, ins_compl_key2count(c),
  142.                               c != K_UP && c != K_DOWN);
  143.       }
  144. !     else if (c != Ctrl_R)
  145. !         compl_interrupted = TRUE;
  146.       }
  147.       if (compl_pending != 0 && !got_int)
  148. !     (void)ins_compl_next(FALSE, compl_pending > 0
  149. !                       ? compl_pending : -compl_pending, TRUE);
  150.   }
  151.   
  152.   /*
  153. --- 4340,4366 ----
  154.           (void)ins_compl_next(FALSE, ins_compl_key2count(c),
  155.                               c != K_UP && c != K_DOWN);
  156.       }
  157. !     else
  158. !     {
  159. !         /* Need to get the character to have KeyTyped set.  We'll put it
  160. !          * back with vungetc() below. */
  161. !         c = safe_vgetc();
  162. !         /* Don't interrupt completion when the character wasn't typed,
  163. !          * e.g., when doing @q to replay keys. */
  164. !         if (c != Ctrl_R && KeyTyped)
  165. !         compl_interrupted = TRUE;
  166. !         vungetc(c);
  167. !     }
  168.       }
  169.       if (compl_pending != 0 && !got_int)
  170. !     {
  171. !     int todo = compl_pending > 0 ? compl_pending : -compl_pending;
  172. !     compl_pending = 0;
  173. !     (void)ins_compl_next(FALSE, todo, TRUE);
  174. !     }
  175.   }
  176.   
  177.   /*
  178. *** ../vim-7.0.034/src/version.c    Fri Jun 23 17:59:26 2006
  179. --- src/version.c    Fri Jun 23 21:35:39 2006
  180. ***************
  181. *** 668,669 ****
  182. --- 668,671 ----
  183.   {   /* Add new patch number below this line */
  184. + /**/
  185. +     35,
  186.   /**/
  187.  
  188. -- 
  189. So when I saw the post to comp.editors, I rushed over to the FTP site to
  190. grab it.  So I yank apart the tarball, light x candles, where x= the
  191. vim version multiplied by the md5sum of the source divided by the MAC of
  192. my NIC (8A3FA78155A8A1D346C3C4A), put on black robes, dim the lights,
  193. wave a dead chicken over the hard drive, and summon the power of GNU GCC
  194. with the magic words "make config ; make!".
  195.         [Jason Spence, compiling Vim 5.0]
  196.  
  197.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  198. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  199. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  200.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  201.