Patch 8.1.1731

10 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 22, 2019, 2:51:06 PM7/22/19
to vim...@googlegroups.com

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 -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages