Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2018-09-22 00:59:19 -07:00
17 changed files with 212 additions and 59 deletions
+16 -4
View File
@@ -35,6 +35,9 @@ FEATURES=HUGE
# set to yes for a debug build
DEBUG=no
# set to yes to create a mapfile
# MAP=yes
# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization
OPTIMIZE=MAXSPEED
@@ -244,6 +247,8 @@ endif
# Lua interface:
# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak)
# LUA_LIBDIR=[Path to Lua library directory] (default: $LUA/lib)
# LUA_INCDIR=[Path to Lua include directory] (default: $LUA/include)
# DYNAMIC_LUA=yes (to load the Lua DLL dynamically)
# LUA_VER=[Lua version, eg 51, 52] (default is 53)
ifdef LUA
@@ -256,7 +261,8 @@ LUA_VER=53
endif
ifeq (no,$(DYNAMIC_LUA))
LUA_LIB = -L$(LUA)/lib -llua
LUA_LIBDIR = $(LUA)/lib
LUA_LIB = -L$(LUA_LIBDIR) -llua
endif
endif
@@ -472,9 +478,10 @@ ifeq (19, $(word 1,$(sort 19 $(RUBY_VER))))
RUBY_19_OR_LATER = 1
endif
RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
ifdef RUBY_19_OR_LATER
RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
RUBYINC = -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
else
RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_API_VER_LONG)/$(RUBY_PLATFORM)
endif
ifeq (no, $(DYNAMIC_RUBY))
RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME)
@@ -524,7 +531,8 @@ endif
endif
ifdef LUA
CFLAGS += -I$(LUA)/include -I$(LUA) -DFEAT_LUA
LUA_INCDIR = $(LUA)/include
CFLAGS += -I$(LUA_INCDIR) -I$(LUA) -DFEAT_LUA
ifeq (yes, $(DYNAMIC_LUA))
CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\"
endif
@@ -931,6 +939,10 @@ ifeq (yes, $(STATIC_WINPTHREAD))
LIB += -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
endif
ifeq (yes, $(MAP))
LFLAGS += -Wl,-Map=$(TARGET).map
endif
all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll
vimrun.exe: vimrun.c
+1 -1
View File
@@ -1136,7 +1136,7 @@ RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER)
CFLAGS = $(CFLAGS) -DFEAT_RUBY
RUBY_OBJ = $(OUTDIR)\if_ruby.obj
!if $(RUBY_VER) >= 19
RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
RUBY_INC = /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)" /I "$(RUBY)\include\ruby-$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
!else
RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_API_VER_LONG)\$(RUBY_PLATFORM)"
!endif
+2 -1
View File
@@ -2045,8 +2045,9 @@ proto: $(PRO_AUTO) $(PRO_MANUAL)
# them as a list of individual flags.
# The -E"gcc -E" argument must be separate to avoid problems with shell
# quoting.
# Strip -O2, it may cause cproto to write stderr to the file "2".
CPROTO = cproto $(PROTO_FLAGS) -DPROTO \
`echo '$(LINT_CFLAGS)' | sed -e 's/ -[a-z-]\+//g'`
`echo '$(LINT_CFLAGS)' | sed -e 's/ -[a-z-]\+//g' -e 's/ -O[^ ]\+//g'`
### Would be nice if this would work for "normal" make.
### Currently it only works for (Free)BSD make.
+6
View File
@@ -428,7 +428,10 @@ can_unload_buffer(buf_T *buf)
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
{
can_unload = FALSE;
break;
}
}
if (!can_unload)
EMSG(_("E937: Attempt to delete a buffer that is in use"));
@@ -1746,6 +1749,9 @@ enter_buffer(buf_T *buf)
/* mark cursor position as being invalid */
curwin->w_valid = 0;
buflist_setfpos(curbuf, curwin, curbuf->b_last_cursor.lnum,
curbuf->b_last_cursor.col, TRUE);
/* Make sure the buffer is loaded. */
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
{
+3
View File
@@ -649,7 +649,10 @@ ex_sort(exarg_T *eap)
/* Adjust marks for deleted (or added) lines and prepare for displaying. */
deleted = (long)(count - (lnum - eap->line2));
if (deleted > 0)
{
mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted);
msgmore(-deleted);
}
else if (deleted < 0)
mark_adjust(eap->line2, MAXLNUM, -deleted, 0L);
+10 -4
View File
@@ -88,10 +88,8 @@
# endif
#endif
/* Perl compatibility stuff. This should ensure compatibility with older
* versions of Perl.
*/
// Perl compatibility stuff. This should ensure compatibility with older
// versions of Perl.
#ifndef PERL_VERSION
# include <patchlevel.h>
# define PERL_REVISION 5
@@ -99,6 +97,14 @@
# define PERL_SUBVERSION SUBVERSION
#endif
// Work around for ActivePerl 5.20.3+: Avoid generating (g)vim.lib.
#if defined(ACTIVEPERL_VERSION) && (ACTIVEPERL_VERSION >= 2003) \
&& defined(WIN32) && defined(USE_DYNAMIC_LOADING)
# undef XS_EXTERNAL
# define XS_EXTERNAL(name) XSPROTO(name)
#endif
/*
* Quoting Jan Dubois of Active State:
* ActivePerl build 822 still identifies itself as 5.8.8 but already
+3 -10
View File
@@ -539,9 +539,6 @@ mf_sync(memfile_T *mfp, int flags)
{
int status;
bhdr_T *hp;
#if defined(SYNC_DUP_CLOSE)
int fd;
#endif
int got_int_save = got_int;
if (mfp->mf_fd < 0) /* there is no file, nothing to do */
@@ -624,13 +621,9 @@ mf_sync(memfile_T *mfp, int flags)
status = FAIL;
}
#endif
#ifdef SYNC_DUP_CLOSE
/*
* Win32 is a bit more work: Duplicate the file handle and close it.
* This should flush the file to disk.
*/
if ((fd = dup(mfp->mf_fd)) >= 0)
close(fd);
#ifdef WIN32
if (_commit(mfp->mf_fd))
status = FAIL;
#endif
#ifdef AMIGA
# if defined(__AROS__) || defined(__amigaos4__)
+8 -5
View File
@@ -4463,7 +4463,9 @@ trigger_optionsset_string(
char_u *oldval,
char_u *newval)
{
if (oldval != NULL && newval != NULL)
// Don't do this recursively.
if (oldval != NULL && newval != NULL
&& *get_vim_var_str(VV_OPTION_TYPE) == NUL)
{
char_u buf_type[7];
@@ -7906,8 +7908,6 @@ did_set_string_option(
#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
if (did_swaptcap)
{
if (t_colors < 256)
p_tgc = 0;
set_termname((char_u *)"win32");
init_highlight(TRUE, FALSE);
}
@@ -9029,9 +9029,11 @@ set_bool_option(
options[opt_idx].flags |= P_WAS_SET;
#if defined(FEAT_EVAL)
if (!starting)
// Don't do this while starting up or recursively.
if (!starting && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
{
char_u buf_old[2], buf_new[2], buf_type[7];
vim_snprintf((char *)buf_old, 2, "%d", old_value ? TRUE: FALSE);
vim_snprintf((char *)buf_new, 2, "%d", value ? TRUE: FALSE);
vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global");
@@ -9625,7 +9627,8 @@ set_num_option(
options[opt_idx].flags |= P_WAS_SET;
#if defined(FEAT_EVAL)
if (!starting && errmsg == NULL)
// Don't do this while starting up, failure or recursively.
if (!starting && errmsg == NULL && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
{
char_u buf_old[11], buf_new[11], buf_type[7];
vim_snprintf((char *)buf_old, 10, "%ld", old_value);
-1
View File
@@ -101,7 +101,6 @@
#define HAVE_AVAIL_MEM
#ifndef HAVE_CONFIG_H
/* #define SYNC_DUP_CLOSE sync() a file with dup() and close() */
# define HAVE_STRING_H
# define HAVE_STRCSPN
# define HAVE_MEMSET
-1
View File
@@ -26,7 +26,6 @@
#define BINARY_FILE_IO
#define USE_EXE_NAME /* use argv[0] for $VIM */
#define SYNC_DUP_CLOSE /* sync() a file with dup() and close() */
#define USE_TERM_CONSOLE
#ifndef HAVE_STRING_H
# define HAVE_STRING_H
+22 -22
View File
@@ -6749,35 +6749,35 @@ update_tcap(int attr)
# define KSSIZE 20
struct ks_tbl_s
{
int code; /* value of KS_ */
char *vtp; /* code in vtp mode */
char *vtp2; /* code in vtp2 mode */
char buf[KSSIZE]; /* save buffer in non-vtp mode */
char vbuf[KSSIZE]; /* save buffer in vtp mode */
char v2buf[KSSIZE]; /* save buffer in vtp2 mode */
char arr[KSSIZE]; /* real buffer */
int code; // value of KS_
char *vtp; // code in vtp mode
char *vtp2; // code in vtp2 mode
char buf[KSSIZE]; // save buffer in non-vtp mode
char vbuf[KSSIZE]; // save buffer in vtp mode
char v2buf[KSSIZE]; // save buffer in vtp2 mode
char arr[KSSIZE]; // real buffer
};
static struct ks_tbl_s ks_tbl[] =
{
{(int)KS_ME, "\033|0m", "\033|0m"}, /* normal */
{(int)KS_MR, "\033|7m", "\033|7m"}, /* reverse */
{(int)KS_MD, "\033|1m", "\033|1m"}, /* bold */
{(int)KS_SO, "\033|91m", "\033|91m"}, /* standout: bright red text */
{(int)KS_SE, "\033|39m", "\033|39m"}, /* standout end: default color */
{(int)KS_CZH, "\033|95m", "\033|95m"}, /* italic: bright magenta text */
{(int)KS_CZR, "\033|0m", "\033|0m"}, /* italic end */
{(int)KS_US, "\033|4m", "\033|4m"}, /* underscore */
{(int)KS_UE, "\033|24m", "\033|24m"}, /* underscore end */
{(int)KS_ME, "\033|0m", "\033|0m"}, // normal
{(int)KS_MR, "\033|7m", "\033|7m"}, // reverse
{(int)KS_MD, "\033|1m", "\033|1m"}, // bold
{(int)KS_SO, "\033|91m", "\033|91m"}, // standout: bright red text
{(int)KS_SE, "\033|39m", "\033|39m"}, // standout end: default color
{(int)KS_CZH, "\033|95m", "\033|95m"}, // italic: bright magenta text
{(int)KS_CZR, "\033|0m", "\033|0m"}, // italic end
{(int)KS_US, "\033|4m", "\033|4m"}, // underscore
{(int)KS_UE, "\033|24m", "\033|24m"}, // underscore end
# ifdef TERMINFO
{(int)KS_CAB, "\033|%p1%db", "\033|%p14%dm"}, /* set background color */
{(int)KS_CAF, "\033|%p1%df", "\033|%p13%dm"}, /* set foreground color */
{(int)KS_CAB, "\033|%p1%db", "\033|%p14%dm"}, // set background color
{(int)KS_CAF, "\033|%p1%df", "\033|%p13%dm"}, // set foreground color
# else
{(int)KS_CAB, "\033|%db", "\033|4%dm"}, /* set background color */
{(int)KS_CAF, "\033|%df", "\033|3%dm"}, /* set foreground color */
{(int)KS_CAB, "\033|%db", "\033|4%dm"}, // set background color
{(int)KS_CAF, "\033|%df", "\033|3%dm"}, // set foreground color
# endif
{(int)KS_CCO, "16", "256"}, /* colors */
{(int)KS_NAME} /* terminator */
{(int)KS_CCO, "256", "256"}, // colors
{(int)KS_NAME} // terminator
};
static struct builtin_term *
+4 -1
View File
@@ -112,7 +112,10 @@ bench_re_freeze.out: bench_re_freeze.vim
# to write and a lot easier to read and debug.
# Limitation: Only works with the +eval feature.
newtests: $(NEW_TESTS)
newtests: newtestssilent
@if exist messages (findstr "SKIPPED FAILED" messages > nul) && type messages
newtestssilent: $(NEW_TESTS)
.vim.res:
@echo $(VIMPROG) > vimcmd
+8 -5
View File
@@ -9,6 +9,9 @@ XXDPROG = ../xxd/xxd
SCRIPTSOURCE = ../../runtime
# Change this to empty to see the verbose output of tests.
REDIR_TEST_TO_NULL = > /dev/null
# Uncomment this line to use valgrind for memory leaks and extra warnings.
# The output goes into a file "valgrind.testN"
# Vim should be compiled with EXITFREE to avoid false warnings.
@@ -59,7 +62,7 @@ clean:
test1.out: test1.in
-rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize
$(RUN_VIM) $*.in
$(RUN_VIM) $*.in $(REDIR_TEST_TO_NULL)
@/bin/sh -c "if test -f wrongtermsize; \
then echo; \
echo test1 FAILED - terminal size must be 80x24 or larger; \
@@ -78,7 +81,7 @@ test1.out: test1.in
# 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
$(RUN_VIM) $*.in
$(RUN_VIM) $*.in $(REDIR_TEST_TO_NULL)
# For flaky tests retry one time. No tests at the moment.
#@/bin/sh -c "if test -f test.out -a $* = test61; then \
@@ -108,7 +111,7 @@ bench_re_freeze.out: bench_re_freeze.vim
# 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
$(RUN_VIM) $*.in
$(RUN_VIM) $*.in $(REDIR_TEST_TO_NULL)
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
nolog:
@@ -121,7 +124,7 @@ nolog:
RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim
newtests: newtestssilent
@/bin/sh -c "if test -f messages && grep -q 'SKIPPED\|FAILED' messages; then cat messages && if test -f test.log; then cat test.log; fi ; fi"
@/bin/sh -c "if test -f messages && grep -q 'SKIPPED\|FAILED' messages; then cat messages; fi"
newtestssilent: $(NEW_TESTS)
@@ -129,7 +132,7 @@ newtestssilent: $(NEW_TESTS)
.vim.res: writevimcmd
@echo "$(VIMPROG)" > vimcmd
@echo "$(RUN_VIMTEST)" >> vimcmd
$(RUN_VIMTEST) $(NO_INITS) -S runtest.vim $*.vim
$(RUN_VIMTEST) $(NO_INITS) -S runtest.vim $*.vim $(REDIR_TEST_TO_NULL)
@rm vimcmd
test_gui.res: test_gui.vim
+27
View File
@@ -91,6 +91,33 @@ func Test_appendbufline()
exe "bwipe! " . b
endfunc
func Test_appendbufline_no_E315()
let after = [
\ 'set stl=%f ls=2',
\ 'new',
\ 'let buf = bufnr("%")',
\ 'quit',
\ 'vsp',
\ 'exec "buffer" buf',
\ 'wincmd w',
\ 'call appendbufline(buf, 0, "abc")',
\ 'redraw',
\ 'while getbufline(buf, 1)[0] =~ "^\\s*$"',
\ ' sleep 10m',
\ 'endwhile',
\ 'au VimLeavePre * call writefile([v:errmsg], "Xerror")',
\ 'au VimLeavePre * call writefile(["done"], "Xdone")',
\ 'qall!',
\ ]
if !RunVim([], after, '--clean')
return
endif
call assert_notmatch("^E315:", readfile("Xerror")[0])
call assert_equal("done", readfile("Xdone")[0])
call delete("Xerror")
call delete("Xdone")
endfunc
func Test_deletebufline()
new
let b = bufnr('%')
+30
View File
@@ -1221,3 +1221,33 @@ func Test_sort_cmd()
enew!
endfunc
func Test_sort_cmd_report()
enew!
call append(0, repeat([1], 3) + repeat([2], 3) + repeat([3], 3))
$delete _
setlocal nomodified
let res = execute('%sort u')
call assert_equal([1,2,3], map(getline(1, '$'), 'v:val+0'))
call assert_match("6 fewer lines", res)
enew!
call append(0, repeat([1], 3) + repeat([2], 3) + repeat([3], 3))
$delete _
setlocal nomodified report=10
let res = execute('%sort u')
call assert_equal([1,2,3], map(getline(1, '$'), 'v:val+0'))
call assert_equal("", res)
enew!
call append(0, repeat([1], 3) + repeat([2], 3) + repeat([3], 3))
$delete _
setl report&vim
setlocal nomodified
let res = execute('1g/^/%sort u')
call assert_equal([1,2,3], map(getline(1, '$'), 'v:val+0'))
" the output comes from the :g command, not from the :sort
call assert_match("6 fewer lines", res)
enew!
endfunc
+46 -4
View File
@@ -194,8 +194,8 @@ func Test_o_arg()
" Open 2 windows split vertically. Expect:
" - 2 windows
" - both windows should have the same or almost the same width
" - sum of both windows width (+ 1 separator) should be equal to the
" number of columns
" - sum of both windows width (+ 1 for the separator) should be equal to
" the number of columns
" - both windows should have the same height
" - window height (+ 2 for the statusline and Ex command) should be equal
" to the number of lines
@@ -269,6 +269,48 @@ func Test_V_arg()
call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\r\nline 1: \" The default vimrc file\..* verbose=15\n", out)
endfunc
" Test the -V[N]{filename} argument to set the 'verbose' option to N
" and set 'verbosefile' to filename.
func Test_V_file_arg()
if RunVim([], [], ' --clean -X -V2Xverbosefile -c "set verbose? verbosefile?" -cq')
let out = join(readfile('Xverbosefile'), "\n")
call assert_match("sourcing \"$VIMRUNTIME[\\/]defaults\.vim\"\n", out)
call assert_match("\n verbose=2\n", out)
call assert_match("\n verbosefile=Xverbosefile", out)
endif
call delete('Xverbosefile')
endfunc
" Test the -m, -M and -R arguments:
" -m resets 'write'
" -M resets 'modifiable' and 'write'
" -R sets 'readonly'
func Test_m_M_R()
let after = [
\ 'call writefile([&write, &modifiable, &readonly, &updatecount], "Xtestout")',
\ 'qall',
\ ]
if RunVim([], after, '')
let lines = readfile('Xtestout')
call assert_equal(['1', '1', '0', '200'], lines)
endif
if RunVim([], after, '-m')
let lines = readfile('Xtestout')
call assert_equal(['0', '1', '0', '200'], lines)
endif
if RunVim([], after, '-M')
let lines = readfile('Xtestout')
call assert_equal(['0', '0', '0', '200'], lines)
endif
if RunVim([], after, '-R')
let lines = readfile('Xtestout')
call assert_equal(['1', '1', '1', '10000'], lines)
endif
call delete('Xtestout')
endfunc
" Test the -A, -F and -H arguments (Arabic, Farsi and Hebrew modes).
func Test_A_F_H_arg()
let after = [
@@ -430,7 +472,7 @@ func Test_zzz_startinsert()
call writefile(['123456'], 'Xtestout')
let after = [
\ ':startinsert',
\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
\ ]
if RunVim([], after, 'Xtestout')
let lines = readfile('Xtestout')
@@ -440,7 +482,7 @@ func Test_zzz_startinsert()
call writefile(['123456'], 'Xtestout')
let after = [
\ ':startinsert!',
\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
\ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
\ ]
if RunVim([], after, 'Xtestout')
let lines = readfile('Xtestout')
+26
View File
@@ -809,6 +809,32 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
425,
/**/
424,
/**/
423,
/**/
422,
/**/
421,
/**/
420,
/**/
419,
/**/
418,
/**/
417,
/**/
416,
/**/
415,
/**/
414,
/**/
413,
/**/
412,
/**/