Compare commits

...

17 Commits

Author SHA1 Message Date
Bram Moolenaar
19f990e497 updated for version 7.2-305 2009-11-25 12:08:03 +00:00
Bram Moolenaar
331dafdbb8 updated for version 7.2-304 2009-11-25 11:38:30 +00:00
Bram Moolenaar
4592dee576 updated for version 7.2-303 2009-11-18 19:11:58 +00:00
Bram Moolenaar
f11021be13 updated for version 7.2-302 2009-11-17 16:57:14 +00:00
Bram Moolenaar
97b9810bdf updated for version 7.2-301 2009-11-17 16:41:01 +00:00
Bram Moolenaar
f05da21900 updated for version 7.2-300 2009-11-17 16:13:15 +00:00
Bram Moolenaar
2d7ff056e1 updated for version 7.2-299 2009-11-17 15:08:26 +00:00
Bram Moolenaar
50daf405f7 updated for version 7.2-298 2009-11-17 13:57:22 +00:00
Bram Moolenaar
cde547a8f3 updated for version 7.2-297 2009-11-17 11:43:06 +00:00
Bram Moolenaar
34ef52dd56 updated for version 7.2-296 2009-11-17 11:31:25 +00:00
Bram Moolenaar
627b1d3862 updated for version 7.2-295 2009-11-17 11:20:35 +00:00
Bram Moolenaar
eaf0339211 updated for version 7.2-294 2009-11-17 11:08:52 +00:00
Bram Moolenaar
d7d5b47dc7 updated for version 7.2-293 2009-11-11 16:30:08 +00:00
Bram Moolenaar
be1138baba updated for version 7.2-292 2009-11-11 16:22:28 +00:00
Bram Moolenaar
5462018872 updated for version 7.2-291 2009-11-11 16:07:20 +00:00
Bram Moolenaar
21160b9808 updated for version 7.2-290 2009-11-11 15:56:10 +00:00
Bram Moolenaar
f6f95d962f updated for version 7.2-289 2009-11-11 15:23:37 +00:00
26 changed files with 702 additions and 99 deletions

View File

@@ -3802,7 +3802,8 @@ map({expr}, {string}) *map()*
Replace each item in {expr} with the result of evaluating
{string}.
Inside {string} |v:val| has the value of the current item.
For a |Dictionary| |v:key| has the key of the current item.
For a |Dictionary| |v:key| has the key of the current item
and for a |List| |v:key| has the index of the current item.
Example: >
:call map(mylist, '"> " . v:val . " <"')
< This puts "> " before and " <" after each item in "mylist".

55
src/auto/configure vendored
View File

@@ -14017,11 +14017,12 @@ fi
for ac_func in bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
memset nanosleep opendir putenv qsort readlink select setenv \
memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
sigvec strcasecmp strerror strftime stricmp strncasecmp \
strnicmp strpbrk strtol tgetent towlower towupper iswupper \
@@ -15173,6 +15174,58 @@ else
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:$LINENO: checking for FD_CLOEXEC" >&5
$as_echo_n "checking for FD_CLOEXEC... " >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#if HAVE_FCNTL_H
# include <fcntl.h>
#endif
int
main ()
{
int flag = FD_CLOEXEC;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }; cat >>confdefs.h <<\_ACEOF
#define HAVE_FD_CLOEXEC 1
_ACEOF
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ $as_echo "$as_me:$LINENO: result: not usable" >&5
$as_echo "not usable" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:$LINENO: checking for rename" >&5
$as_echo_n "checking for rename... " >&6; }
cat >conftest.$ac_ext <<_ACEOF

View File

@@ -157,6 +157,7 @@
#undef HAVE_LSTAT
#undef HAVE_MEMCMP
#undef HAVE_MEMSET
#undef HAVE_MKDTEMP
#undef HAVE_NANOSLEEP
#undef HAVE_OPENDIR
#undef HAVE_FLOAT_FUNCS
@@ -387,3 +388,6 @@
/* Define if you want XSMP interaction as well as vanilla swapfile safety */
#undef USE_XSMP_INTERACT
/* Define if fcntl()'s F_SETFD command knows about FD_CLOEXEC */
#undef HAVE_FD_CLOEXEC

View File

