Compare commits

...

8 Commits

Author SHA1 Message Date
Bram Moolenaar
680eeca955 updated for version 7.3.030
Problem:    Cannot store Dict and List in viminfo file.
Solution:   Add support for this. (Christian Brabandt)
2010-10-20 17:44:42 +02:00
Bram Moolenaar
f75d498844 updated for version 7.3.029
Problem:    ":sort n" sorts lines without a number as number zero. (Beeyawned)
Solution:   Make lines without a number sort before lines with a number.  Also
            fix sorting negative numbers.
2010-10-15 20:20:05 +02:00
Bram Moolenaar
b60574ba21 updated for version 7.3.028
Problem:    Signs don't show up. (Charles Campbell)
Solution:   Don't use negative numbers.  Also assign a number to signs that
            have a name of all digits to avoid using a sign number twice.
2010-10-14 21:29:37 +02:00
Bram Moolenaar
464c92545a updated for version 7.3.027
Problem:    Opening a file on a network share is very slow.
Solution:   When fixing file name case append "\*" to directory, server and
            network share names. (David Anderson, John Beckett)
2010-10-13 20:37:41 +02:00
Bram Moolenaar
77a0aa457d updated for version 7.3.026
Problem:    CTRL-] in a help file doesn't always work. (Tony Mechelynck)
Solution:   Don't escape special characters. (Carlo Teubner)
2010-10-13 18:06:47 +02:00
Bram Moolenaar
78f74a91bf updated for version 7.3.025
Problem:    ":mksession" does not square brackets escape file name properly.
Solution:   Improve escapging of file names. (partly by Peter Odding)
2010-10-13 17:50:07 +02:00
Bram Moolenaar
a4f332b44c updated for version 7.3.024
Problem:    Named signs do not use a negative number as intended.
Solution:   Fix the numbering of named signs. (Xavier de Gaye)
2010-10-13 16:44:23 +02:00
Bram Moolenaar
624891f3ef updated for version 7.3.023
Problem:    External program may hang when it tries to write to the tty.
Solution:   Don't close the slave tty until after the child exits. (Nikola
            Knezevic)
2010-10-13 16:22:09 +02:00
19 changed files with 214 additions and 99 deletions

View File

@@ -7530,8 +7530,9 @@ A jump table for the options with a short description can be found at |Q_op|.
! When included, save and restore global variables that start
with an uppercase letter, and don't contain a lowercase
letter. Thus "KEEPTHIS and "K_L_M" are stored, but "KeepThis"
and "_K_L_M" are not. Only String and Number types are
stored.
and "_K_L_M" are not. Nested List and Dict items may not be
read back correctly, you end up with a string representation
instead.
" Maximum number of lines saved for each register. Old name of
the '<' item, with the disadvantage that you need to put a
backslash before the ", otherwise it will be recognized as the

View File

@@ -22520,18 +22520,21 @@ read_viminfo_varlist(virp, writing)
if (tab != NULL)
{
*tab++ = '\0'; /* isolate the variable name */
if (*tab == 'S') /* string var */
type = VAR_STRING;
switch (*tab)
{
case 'S': type = VAR_STRING; break;
#ifdef FEAT_FLOAT
else if (*tab == 'F')
type = VAR_FLOAT;
case 'F': type = VAR_FLOAT; break;
#endif
case 'D': type = VAR_DICT; break;
case 'L': type = VAR_LIST; break;
}
tab = vim_strchr(tab, '\t');
if (tab != NULL)
{
tv.v_type = type;
if (type == VAR_STRING)
if (type == VAR_STRING || type == VAR_DICT || type == VAR_LIST)
tv.vval.v_string = viminfo_readstring(virp,
(int)(tab - virp->vir_line + 1), TRUE);
#ifdef FEAT_FLOAT
@@ -22540,9 +22543,27 @@ read_viminfo_varlist(virp, writing)
#endif
else
tv.vval.v_number = atol((char *)tab + 1);
if (type == VAR_DICT || type == VAR_LIST)
{
typval_T *etv = eval_expr(tv.vval.v_string, NULL);
if (etv == NULL)
/* Failed to parse back the dict or list, use it as a
* string. */
tv.v_type = VAR_STRING;
else
{
vim_free(tv.vval.v_string);
tv = *etv;
}
}
set_var(virp->vir_line + 1, &tv, FALSE);
if (type == VAR_STRING)
if (tv.v_type == VAR_STRING)
vim_free(tv.vval.v_string);
else if (tv.v_type == VAR_DICT || tv.v_type == VAR_LIST)
clear_tv(&tv);
}
}
}
@@ -22584,8 +22605,10 @@ write_viminfo_varlist(fp)
case VAR_STRING: s = "STR"; break;
case VAR_NUMBER: s = "NUM"; break;
#ifdef FEAT_FLOAT
case VAR_FLOAT: s = "FLO"; break;
case VAR_FLOAT: s = "FLO"; break;
#endif
case VAR_DICT: s = "DIC"; break;
case VAR_LIST: s = "LIS"; break;
default: continue;
}
fprintf(fp, "!%s\t%s\t", this_var->di_key, s);

