1
0
forked from aniani/vim

patch 8.1.1731: command line history not read from viminfo on startup

Problem:    Command line history not read from viminfo on startup.
Solution:   Get history length after initializing it.
This commit is contained in:
Bram Moolenaar
2019-07-22 20:50:17 +02:00
parent 1e78e69680
commit 26b654a5df
3 changed files with 11 additions and 2 deletions

View File

@@ -1,6 +1,12 @@
" Test for reading and writing .viminfo " Test for reading and writing .viminfo
function Test_viminfo_read_and_write() 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(':') call histdel(':')
let lines = [ let lines = [
\ '# comment line', \ '# comment line',

View File

@@ -777,6 +777,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1731,
/**/ /**/
1730, 1730,
/**/ /**/

View File

@@ -212,9 +212,10 @@ prepare_viminfo_history(int asklen, int writing)
int num; int num;
int type; int type;
int len; int len;
int hislen = get_hislen(); int hislen;
init_history(); init_history();
hislen = get_hislen();
viminfo_add_at_front = (asklen != 0 && !writing); viminfo_add_at_front = (asklen != 0 && !writing);
if (asklen > hislen) if (asklen > hislen)
asklen = hislen; asklen = hislen;