diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-06-15 16:31:47 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-06-15 16:31:47 +0200 |
commit | ff1806f8da8830ca2a528f2eaa39b3e85489da6d (patch) | |
tree | a78d3e494761a3246b5b50ac5830628207c8374e /src/ex_getln.c | |
parent | 141f6bb34124872d8676066e021bf899d4023c23 (diff) | |
download | vim-git-ff1806f8da8830ca2a528f2eaa39b3e85489da6d.tar.gz |
updated for version 7.3.1197v7.3.1197
Problem: ":wviminfo!" does not write history previously read from a viminfo
file. (Roland Eggner)
Solution: When not merging history write all entries.
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 4bebe2309..e407ab0ae 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -6003,6 +6003,9 @@ ex_history(eap) #endif #if (defined(FEAT_VIMINFO) && defined(FEAT_CMDHIST)) || defined(PROTO) +/* + * Buffers for history read from a viminfo file. Only valid while reading. + */ static char_u **viminfo_history[HIST_COUNT] = {NULL, NULL, NULL, NULL}; static int viminfo_hisidx[HIST_COUNT] = {0, 0, 0, 0}; static int viminfo_hislen[HIST_COUNT] = {0, 0, 0, 0}; @@ -6184,9 +6187,16 @@ finish_viminfo_history() } } +/* + * Write history to viminfo file in "fp". + * When "merge" is TRUE merge history lines with a previously read viminfo + * file, data is in viminfo_history[]. + * When "merge" is FALSE just write all history lines. Used for ":wviminfo!". + */ void -write_viminfo_history(fp) +write_viminfo_history(fp, merge) FILE *fp; + int merge; { int i; int type; @@ -6236,7 +6246,9 @@ write_viminfo_history(fp) p = round == 1 ? history[type][i].hisstr : viminfo_history[type] == NULL ? NULL : viminfo_history[type][i]; - if (p != NULL && (round == 2 || !history[type][i].viminfo)) + if (p != NULL && (round == 2 + || !merge + || !history[type][i].viminfo)) { --num_saved; fputc(hist_type2char(type, TRUE), fp); |