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.221 < prev    next >
Encoding:
Internet Message Format  |  2002-02-11  |  4.1 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.221
  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.221
  11. Problem:    When using ":bdel" and all other buffers are unloaded the lowest
  12.         numbered buffer is jumped to instead of the most recent one. (Dave
  13.         Cecil)
  14. Solution:   Prefer an unloaded buffer from the jumplist.
  15. Files:        src/buffer.c
  16.  
  17.  
  18. *** ../vim60.220/src/buffer.c    Mon Feb 11 17:46:17 2002
  19. --- src/buffer.c    Tue Feb 12 10:06:46 2002
  20. ***************
  21. *** 951,957 ****
  22.        * then before the current buffer.
  23.        * Finally use any buffer.
  24.        */
  25. !     buf = NULL;
  26.   #ifdef FEAT_AUTOCMD
  27.       if (au_new_curbuf != NULL && buf_valid(au_new_curbuf))
  28.           buf = au_new_curbuf;
  29. --- 951,958 ----
  30.        * then before the current buffer.
  31.        * Finally use any buffer.
  32.        */
  33. !     buf = NULL;    /* selected buffer */
  34. !     bp = NULL;    /* used when no loaded buffer found */
  35.   #ifdef FEAT_AUTOCMD
  36.       if (au_new_curbuf != NULL && buf_valid(au_new_curbuf))
  37.           buf = au_new_curbuf;
  38. ***************
  39. *** 972,983 ****
  40.           while (jumpidx != curwin->w_jumplistidx)
  41.           {
  42.           buf = buflist_findnr(curwin->w_jumplist[jumpidx].fmark.fnum);
  43. -         if (buf == curbuf
  44. -             || (buf != NULL
  45. -                 && (buf->b_ml.ml_mfp == NULL || !buf->b_p_bl)))
  46. -             buf = NULL;    /* Must be open, listed and not current */
  47. -         /* found a valid buffer: stop searching */
  48.           if (buf != NULL)
  49.               break;
  50.           /* advance to older entry in jump list */
  51.           if (!jumpidx && curwin->w_jumplistidx == curwin->w_jumplistlen)
  52. --- 973,991 ----
  53.           while (jumpidx != curwin->w_jumplistidx)
  54.           {
  55.           buf = buflist_findnr(curwin->w_jumplist[jumpidx].fmark.fnum);
  56.           if (buf != NULL)
  57. +         {
  58. +             if (buf == curbuf || !buf->b_p_bl)
  59. +             buf = NULL;    /* skip current and unlisted bufs */
  60. +             else if (buf->b_ml.ml_mfp == NULL)
  61. +             {
  62. +             /* skip unloaded buf, but may keep it for later */
  63. +             if (bp == NULL)
  64. +                 bp = buf;
  65. +             buf = NULL;
  66. +             }
  67. +         }
  68. +         if (buf != NULL)   /* found a valid buffer: stop searching */
  69.               break;
  70.           /* advance to older entry in jump list */
  71.           if (!jumpidx && curwin->w_jumplistidx == curwin->w_jumplistlen)
  72. ***************
  73. *** 1005,1020 ****
  74.               continue;
  75.           }
  76.           /* in non-help buffer, try to skip help buffers, and vv */
  77. !         if (buf->b_ml.ml_mfp != NULL
  78. !             && buf->b_help == curbuf->b_help
  79. !             && buf->b_p_bl)
  80. !             break;
  81.           if (forward)
  82.               buf = buf->b_next;
  83.           else
  84.               buf = buf->b_prev;
  85.           }
  86.       }
  87.       if (buf == NULL)    /* No loaded buffer, find listed one */
  88.       {
  89.           for (buf = firstbuf; buf != NULL; buf = buf->b_next)
  90. --- 1013,1033 ----
  91.               continue;
  92.           }
  93.           /* in non-help buffer, try to skip help buffers, and vv */
  94. !         if (buf->b_help == curbuf->b_help && buf->b_p_bl)
  95. !         {
  96. !             if (buf->b_ml.ml_mfp != NULL)   /* found loaded buffer */
  97. !             break;
  98. !             if (bp == NULL)    /* remember unloaded buf for later */
  99. !             bp = buf;
  100. !         }
  101.           if (forward)
  102.               buf = buf->b_next;
  103.           else
  104.               buf = buf->b_prev;
  105.           }
  106.       }
  107. +     if (buf == NULL)    /* No loaded buffer, use unloaded one */
  108. +         buf = bp;
  109.       if (buf == NULL)    /* No loaded buffer, find listed one */
  110.       {
  111.           for (buf = firstbuf; buf != NULL; buf = buf->b_next)
  112. *** ../vim60.220/src/version.c    Mon Feb 11 22:00:42 2002
  113. --- src/version.c    Tue Feb 12 10:09:02 2002
  114. ***************
  115. *** 608,609 ****
  116. --- 608,611 ----
  117.   {   /* Add new patch number below this line */
  118. + /**/
  119. +     221,
  120.   /**/
  121.  
  122. -- 
  123. ARTHUR:  Be quiet!
  124. DENNIS:  Well you can't expect to wield supreme executive power just 'cause
  125.          some watery tart threw a sword at you!
  126. ARTHUR:  Shut up!
  127. DENNIS:  I mean, if I went around sayin' I was an empereror just because some
  128.          moistened bint had lobbed a scimitar at me they'd put me away!
  129.                                   The Quest for the Holy Grail (Monty Python)
  130.  
  131.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  132. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  133.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  134.