@@ -2635,7 +2635,7 @@ fi
dnl Check for functions in one big call, to reduce the size of configure
AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
memset nanosleep opendir putenv qsort readlink select setenv \
memset mkdtemp nanosleep opendir putenv qsort readlink select setenv \
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
sigvec strcasecmp strerror strftime stricmp strncasecmp \
strnicmp strpbrk strtol tgetent towlower towupper iswupper \
@@ -2855,6 +2855,16 @@ else
AC_MSG_RESULT(yes)
fi
dnl make sure the FD_CLOEXEC flag for fcntl()'s F_SETFD command is known
AC_MSG_CHECKING(for FD_CLOEXEC)
AC_TRY_COMPILE(
[#if HAVE_FCNTL_H
# include <fcntl.h>
#endif],
[ int flag = FD_CLOEXEC;],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FD_CLOEXEC),
AC_MSG_RESULT(not usable))
dnl rename needs to be checked separately to work on Nextstep with cc
AC_MSG_CHECKING(for rename)
AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],

View File

@@ -181,7 +181,7 @@ static void ins_redraw __ARGS((int ready));
static void ins_ctrl_v __ARGS((void));
static void undisplay_dollar __ARGS((void));
static void insert_special __ARGS((int, int, int));
static void internal_format __ARGS((int textwidth, int second_indent, int flags, int format_only));
static void internal_format __ARGS((int textwidth, int second_indent, int flags, int format_only, int c));
static void check_auto_format __ARGS((int));
static void redo_literal __ARGS((int c));
static void start_arrow __ARGS((pos_T *end_insert_pos));
@@ -2164,7 +2164,7 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags)
int i, c;
int actual_len; /* Take multi-byte characters */
int actual_compl_length; /* into account. */
int *wca; /* Wide character array. */
int *wca; /* Wide character array. */
int has_lower = FALSE;
int was_letter = FALSE;
@@ -5558,7 +5558,7 @@ insertchar(c, flags, second_indent)
}
if (do_internal)
#endif
internal_format(textwidth, second_indent, flags, c == NUL);
internal_format(textwidth, second_indent, flags, c == NUL, c);
}
if (c == NUL) /* only formatting was wanted */
@@ -5738,11 +5738,12 @@ insertchar(c, flags, second_indent)
* Format text at the current insert position.
*/
static void
internal_format(textwidth, second_indent, flags, format_only)
internal_format(textwidth, second_indent, flags, format_only, c)
int textwidth;
int second_indent;
int flags;
int format_only;
int c; /* character to be inserted (can be NUL) */
{
int cc;
int save_char = NUL;
@@ -5763,7 +5764,11 @@ internal_format(textwidth, second_indent, flags, format_only)
* When 'ai' is off we don't want a space under the cursor to be
* deleted. Replace it with an 'x' temporarily.
*/
if (!curbuf->b_p_ai)
if (!curbuf->b_p_ai
#ifdef FEAT_VREPLACE
&& !(State & VREPLACE_FLAG)
#endif
)
{
cc = gchar_cursor();
if (vim_iswhite(cc))
@@ -5789,9 +5794,11 @@ internal_format(textwidth, second_indent, flags, format_only)
char_u *saved_text = NULL;
#endif
colnr_T col;
colnr_T end_col;
virtcol = get_nolist_virtcol();
if (virtcol < (colnr_T)textwidth)
virtcol = get_nolist_virtcol()
+ char2cells(c != NUL ? c : gchar_cursor());
if (virtcol <= (colnr_T)textwidth)
break;
#ifdef FEAT_COMMENTS
@@ -5831,12 +5838,7 @@ internal_format(textwidth, second_indent, flags, format_only)
coladvance((colnr_T)textwidth);
wantcol = curwin->w_cursor.col;
curwin->w_cursor.col = startcol - 1;
#ifdef FEAT_MBYTE
/* Correct cursor for multi-byte character. */
if (has_mbyte)
mb_adjust_cursor();
#endif
curwin->w_cursor.col = startcol;
foundcol = 0;
/*
@@ -5847,11 +5849,14 @@ internal_format(textwidth, second_indent, flags, format_only)
|| curwin->w_cursor.lnum != Insstart.lnum
|| curwin->w_cursor.col >= Insstart.col)
{
cc = gchar_cursor();
if (curwin->w_cursor.col == startcol && c != NUL)
cc = c;
else
cc = gchar_cursor();
if (WHITECHAR(cc))
{
/* remember position of blank just before text */
end_foundcol = curwin->w_cursor.col;
end_col = curwin->w_cursor.col;
/* find start of sequence of blanks */
while (curwin->w_cursor.col > 0 && WHITECHAR(cc))
@@ -5871,7 +5876,11 @@ internal_format(textwidth, second_indent, flags, format_only)
/* do not break after one-letter words */
if (curwin->w_cursor.col == 0)
break; /* one-letter word at begin */
#ifdef FEAT_COMMENTS
/* do not break "#a b" when 'tw' is 2 */
if (curwin->w_cursor.col <= leader_len)
break;
#endif
col = curwin->w_cursor.col;
dec_cursor();
cc = gchar_cursor();
@@ -5880,26 +5889,60 @@ internal_format(textwidth, second_indent, flags, format_only)
continue; /* one-letter, continue */
curwin->w_cursor.col = col;
}
#ifdef FEAT_MBYTE
if (has_mbyte)
foundcol = curwin->w_cursor.col
+ (*mb_ptr2len)(ml_get_cursor());
else
#endif
foundcol = curwin->w_cursor.col + 1;
if (curwin->w_cursor.col < (colnr_T)wantcol)
inc_cursor();
end_foundcol = end_col + 1;
foundcol = curwin->w_cursor.col;
if (curwin->w_cursor.col <= (colnr_T)wantcol)
break;
}
#ifdef FEAT_MBYTE
else if (cc >= 0x100 && fo_multibyte
&& curwin->w_cursor.col <= (colnr_T)wantcol)
else if (cc >= 0x100 && fo_multibyte)
{
/* Break after or before a multi-byte character. */
if (curwin->w_cursor.col != startcol)
{
#ifdef FEAT_COMMENTS
/* Don't break until after the comment leader */
if (curwin->w_cursor.col < leader_len)
break;
#endif
col = curwin->w_cursor.col;
inc_cursor();
/* Don't change end_foundcol if already set. */
if (foundcol != curwin->w_cursor.col)
{
foundcol = curwin->w_cursor.col;
end_foundcol = foundcol;
if (curwin->w_cursor.col <= (colnr_T)wantcol)
break;
}
curwin->w_cursor.col = col;
}
if (curwin->w_cursor.col == 0)
break;
col = curwin->w_cursor.col;
dec_cursor();
cc = gchar_cursor();
if (WHITECHAR(cc))
continue; /* break with space */
#ifdef FEAT_COMMENTS
/* Don't break until after the comment leader */
if (curwin->w_cursor.col < leader_len)
break;
#endif
curwin->w_cursor.col = col;
foundcol = curwin->w_cursor.col;
if (curwin->w_cursor.col < (colnr_T)wantcol)
foundcol += (*mb_char2len)(cc);
end_foundcol = foundcol;
break;
if (curwin->w_cursor.col <= (colnr_T)wantcol)
break;
}
#endif
if (curwin->w_cursor.col == 0)
@@ -5926,14 +5969,15 @@ internal_format(textwidth, second_indent, flags, format_only)
orig_col = startcol; /* Will start backspacing from here */
else
#endif
replace_offset = startcol - end_foundcol - 1;
replace_offset = startcol - end_foundcol;
/*
* adjust startcol for spaces that will be deleted and
* characters that will remain on top line
*/
curwin->w_cursor.col = foundcol;
while (cc = gchar_cursor(), WHITECHAR(cc))
while ((cc = gchar_cursor(), WHITECHAR(cc))
&& (!fo_white_par || curwin->w_cursor.col < startcol))
inc_cursor();
startcol -= curwin->w_cursor.col;
if (startcol < 0)
@@ -8509,7 +8553,7 @@ ins_bs(c, mode, inserted_space_p)
if (mode == BACKSPACE_LINE
&& (curbuf->b_p_ai
#ifdef FEAT_CINDENT
|| cindent_on()
|| cindent_on()
#endif
)
#ifdef FEAT_RIGHTLEFT

View File

@@ -9928,6 +9928,7 @@ filter_map(argvars, rettv, map)
int todo;
char_u *ermsg = map ? (char_u *)"map()" : (char_u *)"filter()";
int save_did_emsg;
int index = 0;
if (argvars[0].v_type == VAR_LIST)
{
@@ -9961,9 +9962,9 @@ filter_map(argvars, rettv, map)
save_did_emsg = did_emsg;
did_emsg = FALSE;
prepare_vimvar(VV_KEY, &save_key);
if (argvars[0].v_type == VAR_DICT)
{
prepare_vimvar(VV_KEY, &save_key);
vimvars[VV_KEY].vv_type = VAR_STRING;
ht = &d->dv_hashtab;
@@ -9987,24 +9988,27 @@ filter_map(argvars, rettv, map)
}
}
hash_unlock(ht);
restore_vimvar(VV_KEY, &save_key);
}
else
{
vimvars[VV_KEY].vv_type = VAR_NUMBER;
for (li = l->lv_first; li != NULL; li = nli)
{
if (tv_check_lock(li->li_tv.v_lock, ermsg))
break;
nli = li->li_next;
vimvars[VV_KEY].vv_nr = index;
if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL
|| did_emsg)
break;
if (!map && rem)
listitem_remove(l, li);
++index;
}
}
restore_vimvar(VV_KEY, &save_key);
restore_vimvar(VV_VAL, &save_val);
did_emsg |= save_did_emsg;

