Patch 8.1.1731
Problem:    Command line history not read from viminfo on startup.
Solution:   Get history length after initializing it.
Files:      src/viminfo.c, src/testdir/test_viminfo.vim


*** ../vim-8.1.1730/src/viminfo.c       2019-07-22 20:18:22.338308949 +0200
--- src/viminfo.c       2019-07-22 20:48:09.380780965 +0200
***************
*** 212,220 ****
      int           num;
      int           type;
      int           len;
!     int           hislen = get_hislen();
  
      init_history();
      viminfo_add_at_front = (asklen != 0 && !writing);
      if (asklen > hislen)
        asklen = hislen;
--- 212,221 ----
      int           num;
      int           type;
      int           len;
!     int           hislen;
  
      init_history();
+     hislen = get_hislen();
      viminfo_add_at_front = (asklen != 0 && !writing);
      if (asklen > hislen)
        asklen = hislen;
***************
*** 460,466 ****
      // Make one long list with all entries.
      max_len = hislen + viminfo_hisidx[type];
      tot_hist = ALLOC_MULT(histentry_T *, max_len);
!     new_hist = ALLOC_MULT(histentry_T, hislen );
      if (tot_hist == NULL || new_hist == NULL)
      {
        vim_free(tot_hist);
--- 461,467 ----
      // Make one long list with all entries.
      max_len = hislen + viminfo_hisidx[type];
      tot_hist = ALLOC_MULT(histentry_T *, max_len);
!     new_hist = ALLOC_MULT(histentry_T, hislen);
      if (tot_hist == NULL || new_hist == NULL)
      {
        vim_free(tot_hist);
*** ../vim-8.1.1730/src/testdir/test_viminfo.vim        2019-01-24 
17:59:35.143217444 +0100
--- src/testdir/test_viminfo.vim        2019-07-22 20:44:42.170153558 +0200
***************
*** 1,6 ****
--- 1,12 ----
  " Test for reading and writing .viminfo
  
  function Test_viminfo_read_and_write()
+   " First clear 'history', so that "hislen" is zero.  Then set it again,
+   " simulating Vim starting up.
+   set history=0
+   wviminfo Xviminfo
+   set history=1000
+ 
    call histdel(':')
    let lines = [
        \ '# comment line',
*** ../vim-8.1.1730/src/version.c       2019-07-22 20:18:22.338308949 +0200
--- src/version.c       2019-07-22 20:49:23.364296187 +0200
***************
*** 779,780 ****
--- 779,782 ----
  {   /* Add new patch number below this line */
+ /**/
+     1731,
  /**/

-- 
People who want to share their religious views with you
almost never want you to share yours with them.

 /// 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/201907221850.x6MIoxkO004440%40masaka.moolenaar.net.

Raspunde prin e-mail lui