|
Karsten Hopp |
7c0976 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
7c0976 |
Subject: Patch 7.3.892
|
|
Karsten Hopp |
7c0976 |
Fcc: outbox
|
|
Karsten Hopp |
7c0976 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
7c0976 |
Mime-Version: 1.0
|
|
Karsten Hopp |
7c0976 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
7c0976 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
7c0976 |
------------
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
Patch 7.3.892 (after 7.3.891)
|
|
Karsten Hopp |
7c0976 |
Problem: Still merging problems for viminfo history.
|
|
Karsten Hopp |
7c0976 |
Solution: Do not merge lines when writing, don't write old viminfo lines.
|
|
Karsten Hopp |
7c0976 |
Files: src/ex_getln.c, src/ex_cmds.c, src/proto/ex_getln.pro
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
*** ../vim-7.3.891/src/ex_getln.c 2013-04-14 16:26:08.000000000 +0200
|
|
Karsten Hopp |
7c0976 |
--- src/ex_getln.c 2013-04-14 23:12:37.000000000 +0200
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 68,74 ****
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
static int hist_char2type __ARGS((int c));
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
! static int in_history __ARGS((int, char_u *, int, int));
|
|
Karsten Hopp |
7c0976 |
# ifdef FEAT_EVAL
|
|
Karsten Hopp |
7c0976 |
static int calc_hist_idx __ARGS((int histype, int num));
|
|
Karsten Hopp |
7c0976 |
# endif
|
|
Karsten Hopp |
7c0976 |
--- 68,74 ----
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
static int hist_char2type __ARGS((int c));
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
! static int in_history __ARGS((int, char_u *, int, int, int));
|
|
Karsten Hopp |
7c0976 |
# ifdef FEAT_EVAL
|
|
Karsten Hopp |
7c0976 |
static int calc_hist_idx __ARGS((int histype, int num));
|
|
Karsten Hopp |
7c0976 |
# endif
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 5397,5407 ****
|
|
Karsten Hopp |
7c0976 |
* If 'move_to_front' is TRUE, matching entry is moved to end of history.
|
|
Karsten Hopp |
7c0976 |
*/
|
|
Karsten Hopp |
7c0976 |
static int
|
|
Karsten Hopp |
7c0976 |
! in_history(type, str, move_to_front, sep)
|
|
Karsten Hopp |
7c0976 |
int type;
|
|
Karsten Hopp |
7c0976 |
char_u *str;
|
|
Karsten Hopp |
7c0976 |
int move_to_front; /* Move the entry to the front if it exists */
|
|
Karsten Hopp |
7c0976 |
int sep;
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
int i;
|
|
Karsten Hopp |
7c0976 |
int last_i = -1;
|
|
Karsten Hopp |
7c0976 |
--- 5397,5408 ----
|
|
Karsten Hopp |
7c0976 |
* If 'move_to_front' is TRUE, matching entry is moved to end of history.
|
|
Karsten Hopp |
7c0976 |
*/
|
|
Karsten Hopp |
7c0976 |
static int
|
|
Karsten Hopp |
7c0976 |
! in_history(type, str, move_to_front, sep, writing)
|
|
Karsten Hopp |
7c0976 |
int type;
|
|
Karsten Hopp |
7c0976 |
char_u *str;
|
|
Karsten Hopp |
7c0976 |
int move_to_front; /* Move the entry to the front if it exists */
|
|
Karsten Hopp |
7c0976 |
int sep;
|
|
Karsten Hopp |
7c0976 |
+ int writing; /* ignore entries read from viminfo */
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
int i;
|
|
Karsten Hopp |
7c0976 |
int last_i = -1;
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 5419,5424 ****
|
|
Karsten Hopp |
7c0976 |
--- 5420,5426 ----
|
|
Karsten Hopp |
7c0976 |
* well. */
|
|
Karsten Hopp |
7c0976 |
p = history[type][i].hisstr;
|
|
Karsten Hopp |
7c0976 |
if (STRCMP(str, p) == 0
|
|
Karsten Hopp |
7c0976 |
+ && !(writing && history[type][i].viminfo)
|
|
Karsten Hopp |
7c0976 |
&& (type != HIST_SEARCH || sep == p[STRLEN(p) + 1]))
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
if (!move_to_front)
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 5513,5519 ****
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
last_maptick = -1;
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
! if (!in_history(histype, new_entry, TRUE, sep))
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
if (++hisidx[histype] == hislen)
|
|
Karsten Hopp |
7c0976 |
hisidx[histype] = 0;
|
|
Karsten Hopp |
7c0976 |
--- 5515,5521 ----
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
last_maptick = -1;
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
! if (!in_history(histype, new_entry, TRUE, sep, FALSE))
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
if (++hisidx[histype] == hislen)
|
|
Karsten Hopp |
7c0976 |
hisidx[histype] = 0;
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 6032,6039 ****
|
|
Karsten Hopp |
7c0976 |
* This allocates history arrays to store the read history lines.
|
|
Karsten Hopp |
7c0976 |
*/
|
|
Karsten Hopp |
7c0976 |
void
|
|
Karsten Hopp |
7c0976 |
! prepare_viminfo_history(asklen)
|
|
Karsten Hopp |
7c0976 |
int asklen;
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
int i;
|
|
Karsten Hopp |
7c0976 |
int num;
|
|
Karsten Hopp |
7c0976 |
--- 6034,6042 ----
|
|
Karsten Hopp |
7c0976 |
* This allocates history arrays to store the read history lines.
|
|
Karsten Hopp |
7c0976 |
*/
|
|
Karsten Hopp |
7c0976 |
void
|
|
Karsten Hopp |
7c0976 |
! prepare_viminfo_history(asklen, writing)
|
|
Karsten Hopp |
7c0976 |
int asklen;
|
|
Karsten Hopp |
7c0976 |
+ int writing;
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
int i;
|
|
Karsten Hopp |
7c0976 |
int num;
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 6041,6047 ****
|
|
Karsten Hopp |
7c0976 |
int len;
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
init_history();
|
|
Karsten Hopp |
7c0976 |
! viminfo_add_at_front = (asklen != 0);
|
|
Karsten Hopp |
7c0976 |
if (asklen > hislen)
|
|
Karsten Hopp |
7c0976 |
asklen = hislen;
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
--- 6044,6050 ----
|
|
Karsten Hopp |
7c0976 |
int len;
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
init_history();
|
|
Karsten Hopp |
7c0976 |
! viminfo_add_at_front = (asklen != 0 && !writing);
|
|
Karsten Hopp |
7c0976 |
if (asklen > hislen)
|
|
Karsten Hopp |
7c0976 |
asklen = hislen;
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 6073,6080 ****
|
|
Karsten Hopp |
7c0976 |
* new.
|
|
Karsten Hopp |
7c0976 |
*/
|
|
Karsten Hopp |
7c0976 |
int
|
|
Karsten Hopp |
7c0976 |
! read_viminfo_history(virp)
|
|
Karsten Hopp |
7c0976 |
vir_T *virp;
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
int type;
|
|
Karsten Hopp |
7c0976 |
long_u len;
|
|
Karsten Hopp |
7c0976 |
--- 6076,6084 ----
|
|
Karsten Hopp |
7c0976 |
* new.
|
|
Karsten Hopp |
7c0976 |
*/
|
|
Karsten Hopp |
7c0976 |
int
|
|
Karsten Hopp |
7c0976 |
! read_viminfo_history(virp, writing)
|
|
Karsten Hopp |
7c0976 |
vir_T *virp;
|
|
Karsten Hopp |
7c0976 |
+ int writing;
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
int type;
|
|
Karsten Hopp |
7c0976 |
long_u len;
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 6090,6096 ****
|
|
Karsten Hopp |
7c0976 |
int sep = (*val == ' ' ? NUL : *val);
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
if (!in_history(type, val + (type == HIST_SEARCH),
|
|
Karsten Hopp |
7c0976 |
! viminfo_add_at_front, sep))
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
/* Need to re-allocate to append the separator byte. */
|
|
Karsten Hopp |
7c0976 |
len = STRLEN(val);
|
|
Karsten Hopp |
7c0976 |
--- 6094,6100 ----
|
|
Karsten Hopp |
7c0976 |
int sep = (*val == ' ' ? NUL : *val);
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
if (!in_history(type, val + (type == HIST_SEARCH),
|
|
Karsten Hopp |
7c0976 |
! viminfo_add_at_front, sep, writing))
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
/* Need to re-allocate to append the separator byte. */
|
|
Karsten Hopp |
7c0976 |
len = STRLEN(val);
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 6120,6125 ****
|
|
Karsten Hopp |
7c0976 |
--- 6124,6132 ----
|
|
Karsten Hopp |
7c0976 |
return viminfo_readline(virp);
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
+ /*
|
|
Karsten Hopp |
7c0976 |
+ * Finish reading history lines from viminfo. Not used when writing viminfo.
|
|
Karsten Hopp |
7c0976 |
+ */
|
|
Karsten Hopp |
7c0976 |
void
|
|
Karsten Hopp |
7c0976 |
finish_viminfo_history()
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 6216,6222 ****
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
p = round == 1 ? history[type][i].hisstr
|
|
Karsten Hopp |
7c0976 |
: viminfo_history[type][i];
|
|
Karsten Hopp |
7c0976 |
! if (p != NULL)
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
--num_saved;
|
|
Karsten Hopp |
7c0976 |
fputc(hist_type2char(type, TRUE), fp);
|
|
Karsten Hopp |
7c0976 |
--- 6223,6229 ----
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
p = round == 1 ? history[type][i].hisstr
|
|
Karsten Hopp |
7c0976 |
: viminfo_history[type][i];
|
|
Karsten Hopp |
7c0976 |
! if (p != NULL && (round == 2 || !history[type][i].viminfo))
|
|
Karsten Hopp |
7c0976 |
{
|
|
Karsten Hopp |
7c0976 |
--num_saved;
|
|
Karsten Hopp |
7c0976 |
fputc(hist_type2char(type, TRUE), fp);
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 6245,6250 ****
|
|
Karsten Hopp |
7c0976 |
--- 6252,6261 ----
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
+ for (i = 0; i < viminfo_hisidx[type]; ++i)
|
|
Karsten Hopp |
7c0976 |
+ vim_free(viminfo_history[type][i]);
|
|
Karsten Hopp |
7c0976 |
+ vim_free(viminfo_history[type]);
|
|
Karsten Hopp |
7c0976 |
+ viminfo_history[type] = NULL;
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
}
|
|
Karsten Hopp |
7c0976 |
#endif /* FEAT_VIMINFO */
|
|
Karsten Hopp |
7c0976 |
*** ../vim-7.3.891/src/ex_cmds.c 2013-03-07 16:41:26.000000000 +0100
|
|
Karsten Hopp |
7c0976 |
--- src/ex_cmds.c 2013-04-14 23:08:26.000000000 +0200
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 2113,2119 ****
|
|
Karsten Hopp |
7c0976 |
buf_T *buf;
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
#ifdef FEAT_CMDHIST
|
|
Karsten Hopp |
7c0976 |
! prepare_viminfo_history(forceit ? 9999 : 0);
|
|
Karsten Hopp |
7c0976 |
#endif
|
|
Karsten Hopp |
7c0976 |
eof = viminfo_readline(virp);
|
|
Karsten Hopp |
7c0976 |
while (!eof && virp->vir_line[0] != '>')
|
|
Karsten Hopp |
7c0976 |
--- 2113,2119 ----
|
|
Karsten Hopp |
7c0976 |
buf_T *buf;
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
#ifdef FEAT_CMDHIST
|
|
Karsten Hopp |
7c0976 |
! prepare_viminfo_history(forceit ? 9999 : 0, writing);
|
|
Karsten Hopp |
7c0976 |
#endif
|
|
Karsten Hopp |
7c0976 |
eof = viminfo_readline(virp);
|
|
Karsten Hopp |
7c0976 |
while (!eof && virp->vir_line[0] != '>')
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 2161,2167 ****
|
|
Karsten Hopp |
7c0976 |
case '=':
|
|
Karsten Hopp |
7c0976 |
case '@':
|
|
Karsten Hopp |
7c0976 |
#ifdef FEAT_CMDHIST
|
|
Karsten Hopp |
7c0976 |
! eof = read_viminfo_history(virp);
|
|
Karsten Hopp |
7c0976 |
#else
|
|
Karsten Hopp |
7c0976 |
eof = viminfo_readline(virp);
|
|
Karsten Hopp |
7c0976 |
#endif
|
|
Karsten Hopp |
7c0976 |
--- 2161,2167 ----
|
|
Karsten Hopp |
7c0976 |
case '=':
|
|
Karsten Hopp |
7c0976 |
case '@':
|
|
Karsten Hopp |
7c0976 |
#ifdef FEAT_CMDHIST
|
|
Karsten Hopp |
7c0976 |
! eof = read_viminfo_history(virp, writing);
|
|
Karsten Hopp |
7c0976 |
#else
|
|
Karsten Hopp |
7c0976 |
eof = viminfo_readline(virp);
|
|
Karsten Hopp |
7c0976 |
#endif
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 2182,2188 ****
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
#ifdef FEAT_CMDHIST
|
|
Karsten Hopp |
7c0976 |
/* Finish reading history items. */
|
|
Karsten Hopp |
7c0976 |
! finish_viminfo_history();
|
|
Karsten Hopp |
7c0976 |
#endif
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
/* Change file names to buffer numbers for fmarks. */
|
|
Karsten Hopp |
7c0976 |
--- 2182,2189 ----
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
#ifdef FEAT_CMDHIST
|
|
Karsten Hopp |
7c0976 |
/* Finish reading history items. */
|
|
Karsten Hopp |
7c0976 |
! if (!writing)
|
|
Karsten Hopp |
7c0976 |
! finish_viminfo_history();
|
|
Karsten Hopp |
7c0976 |
#endif
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
/* Change file names to buffer numbers for fmarks. */
|
|
Karsten Hopp |
7c0976 |
*** ../vim-7.3.891/src/proto/ex_getln.pro 2011-05-19 18:26:34.000000000 +0200
|
|
Karsten Hopp |
7c0976 |
--- src/proto/ex_getln.pro 2013-04-14 23:12:02.000000000 +0200
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 48,55 ****
|
|
Karsten Hopp |
7c0976 |
void remove_key_from_history __ARGS((void));
|
|
Karsten Hopp |
7c0976 |
int get_list_range __ARGS((char_u **str, int *num1, int *num2));
|
|
Karsten Hopp |
7c0976 |
void ex_history __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
7c0976 |
! void prepare_viminfo_history __ARGS((int asklen));
|
|
Karsten Hopp |
7c0976 |
! int read_viminfo_history __ARGS((vir_T *virp));
|
|
Karsten Hopp |
7c0976 |
void finish_viminfo_history __ARGS((void));
|
|
Karsten Hopp |
7c0976 |
void write_viminfo_history __ARGS((FILE *fp));
|
|
Karsten Hopp |
7c0976 |
void cmd_pchar __ARGS((int c, int offset));
|
|
Karsten Hopp |
7c0976 |
--- 48,55 ----
|
|
Karsten Hopp |
7c0976 |
void remove_key_from_history __ARGS((void));
|
|
Karsten Hopp |
7c0976 |
int get_list_range __ARGS((char_u **str, int *num1, int *num2));
|
|
Karsten Hopp |
7c0976 |
void ex_history __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
7c0976 |
! void prepare_viminfo_history __ARGS((int asklen, int writing));
|
|
Karsten Hopp |
7c0976 |
! int read_viminfo_history __ARGS((vir_T *virp, int writing));
|
|
Karsten Hopp |
7c0976 |
void finish_viminfo_history __ARGS((void));
|
|
Karsten Hopp |
7c0976 |
void write_viminfo_history __ARGS((FILE *fp));
|
|
Karsten Hopp |
7c0976 |
void cmd_pchar __ARGS((int c, int offset));
|
|
Karsten Hopp |
7c0976 |
*** ../vim-7.3.891/src/version.c 2013-04-14 16:26:08.000000000 +0200
|
|
Karsten Hopp |
7c0976 |
--- src/version.c 2013-04-14 22:53:04.000000000 +0200
|
|
Karsten Hopp |
7c0976 |
***************
|
|
Karsten Hopp |
7c0976 |
*** 730,731 ****
|
|
Karsten Hopp |
7c0976 |
--- 730,733 ----
|
|
Karsten Hopp |
7c0976 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
7c0976 |
+ /**/
|
|
Karsten Hopp |
7c0976 |
+ 892,
|
|
Karsten Hopp |
7c0976 |
/**/
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
--
|
|
Karsten Hopp |
7c0976 |
"Hit any key to continue" is a lie.
|
|
Karsten Hopp |
7c0976 |
|
|
Karsten Hopp |
7c0976 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
7c0976 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
7c0976 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
7c0976 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|