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 / 6.0.131 < prev    next >
Encoding:
Internet Message Format  |  2002-01-13  |  4.2 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.131
  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 6.0.131
  11. Problem:    When using bufname() and there are two matches for listed buffers
  12.         and one match for an unlisted buffer, the unlisted buffer is used.
  13.         (Aric Blumer)
  14. Solution:   When there is a match with a listed buffer, don't check for
  15.         unlisted buffers.
  16. Files:        src/buffer.c
  17.  
  18.  
  19. *** ../vim60.130/src/buffer.c    Sat Jan 12 16:39:27 2002
  20. --- src/buffer.c    Mon Jan 14 12:43:09 2002
  21. ***************
  22. *** 1636,1646 ****
  23.       }
  24.   
  25.       /*
  26. !      * Try four ways of matching:
  27.        * attempt == 0: without '^' or '$' (at any position)
  28.        * attempt == 1: with '^' at start (only at postion 0)
  29.        * attempt == 2: with '$' at end (only match at end)
  30.        * attempt == 3: with '^' at start and '$' at end (only full match)
  31.        */
  32.       else
  33.       {
  34. --- 1636,1648 ----
  35.       }
  36.   
  37.       /*
  38. !      * Try four ways of matching a listed buffer:
  39.        * attempt == 0: without '^' or '$' (at any position)
  40.        * attempt == 1: with '^' at start (only at postion 0)
  41.        * attempt == 2: with '$' at end (only match at end)
  42.        * attempt == 3: with '^' at start and '$' at end (only full match)
  43. +      * Repeat this for finding an unlisted buffer if there was no matching
  44. +      * listed buffer.
  45.        */
  46.       else
  47.       {
  48. ***************
  49. *** 1650,1675 ****
  50.       patend = pat + STRLEN(pat) - 1;
  51.       toggledollar = (patend > pat && *patend == '$');
  52.   
  53. !     for (attempt = 0; attempt <= 3; ++attempt)
  54.       {
  55. !         /* may add '^' and '$' */
  56. !         if (toggledollar)
  57. !         *patend = (attempt < 2) ? NUL : '$';    /* add/remove '$' */
  58. !         p = pat;
  59. !         if (*p == '^' && !(attempt & 1))        /* add/remove '^' */
  60. !         ++p;
  61. !         prog = vim_regcomp(p, (int)p_magic);
  62. !         if (prog == NULL)
  63.           {
  64. !         vim_free(pat);
  65. !         return -1;
  66. !         }
  67.   
  68. -         /* First try finding a listed buffer, if not found and "unlisted"
  69. -          * is TRUE, try finding an unlisted buffer. */
  70. -         find_listed = TRUE;
  71. -         for (;;)
  72. -         {
  73.           for (buf = firstbuf; buf != NULL; buf = buf->b_next)
  74.               if (buf->b_p_bl == find_listed
  75.   #ifdef FEAT_DIFF
  76. --- 1652,1677 ----
  77.       patend = pat + STRLEN(pat) - 1;
  78.       toggledollar = (patend > pat && *patend == '$');
  79.   
  80. !     /* First try finding a listed buffer.  If not found and "unlisted"
  81. !      * is TRUE, try finding an unlisted buffer. */
  82. !     find_listed = TRUE;
  83. !     for (;;)
  84.       {
  85. !         for (attempt = 0; attempt <= 3; ++attempt)
  86.           {
  87. !         /* may add '^' and '$' */
  88. !         if (toggledollar)
  89. !             *patend = (attempt < 2) ? NUL : '$'; /* add/remove '$' */
  90. !         p = pat;
  91. !         if (*p == '^' && !(attempt & 1))     /* add/remove '^' */
  92. !             ++p;
  93. !         prog = vim_regcomp(p, (int)p_magic);
  94. !         if (prog == NULL)
  95. !         {
  96. !             vim_free(pat);
  97. !             return -1;
  98. !         }
  99.   
  100.           for (buf = firstbuf; buf != NULL; buf = buf->b_next)
  101.               if (buf->b_p_bl == find_listed
  102.   #ifdef FEAT_DIFF
  103. ***************
  104. *** 1684,1698 ****
  105.               }
  106.               match = buf->b_fnum;    /* remember first match */
  107.               }
  108. !         if (!unlisted || !find_listed || match >= 0)
  109.               break;
  110. -         find_listed = FALSE;
  111.           }
  112.   
  113. !         vim_free(prog);
  114. !         if (match >= 0)            /* found one match */
  115.           break;
  116.       }
  117.       vim_free(pat);
  118.       }
  119.   
  120. --- 1686,1704 ----
  121.               }
  122.               match = buf->b_fnum;    /* remember first match */
  123.               }
  124. !         vim_free(prog);
  125. !         if (match >= 0)            /* found one match */
  126.               break;
  127.           }
  128.   
  129. !         /* Only search for unlisted buffers if there was no match with
  130. !          * a listed buffer. */
  131. !         if (!unlisted || !find_listed || match != -1)
  132.           break;
  133. +         find_listed = FALSE;
  134.       }
  135.       vim_free(pat);
  136.       }
  137.   
  138. *** ../vim60.130/src/version.c    Sun Jan 13 20:44:03 2002
  139. --- src/version.c    Mon Jan 14 12:46:18 2002
  140. ***************
  141. *** 608,609 ****
  142. --- 608,611 ----
  143.   {   /* Add new patch number below this line */
  144. + /**/
  145. +     131,
  146.   /**/
  147.  
  148. -- 
  149. Are leaders born or made?  And if they're made, can we return them under
  150. warranty?
  151.                 (Scott Adams - The Dilbert principle)
  152.  
  153.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  154. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  155.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  156.