View File

@@ -146,6 +146,9 @@ static int get_mac_fio_flags __ARGS((char_u *ptr));
# endif
#endif
static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf));
#ifdef TEMPDIRNAMES
static void vim_settempdir __ARGS((char_u *tempdir));
#endif
#ifdef FEAT_AUTOCMD
static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
#endif
@@ -2253,6 +2256,14 @@ failed:
if (!read_buffer && !read_stdin)
close(fd); /* errors are ignored */
#ifdef HAVE_FD_CLOEXEC
else
{
int fdflags = fcntl(fd, F_GETFD);
if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC);
}
#endif
vim_free(buffer);
#ifdef HAVE_DUP
@@ -6986,6 +6997,35 @@ vim_deltempdir()
}
#endif
#ifdef TEMPDIRNAMES
/*
* Directory "tempdir" was created. Expand this name to a full path and put
* it in "vim_tempdir". This avoids that using ":cd" would confuse us.
* "tempdir" must be no longer than MAXPATHL.
*/
static void
vim_settempdir(tempdir)
char_u *tempdir;
{
char_u *buf;
buf = alloc((unsigned)MAXPATHL + 2);
if (buf != NULL)
{
if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL)
STRCPY(buf, tempdir);
# ifdef __EMX__
if (vim_strchr(buf, '/') != NULL)
STRCAT(buf, "/");
else
# endif
add_pathsep(buf);
vim_tempdir = vim_strsave(buf);
vim_free(buf);
}
}
#endif
/*
* vim_tempname(): Return a unique name that can be used for a temp file.
*
@@ -7007,8 +7047,6 @@ vim_tempname(extra_char)
#ifdef TEMPDIRNAMES
static char *(tempdirs[]) = {TEMPDIRNAMES};
int i;
long nr;
long off;
# ifndef EEXIST
struct stat st;
# endif
@@ -7027,6 +7065,12 @@ vim_tempname(extra_char)
*/
for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i)
{
size_t itmplen;
# ifndef HAVE_MKDTEMP
long nr;
long off;
# endif
/* expand $TMP, leave room for "/v1100000/999999999" */
expand_env((char_u *)tempdirs[i], itmp, TEMPNAMELEN - 20);
if (mch_isdir(itmp)) /* directory exists */
@@ -7040,7 +7084,14 @@ vim_tempname(extra_char)
else
# endif
add_pathsep(itmp);
itmplen = STRLEN(itmp);
# ifdef HAVE_MKDTEMP
/* Leave room for filename */
STRCAT(itmp, "vXXXXXX");
if (mkdtemp((char *)itmp) != NULL)
vim_settempdir(itmp);
# else
/* Get an arbitrary number of up to 6 digits. When it's
* unlikely that it already exists it will be faster,
* otherwise it doesn't matter. The use of mkdir() avoids any
@@ -7052,59 +7103,41 @@ vim_tempname(extra_char)
for (off = 0; off < 10000L; ++off)
{
int r;
#if defined(UNIX) || defined(VMS)
# if defined(UNIX) || defined(VMS)
mode_t umask_save;
#endif
# endif
sprintf((char *)itmp + STRLEN(itmp), "v%ld", nr + off);
# ifndef EEXIST
sprintf((char *)itmp + itmplen, "v%ld", nr + off);
# ifndef EEXIST
/* If mkdir() does not set errno to EEXIST, check for
* existing file here. There is a race condition then,
* although it's fail-safe. */
if (mch_stat((char *)itmp, &st) >= 0)
continue;
# endif
#if defined(UNIX) || defined(VMS)
# endif
# if defined(UNIX) || defined(VMS)
/* Make sure the umask doesn't remove the executable bit.
* "repl" has been reported to use "177". */
umask_save = umask(077);
#endif
# endif
r = vim_mkdir(itmp, 0700);
#if defined(UNIX) || defined(VMS)
# if defined(UNIX) || defined(VMS)
(void)umask(umask_save);
#endif
# endif
if (r == 0)
{
char_u *buf;
/* Directory was created, use this name.
* Expand to full path; When using the current
* directory a ":cd" would confuse us. */
buf = alloc((unsigned)MAXPATHL + 1);
if (buf != NULL)
{
if (vim_FullName(itmp, buf, MAXPATHL, FALSE)
== FAIL)
STRCPY(buf, itmp);
# ifdef __EMX__
if (vim_strchr(buf, '/') != NULL)
STRCAT(buf, "/");
else
# endif
add_pathsep(buf);
vim_tempdir = vim_strsave(buf);
vim_free(buf);
}
vim_settempdir(itmp);
break;
}
# ifdef EEXIST
# ifdef EEXIST
/* If the mkdir() didn't fail because the file/dir exists,
* we probably can't create any dir here, try another
* place. */
if (errno != EEXIST)
# endif
# endif
break;
}
# endif /* HAVE_MKDTEMP */
if (vim_tempdir != NULL)
break;
}
@@ -8576,6 +8609,7 @@ aucmd_restbuf(aco)
curwin = firstwin;
# ifdef FEAT_EVAL
vars_clear(&aucmd_win->w_vars.dv_hashtab); /* free all w: variables */
hash_init(&aucmd_win->w_vars.dv_hashtab); /* re-use the hashtab */
# endif
#else
curwin = aco->save_curwin;

