Patch 8.2.2494
Problem:    ":rviminfo!" clears most of oldfiles.
Solution:   Add VIF_ONLY_CURBUF to read_viminfo(). (closes #1781)
Files:      src/viminfo.c, src/vim.h


*** ../vim-8.2.2493/src/viminfo.c       2020-09-02 10:25:41.863436972 +0200
--- src/viminfo.c       2021-02-10 19:20:53.968591090 +0100
***************
*** 2219,2225 ****
  /*
   * Handle marks in the viminfo file:
   * fp_out != NULL: copy marks, in time order with buffers in "buflist".
!  * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
   * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
   */
      static void
--- 2219,2226 ----
  /*
   * Handle marks in the viminfo file:
   * fp_out != NULL: copy marks, in time order with buffers in "buflist".
!  * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf
!  * fp_out == NULL && (flags & VIF_ONLY_CURBUF): bail out after curbuf marks
   * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
   */
      static void
***************
*** 2448,2454 ****
                    wp->w_changelistidx = curbuf->b_changelistlen;
            }
  #endif
!           break;
        }
      }
  
--- 2449,2456 ----
                    wp->w_changelistidx = curbuf->b_changelistlen;
            }
  #endif
!           if (flags & VIF_ONLY_CURBUF)
!               break;
        }
      }
  
***************
*** 2473,2479 ****
  {
      if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
                                                  && curbuf->b_ffname != NULL)
!       read_viminfo(NULL, VIF_WANT_MARKS);
  
      // Always set b_marks_read; needed when 'viminfo' is changed to include
      // the ' parameter after opening a buffer.
--- 2475,2481 ----
  {
      if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
                                                  && curbuf->b_ffname != NULL)
!       read_viminfo(NULL, VIF_WANT_MARKS | VIF_ONLY_CURBUF);
  
      // Always set b_marks_read; needed when 'viminfo' is changed to include
      // the ' parameter after opening a buffer.
***************
*** 2953,2960 ****
                    && vir.vir_line[0] != '>')
                ;
  
!       do_copy_marks = (flags &
!                          (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT));
      }
  
      if (fp_out != NULL)
--- 2955,2962 ----
                    && vir.vir_line[0] != '>')
                ;
  
!       do_copy_marks = (flags & (VIF_WANT_MARKS | VIF_ONLY_CURBUF
!                                           | VIF_GET_OLDFILES | VIF_FORCEIT));
      }
  
      if (fp_out != NULL)
*** ../vim-8.2.2493/src/vim.h   2021-01-21 21:42:09.409150461 +0100
--- src/vim.h   2021-02-10 17:39:39.895908491 +0100
***************
*** 2458,2467 ****
  #define DOSO_GVIMRC   2       // loading gvimrc file
  
  // flags for read_viminfo() and children
! #define VIF_WANT_INFO         1       // load non-mark info
! #define VIF_WANT_MARKS                2       // load file marks
! #define VIF_FORCEIT           4       // overwrite info already read
! #define VIF_GET_OLDFILES      8       // load v:oldfiles
  
  // flags for buf_freeall()
  #define BFA_DEL                1      // buffer is going to be deleted
--- 2458,2468 ----
  #define DOSO_GVIMRC   2       // loading gvimrc file
  
  // flags for read_viminfo() and children
! #define VIF_WANT_INFO     1   // load non-mark info
! #define VIF_WANT_MARKS            2   // load file marks
! #define VIF_ONLY_CURBUF           4   // bail out after loading marks for 
curbuf
! #define VIF_FORCEIT       8   // overwrite info already read
! #define VIF_GET_OLDFILES    16        // load v:oldfiles
  
  // flags for buf_freeall()
  #define BFA_DEL                1      // buffer is going to be deleted
*** ../vim-8.2.2493/src/version.c       2021-02-10 17:19:52.614643725 +0100
--- src/version.c       2021-02-10 19:21:34.772491572 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2494,
  /**/

-- 
WOMAN:   King of the who?
ARTHUR:  The Britons.
WOMAN:   Who are the Britons?
ARTHUR:  Well, we all are. we're all Britons and I am your king.
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202102101822.11AIMv3d389292%40masaka.moolenaar.net.

Raspunde prin e-mail lui