View File

@@ -323,7 +323,8 @@ sort_compare(s1, s2)
/* When sorting numbers "start_col_nr" is the number, not the column
* number. */
if (sort_nr)
result = l1.start_col_nr - l2.start_col_nr;
result = l1.start_col_nr == l2.start_col_nr ? 0
: l1.start_col_nr > l2.start_col_nr ? 1 : -1;
else
{
/* We need to copy one line into "sortbuf1", because there is no
@@ -482,7 +483,7 @@ ex_sort(eap)
* of the match, by temporarily terminating the string there */
s2 = s + end_col;
c = *s2;
(*s2) = 0;
*s2 = NUL;
/* Sorting on number: Store the number itself. */
p = s + start_col;
if (sort_hex)
@@ -491,9 +492,13 @@ ex_sort(eap)
s = skiptodigit(p);
if (s > p && s[-1] == '-')
--s; /* include preceding negative sign */
vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
&nrs[lnum - eap->line1].start_col_nr, NULL);
(*s2) = c;
if (*s == NUL)
/* empty line should sort before any number */
nrs[lnum - eap->line1].start_col_nr = -MAXLNUM;
else
vim_str2nr(s, NULL, NULL, sort_oct, sort_hex,
&nrs[lnum - eap->line1].start_col_nr, NULL);
*s2 = c;
}
else
{
@@ -6556,8 +6561,7 @@ typedef struct sign sign_T;
struct sign
{
sign_T *sn_next; /* next sign in list */
int sn_typenr; /* type number of sign (negative if not equal
to name) */
int sn_typenr; /* type number of sign */
char_u *sn_name; /* name of sign */
char_u *sn_icon; /* name of pixmap */
#ifdef FEAT_SIGN_ICONS
@@ -6569,7 +6573,7 @@ struct sign
};
static sign_T *first_sign = NULL;
static int last_sign_typenr = MAX_TYPENR; /* is decremented */
static int next_sign_typenr = 1;
static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd));
static void sign_list_defined __ARGS((sign_T *sp));
@@ -6651,9 +6655,14 @@ ex_sign(eap)
EMSG(_("E156: Missing sign name"));
else
{
/* Isolate the sign name. If it's a number skip leading zeroes,
* so that "099" and "99" are the same sign. But keep "0". */
p = skiptowhite(arg);
if (*p != NUL)
*p++ = NUL;
while (arg[0] == '0' && arg[1] != NUL)
++arg;
sp_prev = NULL;
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
{
@@ -6666,46 +6675,52 @@ ex_sign(eap)
/* ":sign define {name} ...": define a sign */
if (sp == NULL)
{
sign_T *lp;
int start = next_sign_typenr;
/* Allocate a new sign. */
sp = (sign_T *)alloc_clear((unsigned)sizeof(sign_T));
if (sp == NULL)
return;
/* Check that next_sign_typenr is not already being used.
* This only happens after wrapping around. Hopefully
* another one got deleted and we can use its number. */
for (lp = first_sign; lp != NULL; )
{
if (lp->sn_typenr == next_sign_typenr)
{
++next_sign_typenr;
if (next_sign_typenr == MAX_TYPENR)
next_sign_typenr = 1;
if (next_sign_typenr == start)
{
vim_free(sp);
EMSG(_("E612: Too many signs defined"));
return;
}
lp = first_sign; /* start all over */
continue;
}
lp = lp->sn_next;
}
sp->sn_typenr = next_sign_typenr;
if (++next_sign_typenr == MAX_TYPENR)
next_sign_typenr = 1; /* wrap around */
sp->sn_name = vim_strsave(arg);
if (sp->sn_name == NULL) /* out of memory */
{
vim_free(sp);
return;
}
/* add the new sign to the list of signs */
if (sp_prev == NULL)
first_sign = sp;
else
sp_prev->sn_next = sp;
sp->sn_name = vim_strnsave(arg, (int)(p - arg));
/* If the name is a number use that for the typenr,
* otherwise use a negative number. */
if (VIM_ISDIGIT(*arg))
sp->sn_typenr = atoi((char *)arg);
else
{
sign_T *lp;
int start = last_sign_typenr;
for (lp = first_sign; lp != NULL; lp = lp->sn_next)
{
if (lp->sn_typenr == last_sign_typenr)
{
--last_sign_typenr;
if (last_sign_typenr == 0)
last_sign_typenr = MAX_TYPENR;
if (last_sign_typenr == start)
{
EMSG(_("E612: Too many signs defined"));
return;
}
lp = first_sign;
continue;
}
}
sp->sn_typenr = last_sign_typenr--;
if (last_sign_typenr == 0)
last_sign_typenr = MAX_TYPENR; /* wrap around */
}
}
/* set values for a defined sign. */
@@ -6883,6 +6898,8 @@ ex_sign(eap)
arg = skiptowhite(arg);
if (*arg != NUL)
*arg++ = NUL;
while (sign_name[0] == '0' && sign_name[1] != NUL)
++sign_name;
}
else if (STRNCMP(arg, "file=", 5) == 0)
{

View File

@@ -10708,7 +10708,7 @@ ses_fname(fd, buf, flagp)
* Write a file name to the session file.
* Takes care of the "slash" option in 'sessionoptions' and escapes special
* characters.
* Returns FAIL if writing fails.
* Returns FAIL if writing fails or out of memory.
*/
static int
ses_put_fname(fd, name, flagp)
@@ -10717,49 +10717,32 @@ ses_put_fname(fd, name, flagp)
unsigned *flagp;
{
char_u *sname;
char_u *p;
int retval = OK;
int c;
sname = home_replace_save(NULL, name);
if (sname != NULL)
name = sname;
while (*name != NUL)
{
#ifdef FEAT_MBYTE
{
int l;
if (sname == NULL)
return FAIL;
if (has_mbyte && (l = (*mb_ptr2len)(name)) > 1)
{
/* copy a multibyte char */
while (--l >= 0)
{
if (putc(*name, fd) != *name)
retval = FAIL;
++name;
}
continue;
}
}
#endif
c = *name++;
if (c == '\\' && (*flagp & SSOP_SLASH))
/* change a backslash to a forward slash */
c = '/';
else if ((vim_strchr(escape_chars, c) != NULL
#ifdef BACKSLASH_IN_FILENAME
&& c != '\\'
#endif
) || c == '#' || c == '%')
{
/* escape a special character with a backslash */
if (putc('\\', fd) != '\\')
retval = FAIL;
}
if (putc(c, fd) != c)
retval = FAIL;
if (*flagp & SSOP_SLASH)
{
/* change all backslashes to forward slashes */
for (p = sname; *p != NUL; mb_ptr_adv(p))
if (*p == '\\')
*p = '/';
}
/* escapse special characters */
p = vim_strsave_fnameescape(sname, FALSE);
vim_free(sname);
if (p == NULL)
return FAIL;
/* write the result */
if (fputs((char *)p, fd) < 0)
retval = FAIL;
vim_free(p);
return retval;
}

View File

@@ -5666,8 +5666,13 @@ nv_ident(cap)
else if (cmdchar == '#')
aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
else if (tag_cmd)
/* Don't escape spaces and Tabs in a tag with a backslash */
aux_ptr = (char_u *)"\\|\"\n[";
{
if (curbuf->b_help)
/* ":help" handles unescaped argument */
aux_ptr = (char_u *)"";
else
aux_ptr = (char_u *)"\\|\"\n[";
}
else
aux_ptr = (char_u *)"\\|\"\n*?[";

View File

@@ -4168,7 +4168,6 @@ mch_call_shell(cmd, options)
# ifdef FEAT_GUI
if (pty_master_fd >= 0)
{
close(pty_slave_fd); /* close slave side of pty */
fromshell_fd = pty_master_fd;
toshell_fd = dup(pty_master_fd);
}
@@ -4637,6 +4636,14 @@ finished:
break;
}
# ifdef FEAT_GUI
/* Close slave side of pty. Only do this after the child has
* exited, otherwise the child may hang when it tries to write on
* the pty. */
if (pty_master_fd >= 0)
close(pty_slave_fd);
# endif
/* Make sure the child that writes to the external program is
* dead. */
if (wpid > 0)

View File

@@ -2308,12 +2308,14 @@ fname_case(
int len)
{
char szTrueName[_MAX_PATH + 2];
char szTrueNameTemp[_MAX_PATH + 2];
char *ptrue, *ptruePrev;
char *porig, *porigPrev;
int flen;
WIN32_FIND_DATA fb;
HANDLE hFind;
int c;
int slen;
flen = (int)STRLEN(name);
if (flen == 0 || flen > _MAX_PATH)
@@ -2358,12 +2360,19 @@ fname_case(
}
*ptrue = NUL;
/* To avoid a slow failure append "\*" when searching a directory,
* server or network share. */
STRCPY(szTrueNameTemp, szTrueName);
slen = strlen(szTrueNameTemp);
if (*porig == psepc && slen + 2 < _MAX_PATH)
STRCPY(szTrueNameTemp + slen, "\\*");
/* Skip "", "." and "..". */
if (ptrue > ptruePrev
&& (ptruePrev[0] != '.'
|| (ptruePrev[1] != NUL
&& (ptruePrev[1] != '.' || ptruePrev[2] != NUL)))
&& (hFind = FindFirstFile(szTrueName, &fb))
&& (hFind = FindFirstFile(szTrueNameTemp, &fb))
!= INVALID_HANDLE_VALUE)
{
c = *porig;

View File

@@ -27,7 +27,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test56.out test57.out test58.out test59.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out test70.out \
test71.out test72.out test73.out
test71.out test72.out test73.out test74.out
.SUFFIXES: .in .out
@@ -120,3 +120,4 @@ test70.out: test70.in
test71.out: test71.in
test72.out: test72.in
test73.out: test73.in
test74.out: test74.in

View File

@@ -27,7 +27,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test30.out test31.out test32.out test33.out test34.out \
test37.out test38.out test39.out test40.out test41.out \
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out test71.out test72.out test73.out
test68.out test69.out test71.out test72.out test73.out \
test74.out
SCRIPTS32 = test50.out test70.out

View File

@@ -47,7 +47,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test30.out test31.out test32.out test33.out test34.out \
test37.out test38.out test39.out test40.out test41.out \
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out test71.out test72.out test72.out
test68.out test69.out test71.out test72.out test73.out \
test74.out
SCRIPTS32 = test50.out test70.out

View File

@@ -27,7 +27,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test56.out test57.out test58.out test59.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out test70.out \
test71.out test72.out test73.out
test71.out test72.out test73.out test74.out
.SUFFIXES: .in .out

View File

@@ -74,7 +74,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test56.out test57.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out \
test71.out test72.out
test71.out test72.out test74.out
# Known problems:
# Test 30: a problem around mac format - unknown reason

View File

@@ -10,6 +10,7 @@ VIMPROG = ../vim
# This will make testing about 10 times as slow.
# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$*
SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out test10.out test11.out \
test12.out test13.out test14.out test15.out test17.out \
@@ -23,7 +24,8 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test54.out test55.out test56.out test57.out test58.out \
test59.out test60.out test61.out test62.out test63.out \
test64.out test65.out test66.out test67.out test68.out \
test69.out test70.out test71.out test72.out test73.out
test69.out test70.out test71.out test72.out test73.out \
test74.out
SCRIPTS_GUI = test16.out

View File

@@ -13,7 +13,7 @@ Scripts = test1.out test2.out test3.out test4.out test5.out test6.out
test33.out test34.out test35.out test36.out test37.out
test38.out test39.out test40.out test41.out test42.out
test43.out test44.out test45.out test46.out test47.out
test48.out test49.out
test48.out test49.out test74.out
ScriptsGUI = test16.out

View File

@@ -53,15 +53,19 @@ b321b
t02: numeric
abc
ab
a
a321
a123
a122
a
x-22
b321
b123
c123d
-24
123b
c321d
0
b322b
b321
b321b

View File

@@ -21,6 +21,10 @@ ab
a
-24
x-22
0
a122
a123
b123

36
src/testdir/test74.in Normal file
View File

@@ -0,0 +1,36 @@
" Tests for storing global variables in the .viminfo file vim: set ft=vim:
STARTTEST
:so small.vim
:" Do all test in a separate window to avoid E211 when we recursively
:" delete the Xfind directory during cleanup
:"
:" This will cause a few errors, do it silently.
:set visualbell
:set nocp viminfo+=!,nviminfo
:let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}
:" store a really long list, so line wrapping will occur in viminfo file
:let MY_GLOBAL_LIST=range(1,100)
:wv! Xviminfo
:unlet MY_GLOBAL_DICT
:unlet MY_GLOBAL_LIST
:rv! Xviminfo
:call delete('Xviminfo')
:if exists("MY_GLOBAL_DICT")
:redir >> test.out
:echo MY_GLOBAL_DICT
:redir end
:endif
:if exists("MY_GLOBAL_LIST")
:redir >> test.out
:echo MY_GLOBAL_LIST
:redir end
:endif
:redir >> test.out
:echo "foobar"
:redir end
:endif
:qa!
ENDTEST
eof

5
src/testdir/test74.ok Normal file
View File

@@ -0,0 +1,5 @@
{'foo': 1, 'longvarible': 1000, 'bar': 0}
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100]
foobar

View File

@@ -714,6 +714,22 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
30,
/**/
29,
/**/
28,
/**/
27,
/**/
26,
/**/
25,
/**/
24,
/**/
23,
/**/
22,
/**/