View File

@@ -22,7 +22,7 @@
* These buffers are used for storing:
* - stuffed characters: A command that is translated into another command.
* - redo characters: will redo the last change.
* - recorded chracters: for the "q" command.
* - recorded characters: for the "q" command.
*
* The bytes are stored like in the typeahead buffer:
* - K_SPECIAL introduces a special key (two more bytes follow). A literal
@@ -1283,7 +1283,7 @@ free_typebuf()
EMSG2(_(e_intern2), "Free typebuf 1");
else
vim_free(typebuf.tb_buf);
if (typebuf.tb_buf == noremapbuf_init)
if (typebuf.tb_noremap == noremapbuf_init)
EMSG2(_(e_intern2), "Free typebuf 2");
else
vim_free(typebuf.tb_noremap);
@@ -1516,7 +1516,7 @@ updatescript(c)
* wanted.
* This translates escaped K_SPECIAL and CSI bytes to a K_SPECIAL or CSI byte.
* Collects the bytes of a multibyte character into the whole character.
* Returns the modifers in the global "mod_mask".
* Returns the modifiers in the global "mod_mask".
*/
int
vgetc()
@@ -3320,7 +3320,7 @@ do_map(maptype, arg, mode, abbrev)
retval = 1;
goto theend;
}
/* An abbrevation cannot contain white space. */
/* An abbreviation cannot contain white space. */
for (n = 0; n < len; ++n)
if (vim_iswhite(keys[n]))
{
@@ -4272,7 +4272,7 @@ check_abbr(c, ptr, col, mincol)
/*
* Check for word before the cursor: If it ends in a keyword char all
* chars before it must be al keyword chars or non-keyword chars, but not
* chars before it must be keyword chars or non-keyword chars, but not
* white space. If it ends in a non-keyword char we accept any characters
* before it except white space.
*/

View File

@@ -3151,7 +3151,7 @@ usage()
main_msg(_("--servername <name>\tSend to/become the Vim server <name>"));
#endif
#ifdef STARTUPTIME
main_msg(_("--startuptime=<file>\tWrite startup timing messages to <file>"));
main_msg(_("--startuptime <file>\tWrite startup timing messages to <file>"));
#endif
#ifdef FEAT_VIMINFO
main_msg(_("-i <viminfo>\t\tUse <viminfo> instead of .viminfo"));

View File

@@ -1343,6 +1343,11 @@ mf_do_open(mfp, fname, flags)
}
else
{
#ifdef HAVE_FD_CLOEXEC
int fdflags = fcntl(mfp->mf_fd, F_GETFD);
if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC);
#endif
#ifdef HAVE_SELINUX
mch_copy_sec(fname, mfp->mf_fname);
#endif

