Hi, Bram
Prepare for reproduce (on Linux)
$ cat ~/.vimrc_test
set nocompatible
set history=5
$ rm ~/.viminfo
How to reproduce
$ vim -u ~/.vimrc_test
:echo 1
:echo 2
:echo 3
:echo 4
:echo 5
<C-W>q
$ vim -u ~/.vimrc_test
:q
Expect Result
(~/.viminfo command history may get this.)
:q
:echo 5
:echo 4
:echo 3
:echo 2
Actual Result
(~/.viminfo command history is wrong such below.)
:echo 1 <--- ???
:echo 5
:echo 4
:echo 3
:echo 2
I attached a patch.
Please check.
Best regards,
Hirohito Higashi
--
--
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].
For more options, visit https://groups.google.com/groups/opt_out.
diff -r 9b772e48f79e src/ex_getln.c
--- a/src/ex_getln.c Fri Apr 12 15:09:51 2013 +0200
+++ b/src/ex_getln.c Sun Apr 14 03:21:10 2013 +0900
@@ -5998,9 +5998,10 @@
#endif
#if (defined(FEAT_VIMINFO) && defined(FEAT_CMDHIST)) || defined(PROTO)
-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};
+static char_u **viminfo_history[HIST_COUNT] = {NULL, NULL, NULL, NULL, NULL};
+static int viminfo_hisidx[HIST_COUNT] = {0, 0, 0, 0, 0};
+static int viminfo_hislen[HIST_COUNT] = {0, 0, 0, 0, 0};
+static int viminfo_readcnt[HIST_COUNT] = {0, 0, 0, 0, 0};
static int viminfo_add_at_front = FALSE;
static int hist_type2char __ARGS((int type, int use_question));
@@ -6065,6 +6066,7 @@
len = 0;
viminfo_hislen[type] = len;
viminfo_hisidx[type] = 0;
+ viminfo_readcnt[type] = 0;
}
}
@@ -6082,7 +6084,8 @@
char_u *p;
type = hist_char2type(virp->vir_line[0]);
- if (viminfo_hisidx[type] < viminfo_hislen[type])
+ if (viminfo_readcnt[type]++ < viminfo_hislen[type]
+ && viminfo_hisidx[type] < viminfo_hislen[type])
{
val = viminfo_readstring(virp, 1, TRUE);
if (val != NULL && *val != NUL)