View File

@@ -382,7 +382,7 @@ ml_open(buf)
dp->db_index[0] = --dp->db_txt_start; /* at end of block */
dp->db_free -= 1 + INDEX_SIZE;
dp->db_line_count = 1;
*((char_u *)dp + dp->db_txt_start) = NUL; /* emtpy line */
*((char_u *)dp + dp->db_txt_start) = NUL; /* empty line */
return OK;
@@ -490,6 +490,13 @@ ml_setname(buf)
EMSG(_("E301: Oops, lost the swap file!!!"));
return;
}
#ifdef HAVE_FD_CLOEXEC
{
int fdflags = fcntl(mfp->mf_fd, F_GETFD);
if (fdflags >= 0 && (fdflags & FD_CLOEXEC) == 0)
fcntl(mfp->mf_fd, F_SETFD, fdflags | FD_CLOEXEC);
}
#endif
}
if (!success)
EMSG(_("E302: Could not rename swap file"));

View File

@@ -1026,12 +1026,14 @@ open_line(dir, flags, old_indent)
int c = 0;
int off = 0;
for (p = lead_flags; *p && *p != ':'; ++p)
for (p = lead_flags; *p != NUL && *p != ':'; )
{
if (*p == COM_RIGHT || *p == COM_LEFT)
c = *p;
c = *p++;
else if (VIM_ISDIGIT(*p) || *p == '-')
off = getdigits(&p);
else
++p;
}
if (c == COM_RIGHT) /* right adjusted leader */
{
@@ -1119,7 +1121,7 @@ open_line(dir, flags, old_indent)
if (i != lead_repl_len)
{
mch_memmove(p + lead_repl_len, p + i,
(size_t)(lead_len - i - (leader - p)));
(size_t)(lead_len - i - (p - leader)));
lead_len += lead_repl_len - i;
}
}

View File

@@ -1005,9 +1005,14 @@ free_all_mem()
# ifdef FEAT_MENU
/* Clear menus. */
do_cmdline_cmd((char_u *)"aunmenu *");
# ifdef FEAT_MULTI_LANG
do_cmdline_cmd((char_u *)"menutranslate clear");
# endif
# endif
/* Clear mappings, abbreviations, breakpoints. */
do_cmdline_cmd((char_u *)"lmapclear");
do_cmdline_cmd((char_u *)"xmapclear");
do_cmdline_cmd((char_u *)"mapclear");
do_cmdline_cmd((char_u *)"mapclear!");
do_cmdline_cmd((char_u *)"abclear");
@@ -1282,7 +1287,7 @@ csh_like_shell()
/*
* Escape "string" for use as a shell argument with system().
* This uses single quotes, except when we know we need to use double qoutes
* This uses single quotes, except when we know we need to use double quotes
* (MS-DOS and MS-Windows without 'shellslash' set).
* Escape a newline, depending on the 'shell' option.
* When "do_special" is TRUE also replace "!", "%", "#" and things starting
@@ -1537,7 +1542,7 @@ copy_spaces(ptr, count)
#if defined(FEAT_VISUALEXTRA) || defined(PROTO)
/*
* Copy a character a number of times.
* Does not work for multi-byte charactes!
* Does not work for multi-byte characters!
*/
void
copy_chars(ptr, count, c)
@@ -4260,7 +4265,7 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what,
* or '**76' is transposed to '**N'( 'N' is ASCII value 76).
* For EBCDIC you get different character values.
* If no restrict is given after '**' the default is used.
* Due to this technic the path looks awful if you print it as a
* Due to this technique the path looks awful if you print it as a
* string.
*/
len = 0;
@@ -4649,7 +4654,7 @@ vim_findfile(search_ctx_arg)
&& !mch_isdir(stackp->ffs_filearray[i]))
continue; /* not a directory */
/* prepare the filename to be checked for existance
/* prepare the filename to be checked for existence
* below */
STRCPY(file_path, stackp->ffs_filearray[i]);
add_pathsep(file_path);
@@ -5438,7 +5443,7 @@ find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_f
#if defined(MSWIN) || defined(MSDOS) || defined(OS2)
/* handle "\tmp" as absolute path */
|| vim_ispathsep(ff_file_to_find[0])
/* handle "c:name" as absulute path */
/* handle "c:name" as absolute path */
|| (ff_file_to_find[0] != NUL && ff_file_to_find[1] == ':')
#endif
#ifdef AMIGA
@@ -5681,7 +5686,7 @@ qsort(base, elm_count, elm_size, cmp)
p2 = (char_u *)base + (j + gap) * elm_size;
if ((*cmp)((void *)p1, (void *)p2) <= 0)
break;
/* Exchange the elemets. */
/* Exchange the elements. */
mch_memmove(buf, p1, elm_size);
mch_memmove(p1, p2, elm_size);
mch_memmove(p2, buf, elm_size);

View File

@@ -422,8 +422,9 @@ shift_block(oap, amount)
#ifdef FEAT_MBYTE
if (has_mbyte)
bd.textstart += (*mb_ptr2len)(bd.textstart);
else
#endif
++bd.textstart;
++bd.textstart;
}
for ( ; vim_iswhite(*bd.textstart); )
{
@@ -3990,6 +3991,14 @@ ex_display(eap)
}
else
yb = &(y_regs[i]);
#ifdef FEAT_EVAL
if (name == MB_TOLOWER(redir_reg)
|| (redir_reg == '"' && yb == y_previous))
continue; /* do not list register being written to, the
* pointer can be freed */
#endif
if (yb->y_array != NULL)
{
msg_putchar('\n');
@@ -5588,7 +5597,10 @@ x11_export_final_selection()
vc.vc_type = CONV_NONE;
if (convert_setup(&vc, p_enc, (char_u *)"latin1") == OK)
{
conv_str = string_convert(&vc, str, (int*)&len);
int intlen = len;
conv_str = string_convert(&vc, str, &intlen);
len = intlen;
if (conv_str != NULL)
{
vim_free(str);
@@ -6089,7 +6101,7 @@ str_to_reg(y_ptr, type, str, len, blocklen)
long maxlen;
#endif
if (y_ptr->y_array == NULL) /* NULL means emtpy register */
if (y_ptr->y_array == NULL) /* NULL means empty register */
y_ptr->y_size = 0;
/*

View File

@@ -323,6 +323,7 @@ update_screen(type)
int did_one;
#endif
/* Don't do anything if the screen structures are (not yet) valid. */
if (!screen_valid(TRUE))
return;
@@ -342,7 +343,9 @@ update_screen(type)
if (curwin->w_lines_valid == 0 && type < NOT_VALID)
type = NOT_VALID;
if (!redrawing())
/* Postpone the redrawing when it's not needed and when being called
* recursively. */
if (!redrawing() || updating_screen)
{
redraw_later(type); /* remember type for next time */
must_redraw = type;
@@ -582,6 +585,7 @@ static void update_finish __ARGS((void));
/*
* Prepare for updating one or more windows.
* Caller must check for "updating_screen" already set to avoid recursiveness.
*/
static void
update_prepare()
@@ -663,7 +667,9 @@ update_debug_sign(buf, lnum)
doit = TRUE;
}
if (!doit)
/* Return when there is nothing to do or screen updating already
* happening. */
if (!doit || updating_screen)
return;
/* update all windows that need updating */
@@ -696,6 +702,10 @@ update_debug_sign(buf, lnum)
updateWindow(wp)
win_T *wp;
{
/* return if already busy updating */
if (updating_screen)
return;
update_prepare();
#ifdef FEAT_CLIPBOARD
@@ -6413,7 +6423,8 @@ screen_puts_len(text, len, row, col, attr)
}
else
{
nc = utfc_ptr2char(ptr + mbyte_blen, pcc);
nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc,
(int)((text + len) - ptr - mbyte_blen));
nc1 = pcc[0];
}
pc = prev_c;

View File

@@ -26,7 +26,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test48.out test51.out test53.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
test66.out test67.out test68.out test69.out
.SUFFIXES: .in .out
@@ -113,3 +113,5 @@ test64.out: test64.in
test65.out: test65.in
test66.out: test66.in
test67.out: test67.in
test68.out: test68.in
test69.out: test69.in

View File

@@ -26,7 +26,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test15.out test17.out test18.out test21.out test26.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
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out
SCRIPTS32 = test50.out

View File

@@ -45,7 +45,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test15.out test17.out test18.out test21.out test26.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
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out
SCRIPTS32 = test50.out

View File

@@ -26,7 +26,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test48.out test51.out test53.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
test66.out test67.out test68.out test69.out
.SUFFIXES: .in .out

View File

@@ -69,7 +69,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test48.out test51.out test53.out test54.out test55.out \
test56.out test57.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out
test66.out test67.out test68.out test69.out
.IFDEF WANT_GUI
SCRIPT_GUI = test16.out

View File

@@ -22,7 +22,8 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test48.out test49.out test51.out test52.out test53.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
test64.out test65.out test66.out test67.out test68.out \
test69.out
SCRIPTS_GUI = test16.out

56
src/testdir/test68.in Normal file
View File

@@ -0,0 +1,56 @@
Test for text formatting.
Results of test68:
STARTTEST
:so small.vim
/^{/+1
:set noai tw=2 fo=t
gRa b
ENDTEST
{
}
STARTTEST
/^{/+1
:set ai tw=2 fo=tw
gqgqjjllab
ENDTEST
{
a b
a
}
STARTTEST
/^{/+1
:set tw=3 fo=t
gqgqo
a 
ENDTEST
{
a 
}
STARTTEST
/^{/+1
:set tw=2 fo=tcq1 comments=:#
gqgqjgqgqo
a b
#a b
ENDTEST
{
a b
#a b
}
STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/^Results/,$wq! test.out
ENDTEST

35
src/testdir/test68.ok Normal file
View File

@@ -0,0 +1,35 @@
Results of test68:
{
a
b
}
{
a
b
a
b
}
{
a

a

}
{
a b
#a b
a b
#a b
}

139
src/testdir/test69.in Normal file
View File

@@ -0,0 +1,139 @@
Test for multi-byte text formatting.
STARTTEST
:so mbyte.vim
:set encoding=utf-8
ENDTEST
Results of test69:
STARTTEST
/^{/+1
:set tw=2 fo=t
gqgqjgqgqo
abc 
ENDTEST
{
abc
}
STARTTEST
/^{/+1
:set tw=1 fo=tm
gqgqjgqgqjgqgqjgqgqjgqgqo
a
a

ENDTEST
{
a
a
}
STARTTEST
/^{/+1
:set tw=2 fo=tm
gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo
a
a
a
ab
abc
ab c
ab
ENDTEST
{
a
a
a
ab
abc
ab c
ab
}
STARTTEST
/^{/+1
:set ai tw=2 fo=tm
gqgqjgqgqo
a
ENDTEST
{
a
}
STARTTEST
/^{/+1
:set noai tw=2 fo=tm
gqgqjgqgqo
a
ENDTEST
{
a
}
STARTTEST
/^{/+1
:set tw=2 fo=cqm comments=n:
gqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqjgqgqo
a
a
a

ENDTEST
{
a
a
a
}
STARTTEST
/^{/+1
:set tw=2 fo=tm
Ra
ENDTEST
{
}
STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/^Results/,$wq! test.out
ENDTEST

142
src/testdir/test69.ok Normal file
View File

@@ -0,0 +1,142 @@
Results of test69:
{
abc
abc
}
{
a
a
a
a
}
{
a
a
a
ab
abc
ab
c
ab
a
a
a
ab
abc
ab
c
ab
}
{
a
a
}
{
a
a
}
{
a
a
a
a
a
a
}
{
a
}

View File

@@ -681,6 +681,40 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
305,
/**/
304,
/**/
303,
/**/
302,
/**/
301,
/**/
300,
/**/
299,
/**/
298,
/**/
297,
/**/
296,
/**/
295,
/**/
294,
/**/
293,
/**/
292,
/**/
291,
/**/
290,
/**/
289,
/**/
288,
/**/