Compare commits

..

12 Commits

Author SHA1 Message Date
59eb016dff patch 8.0.1385: Python 3.5 is getting old
Problem:    Python 3.5 is getting old.
Solution:   Make Python 3.6 the default. (Ken Takata, closes #2429)
2017-12-10 18:17:44 +01:00
74240d3feb patch 8.0.1384: not enough quickfix help; confusing winid
Problem:    Not enough quickfix help; confusing winid.
Solution:   Add more examples in the help. When the quickfix window is not
            present, return zero for getqflist() with 'winid'. Add more tests
            for jumping to quickfix list entries. (Yegappan Lakshmanan, closes
            #2427)
2017-12-10 15:26:15 +01:00
35c5e8155d patch 8.0.1383: local additions in help skips some files
Problem:    Local additions in help skips some files. (joshklod)
Solution:   Check the base file name length equals.
2017-12-09 21:10:13 +01:00
f405c8fe85 patch 8.0.1382: get "no write since last change" message if terminal is open
Problem:    Get "no write since last change" message if a terminal is open.
            (Fritz mehner)
Solution:   Don't consider a buffer changed if it's a terminal window.
2017-12-09 19:51:49 +01:00
620ca2da37 patch 8.0.1381: ch_readraw() waits for NL if channel mode is NL
Problem:    ch_readraw() waits for NL if channel mode is NL.
Solution:   Pass a "raw" flag to channel_read_block(). (Yasuhiro Matsumoto)
2017-12-09 19:13:13 +01:00
05684310a5 patch 8.0.1380: using "vim -r swapfile" the hit-enter prompt is misplaced.
Problem:    When recovering a file with "vim -r swapfile" the hit-enter prompt
            is at the top of the window.
Solution:   Invalidate the cursor position.
2017-12-09 15:11:24 +01:00
e4b78e2a42 patch 8.0.1379: configure check for selinux does not check for header file
Problem:    Configure check for selinux does not check for header file.
Solution:   Add an AC_CHECK_HEADER(). (Benny Siegert)
2017-12-07 22:29:11 +01:00
3388d33457 patch 8.0.1378: autoload script sources itself when defining function
Problem:    Autoload script sources itself when defining function.
Solution:   Pass TFN_NO_AUTOLOAD to trans_function_name(). (Yasuhiro
            Matsumoto, closes #2423)
2017-12-07 22:23:04 +01:00
6e65d594aa patch 8.0.1377: cannot call a dict function in autoloaded dict
Problem:    Cannot call a dict function in autoloaded dict.
Solution:   Call get_lval() passing the read-only flag.
2017-12-07 22:11:27 +01:00
23c1b2b018 patch 8.0.1376: cursor in terminal not always updated
Problem:    Cursor in terminal not always updated.
Solution:   Call gui_mch_flush(). (Ken Takata)
2017-12-05 21:32:33 +01:00
415a6939a4 patch 8.0.1375: window size wrong after maximizing with WinBar
Problem:    Window size wrong after maximizing with WinBar. (Lifepillar)
Solution:   Fix height computations. Redraw window when it is zero height but
            has a WinBar. (closes #2356)
2017-12-05 20:31:07 +01:00
5fe6bdf858 patch 8.0.1374: CTRL-A does not work with an empty line
Problem:    CTRL-A does not work with an empty line. (Alex)
Solution:   Decrement the end only once. (Hirohito Higashi, closes #2387)
2017-12-05 17:22:12 +01:00
37 changed files with 474 additions and 76 deletions

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.0. Last change: 2017 Nov 24
*eval.txt* For Vim version 8.0. Last change: 2017 Dec 09
VIM REFERENCE MANUAL by Bram Moolenaar
@ -2031,7 +2031,7 @@ assert_true({actual} [, {msg}]) none assert {actual} is true
asin({expr}) Float arc sine of {expr}
atan({expr}) Float arc tangent of {expr}
atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2}
balloon_show({msg}) none show {msg} inside the balloon
balloon_show({expr}) none show {expr} inside the balloon
balloon_split({msg}) List split {msg} as used for a balloon
browse({save}, {title}, {initdir}, {default})
String put up a file requester
@ -3056,12 +3056,16 @@ ch_open({address} [, {options}]) *ch_open()*
ch_read({handle} [, {options}]) *ch_read()*
Read from {handle} and return the received message.
{handle} can be a Channel or a Job that has a Channel.
For a NL channel this waits for a NL to arrive, except when
there is nothing more to read (channel was closed).
See |channel-more|.
{only available when compiled with the |+channel| feature}
ch_readraw({handle} [, {options}]) *ch_readraw()*
Like ch_read() but for a JS and JSON channel does not decode
the message. See |channel-more|.
the message. For a NL channel it does not block waiting for
the NL to arrive, but otherwise works like ch_read().
See |channel-more|.
{only available when compiled with the |+channel| feature}
ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
@ -4679,9 +4683,10 @@ getqflist([{what}]) *getqflist()*
the last quickfix list
size number of entries in the quickfix list
title get the list title
winid get the |window-ID| (if opened)
winid get the quickfix |window-ID|
all all of the above quickfix properties
Non-string items in {what} are ignored.
Non-string items in {what} are ignored. To get the value of a
particular item, set it to one.
If "nr" is not present then the current quickfix list is used.
If both "nr" and a non-zero "id" are specified, then the list
specified by "id" is used.
@ -4702,7 +4707,7 @@ getqflist([{what}]) *getqflist()*
nr quickfix list number
size number of entries in the quickfix list
title quickfix list title text
winid quickfix |window-ID| (if opened)
winid quickfix |window-ID|. If not present, set to 0
Examples: >
:echo getqflist({'all': 1})
@ -8793,8 +8798,8 @@ writefile({list}, {fname} [, {flags}])
the file. This flushes the file to disk, if possible. This
takes more time but avoids losing the file if the system
crashes.
When {flags} does not contain "S" or "s" then fsync is called
if the 'fsync' option is set.
When {flags} does not contain "S" or "s" then fsync() is
called if the 'fsync' option is set.
When {flags} contains "S" then fsync() is not called, even
when 'fsync' is set.

View File

@ -736,8 +736,8 @@ or 'pythonthreedll' option can be also used to specify the Python DLL.
The name of the DLL should match the Python version Vim was compiled with.
Currently the name for Python 2 is "python27.dll", that is for Python 2.7.
That is the default value for 'pythondll'. For Python 3 it is python35.dll
(Python 3.5). To know for sure edit "gvim.exe" and search for
That is the default value for 'pythondll'. For Python 3 it is python36.dll
(Python 3.6). To know for sure edit "gvim.exe" and search for
"python\d*.dll\c".

View File

@ -341,6 +341,50 @@ use this code: >
au QuickfixCmdPost make call QfMakeConv()
Another option is using 'makeencoding'.
*quickfix-title*
Every quickfix and location list has a title. By default the title is set to
the command that created the list. The |getqflist()| and |getloclist()|
functions can be used to get the title of a quickfix and a location list
respectively. The |setqflist()| and |setloclist()| functions can be used to
modify the title of a quickfix and location list respectively. Examples: >
call setqflist([], 'a', {'title' : 'Cmd output'})
echo getqflist({'title' : 1})
call setloclist(3, [], 'a', {'title' : 'Cmd output'})
echo getloclist(3, {'title' : 1})
<
*quickfix-size*
You can get the number of entries (size) in a quickfix and a location list
using the |getqflist()| and |getloclist()| functions respectively. Examples: >
echo getqflist({'size' : 1})
echo getloclist(5, {'size' : 1})
<
*quickfix-context*
Any Vim type can be associated as a context with a quickfix or location list.
The |setqflist()| and the |setloclist()| functions can be used to associate a
context with a quickfix and a location list respectively. The |getqflist()|
and the |getloclist()| functions can be used to retrieve the context of a
quickifx and a location list respectively. This is useful for a Vim plugin
dealing with multiple quickfix/location lists.
Examples: >
let somectx = {'name' : 'Vim', 'type' : 'Editor'}
call setqflist([], 'a', {'context' : somectx})
echo getqflist({'context' : 1})
let newctx = ['red', 'green', 'blue']
call setloclist(2, [], 'a', {'id' : qfid, 'context' : newctx})
echo getloclist(2, {'id' : qfid, 'context' : 1})
<
*quickfix-parse*
You can parse a list of lines using 'erroformat' without creating or modifying
a quickfix list using the |getqflist()| function. Examples: >
echo getqflist({'lines' : ["F1:10:Line10", "F2:20:Line20"]})
echo getqflist({'lines' : systemlist('grep -Hn quickfix *')})
This returns a dictionary where the 'items' key contains the list of quickfix
entries parsed from lines. The following shows how to use a custom
'errorformat' to parse the lines without modifying the 'erroformat' option: >
echo getqflist({'efm' : '%f#%l#%m', 'lines' : ['F1#10#Line']})
<
EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
*:cdo*
@ -542,6 +586,13 @@ In all of the above cases, if the location list for the selected window is not
yet set, then it is set to the location list displayed in the location list
window.
*quickfix-window-ID*
You can use the |getqflist()| and |getloclist()| functions to obtain the
window ID of the quickfix window and location list window respectively (if
present). Examples: >
echo getqflist({'winid' : 1}).winid
echo getloclist(2, {'winid' : 1}).winid
<
=============================================================================
3. Using more than one list of errors *quickfix-error-lists*
@ -586,6 +637,14 @@ list, one newer list is overwritten. This is especially useful if you are
browsing with ":grep" |grep|. If you want to keep the more recent error
lists, use ":cnewer 99" first.
To get the number of lists in the quickfix and location list stack, you can
use the |getqflist()| and |getloclist()| functions respectively with the list
number set to the special value '$'. Examples: >
echo getqflist({'nr' : '$'}).nr
echo getloclist(3, {'nr' : '$'}).nr
To get the number of the current list in the stack: >
echo getqflist({'nr' : 0}).nr
<
=============================================================================
4. Using :make *:make_makeprg*

View File

@ -438,18 +438,31 @@ You will end up with a Python-enabled, Win32 version. Enjoy!
================================
For building with MSVC 2008 the "Windows Installer" from www.python.org
works fine. Python 3.4 is recommended.
works fine. Python 3.6 is recommended.
When building, you need to set the following variables at least:
PYTHON3: Where Python3 is installed. E.g. C:\Python34
PYTHON3: Where Python3 is installed. E.g. C:\Python36
DYNAMIC_PYTHON3: Whether dynamic linking is used. Usually, set to yes.
PYTHON3_VER: Python3 version. E.g. 34 for Python 3.4.X.
PYTHON3_VER: Python3 version. E.g. 36 for Python 3.6.X.
E.g. When using MSVC (as one line):
nmake -f Make_mvc.mak
PYTHON3=C:\Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34
PYTHON3=C:\Python36 DYNAMIC_PYTHON3=yes PYTHON3_VER=36
When using msys2 and link with Python3 bundled with msys2 (as one line):
mingw32-make -f Make_ming.mak PYTHON3=c:/msys64/mingw64
PYTHON3_HOME=c:/msys64/mingw64
PYTHON3INC=-Ic:/msys64/mingw64/include/python3.6m
DYNAMIC_PYTHON3=yes
PYTHON3_VER=36
DYNAMIC_PYTHON3_DLL=libpython3.6m.dll
STATIC_STDCPLUS=yes
(This is for 64-bit builds. For 32-bit builds, replace mingw64 with mingw32.)
8. Building with Racket or MzScheme support
@ -684,21 +697,33 @@ config.h and Ruby's DLL name. Here are the steps for working around them:
There is no need to build whole Ruby, just config.h is needed.
If you use 32-bit MSVC 2015, the config.h is generated in the
.ext\include\i386-mswin32_140 directory.
If you use 64-bit MSVC 2015, the config.h is generated in the
.ext\include\x64-mswin64_140 directory.
3) Install the generated config.h.
For 32-bit version:
xcopy /s .ext\include C:\Ruby24\include\ruby-2.4.0
For 64-bit version:
xcopy /s .ext\include C:\Ruby24-x64\include\ruby-2.4.0
Note that 2.4.0 is Ruby API version of Ruby 2.4.X.
You may need to close the console and reopen it to pick up the new $PATH.
4) Build Vim. Note that you need to adjust some variables (as one line):
For 32-bit version:
nmake -f Make_mvc.mak
RUBY=C:\Ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0
RUBY_MSVCRT_NAME=msvcrt
WINVER=0x501
For 64-bit version, replace RUBY=C:\Ruby24 with RUBY=C:\Ruby24-x64.
If you set WINVER explicitly, it must be set to >=0x500, when building
with Ruby 2.1 or later. (Default is 0x501.)
When using this trick, you also need to set RUBY_MSVCRT_NAME to msvcrt
@ -713,6 +738,7 @@ After you install RubyInstaller, just type this (as one line):
RUBY=C:/Ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0
WINVER=0x501
For 64-bit version, replace RUBY=C:/Ruby24 with RUBY=C:/Ruby24-x64.
If you set WINVER explicitly, it must be set to >=0x500, when building with
Ruby 2.1 or later. (Default is 0x501.)

View File

@ -316,14 +316,14 @@ endif
# Python3 interface:
# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak)
# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 35)
# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 36)
ifdef PYTHON3
ifndef DYNAMIC_PYTHON3
DYNAMIC_PYTHON3=yes
endif
ifndef PYTHON3_VER
PYTHON3_VER=35
PYTHON3_VER=36
endif
ifndef DYNAMIC_PYTHON3_DLL
DYNAMIC_PYTHON3_DLL=python$(PYTHON3_VER).dll

View File

@ -67,7 +67,7 @@
# Python3 interface:
# PYTHON3=[Path to Python3 directory]
# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically)
# PYTHON3_VER=[Python3 version, eg 30, 31] (default is 35)
# PYTHON3_VER=[Python3 version, eg 30, 31] (default is 36)
#
# Ruby interface:
# RUBY=[Path to Ruby directory]
@ -906,7 +906,7 @@ PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
# PYTHON3 interface
!ifdef PYTHON3
!ifndef PYTHON3_VER
PYTHON3_VER = 35
PYTHON3_VER = 36
!endif
!message Python3 requested (version $(PYTHON3_VER)) - root dir is "$(PYTHON3)"
!if "$(DYNAMIC_PYTHON3)" == "yes"

View File

@ -2120,6 +2120,7 @@ test_arglist \
test_assign \
test_autochdir \
test_autocmd \
test_autoload \
test_backspace_opt \
test_breakindent \
test_bufline \

5
src/auto/configure vendored
View File

@ -4781,9 +4781,14 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_is_selinux_enabled" >&5
$as_echo "$ac_cv_lib_selinux_is_selinux_enabled" >&6; }
if test "x$ac_cv_lib_selinux_is_selinux_enabled" = xyes; then :
ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
if test "x$ac_cv_header_selinux_selinux_h" = xyes; then :
LIBS="$LIBS -lselinux"
$as_echo "#define HAVE_SELINUX 1" >>confdefs.h
fi
fi
else

View File

@ -1,5 +1,5 @@
:: command to build big Vim with OLE, Lua, Perl, Python, Racket, Ruby and Tcl
SET VCDIR="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\"
SET TOOLDIR=E:\
%VCDIR%nmake -f Make_mvc.mak GUI=yes OLE=yes LUA=%TOOLDIR%lua53 DYNAMIC_LUA=yes LUA_VER=53 PERL=%TOOLDIR%perl524 DYNAMIC_PERL=yes PERL_VER=524 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python35 DYNAMIC_PYTHON3=yes PYTHON3_VER=35 MZSCHEME=%TOOLDIR%Racket DYNAMIC_MZSCHEME=yes MZSCHEME_VER=3m_a36fs8 RUBY=%TOOLDIR%ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0 RUBY_MSVCRT_NAME=msvcrt TCL=%TOOLDIR%ActiveTcl TCL_VER=86 TCL_VER_LONG=8.6 DYNAMIC_TCL=yes TCL_DLL=tcl86t.dll %1 IME=yes CSCOPE=yes DIRECTX=yes
%VCDIR%nmake -f Make_mvc.mak GUI=yes OLE=yes LUA=%TOOLDIR%lua53 DYNAMIC_LUA=yes LUA_VER=53 PERL=%TOOLDIR%perl524 DYNAMIC_PERL=yes PERL_VER=524 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python36 DYNAMIC_PYTHON3=yes PYTHON3_VER=36 MZSCHEME=%TOOLDIR%Racket DYNAMIC_MZSCHEME=yes MZSCHEME_VER=3m_a36fs8 RUBY=%TOOLDIR%ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0 RUBY_MSVCRT_NAME=msvcrt TCL=%TOOLDIR%ActiveTcl TCL_VER=86 TCL_VER_LONG=8.6 DYNAMIC_TCL=yes TCL_DLL=tcl86t.dll %1 IME=yes CSCOPE=yes DIRECTX=yes

View File

@ -3313,11 +3313,12 @@ channel_read(channel_T *channel, ch_part_T part, char *func)
/*
* Read from RAW or NL "channel"/"part". Blocks until there is something to
* read or the timeout expires.
* When "raw" is TRUE don't block waiting on a NL.
* Returns what was read in allocated memory.
* Returns NULL in case of error or timeout.
*/
char_u *
channel_read_block(channel_T *channel, ch_part_T part, int timeout)
static char_u *
channel_read_block(channel_T *channel, ch_part_T part, int timeout, int raw)
{
char_u *buf;
char_u *msg;
@ -3340,6 +3341,10 @@ channel_read_block(channel_T *channel, ch_part_T part, int timeout)
break;
if (channel_collapse(channel, part, mode == MODE_NL) == OK)
continue;
/* If not blocking or nothing more is coming then return what we
* have. */
if (raw || fd == INVALID_FD)
break;
}
/* Wait for up to the channel timeout. */
@ -3366,11 +3371,16 @@ channel_read_block(channel_T *channel, ch_part_T part, int timeout)
nl = channel_first_nl(node);
/* Convert NUL to NL, the internal representation. */
for (p = buf; p < nl && p < buf + node->rq_buflen; ++p)
for (p = buf; (nl == NULL || p < nl) && p < buf + node->rq_buflen; ++p)
if (*p == NUL)
*p = NL;
if (nl + 1 == buf + node->rq_buflen)
if (nl == NULL)
{
/* must be a closed channel with missing NL */
msg = channel_get(channel, part);
}
else if (nl + 1 == buf + node->rq_buflen)
{
/* get the whole buffer */
msg = channel_get(channel, part);
@ -3513,7 +3523,8 @@ common_channel_read(typval_T *argvars, typval_T *rettv, int raw)
timeout = opt.jo_timeout;
if (raw || mode == MODE_RAW || mode == MODE_NL)
rettv->vval.v_string = channel_read_block(channel, part, timeout);
rettv->vval.v_string = channel_read_block(channel, part,
timeout, raw);
else
{
if (opt.jo_set & JO_ID)
@ -3955,7 +3966,8 @@ ch_raw_common(typval_T *argvars, typval_T *rettv, int eval)
timeout = opt.jo_timeout;
else
timeout = channel_get_timeout(channel, part_read);
rettv->vval.v_string = channel_read_block(channel, part_read, timeout);
rettv->vval.v_string = channel_read_block(channel, part_read,
timeout, TRUE);
}
free_job_options(&opt);
}

View File

@ -433,8 +433,9 @@ if test "x$found_smack" = "x"; then
if test "$enable_selinux" = "yes"; then
AC_MSG_RESULT(no)
AC_CHECK_LIB(selinux, is_selinux_enabled,
[AC_CHECK_HEADER(selinux/selinux.h,
[LIBS="$LIBS -lselinux"
AC_DEFINE(HAVE_SELINUX)])
AC_DEFINE(HAVE_SELINUX)])])
else
AC_MSG_RESULT(yes)
fi

View File

@ -1956,7 +1956,10 @@ get_lval(
cc = *p;
*p = NUL;
v = find_var(lp->ll_name, &ht, flags & GLV_NO_AUTOLOAD);
/* Only pass &ht when we would write to the variable, it prevents autoload
* as well. */
v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht,
flags & GLV_NO_AUTOLOAD);
if (v == NULL && !quiet)
EMSG2(_(e_undefvar), lp->ll_name);
*p = cc;
@ -6610,6 +6613,8 @@ get_vim_var_nr(int idx)
/*
* Get string v: variable value. Uses a static buffer, can only be used once.
* If the String variable has never been set, return an empty string.
* Never returns NULL;
*/
char_u *
get_vim_var_str(int idx)

View File

@ -1482,7 +1482,7 @@ do_shell(
#endif
&& msg_silent == 0)
FOR_ALL_BUFFERS(buf)
if (bufIsChanged(buf))
if (bufIsChangedNotTerm(buf))
{
#ifdef FEAT_GUI_MSWIN
if (!winstart)
@ -6934,13 +6934,10 @@ fix_help_buffer(void)
&& fcount > 0)
{
#ifdef FEAT_MULTI_LANG
int i1;
int i2;
char_u *f1;
char_u *f2;
char_u *t1;
char_u *e1;
char_u *e2;
int i1, i2;
char_u *f1, *f2;
char_u *t1, *t2;
char_u *e1, *e2;
/* If foo.abx is found use it instead of foo.txt in
* the same directory. */
@ -6955,10 +6952,9 @@ fix_help_buffer(void)
f1 = fnames[i1];
f2 = fnames[i2];
t1 = gettail(f1);
if (fnamencmp(f1, f2, t1 - f1) != 0)
continue;
t2 = gettail(f2);
e1 = vim_strrchr(t1, '.');
e2 = vim_strrchr(gettail(f2), '.');
e2 = vim_strrchr(t2, '.');
if (e1 == NULL || e2 == NULL)
continue;
if (fnamecmp(e1, ".txt") != 0
@ -6969,7 +6965,8 @@ fix_help_buffer(void)
fnames[i1] = NULL;
continue;
}
if (fnamencmp(f1, f2, e1 - f1) != 0)
if (e1 - f1 != e2 - f2
|| fnamencmp(f1, f2, e1 - f1) != 0)
continue;
if (fnamecmp(e1, ".txt") == 0
&& fnamecmp(e2, fname + 4) == 0)

View File

@ -5433,7 +5433,7 @@ op_addsub(
}
else /* oap->motion_type == MCHAR */
{
if (!oap->inclusive)
if (pos.lnum == oap->start.lnum && !oap->inclusive)
dec(&(oap->end));
length = (colnr_T)STRLEN(ml_get(pos.lnum));
pos.col = 0;

View File

@ -31,7 +31,6 @@ void channel_close(channel_T *channel, int invoke_close_cb);
void channel_close_in(channel_T *channel);
void channel_clear(channel_T *channel);
void channel_free_all(void);
char_u *channel_read_block(channel_T *channel, ch_part_T part, int timeout);
void common_channel_read(typval_T *argvars, typval_T *rettv, int raw);
channel_T *channel_fd2channel(sock_T fd, ch_part_T *partp);
void channel_handle_events(int only_keep_open);

View File

@ -25,6 +25,7 @@ void u_clearline(void);
void u_undoline(void);
void u_blockfree(buf_T *buf);
int bufIsChanged(buf_T *buf);
int bufIsChangedNotTerm(buf_T *buf);
int curbufIsChanged(void);
void u_eval_tree(u_header_T *first_uhp, list_T *list);
/* vim: set ft=c : */

View File

@ -4949,9 +4949,12 @@ qf_get_properties(win_T *wp, dict_T *what, dict_T *retdict)
if ((status == OK) && (flags & QF_GETLIST_WINID))
{
win_T *win;
int win_id = 0;
win = qf_find_win(qi);
if (win != NULL)
status = dict_add_nr_str(retdict, "winid", win->w_id, NULL);
win_id = win->w_id;
status = dict_add_nr_str(retdict, "winid", win_id, NULL);
}
if ((status == OK) && (flags & QF_GETLIST_ITEMS))
{

View File

@ -1154,7 +1154,7 @@ win_update(win_T *wp)
}
/* Window is zero-height: nothing to draw. */
if (wp->w_height == 0)
if (wp->w_height + WINBAR_HEIGHT(wp) == 0)
{
wp->w_redr_type = 0;
return;

View File

@ -3510,6 +3510,9 @@ may_req_ambiguous_char_width(void)
out_str((char_u *)" ");
term_windgoto(0, 0);
/* Need to reset the known cursor position. */
screen_start();
/* check for the characters now, otherwise they might be eaten by
* get_keystroke() */
out_flush();
@ -4585,7 +4588,7 @@ check_termcode(
is_mac_terminal = TRUE;
}
# ifdef FEAT_MOUSE_SGR
/* Iterm2 sends 0;95;0 */
/* iTerm2 sends 0;95;0 */
if (STRNCMP(tp + extra - 2, "0;95;0c", 7) == 0)
is_iterm2 = TRUE;
# endif
@ -4597,7 +4600,7 @@ check_termcode(
{
# ifdef FEAT_MOUSE_SGR
/* Xterm version 277 supports SGR. Also support
* Terminal.app and iterm2. */
* Terminal.app and iTerm2. */
if (version >= 277 || is_iterm2 || is_mac_terminal)
set_option_value((char_u *)"ttym", 0L,
(char_u *)"sgr", 0);

View File

@ -675,7 +675,10 @@ update_cursor(term_T *term, int redraw)
out_flush();
#ifdef FEAT_GUI
if (gui.in_use)
{
gui_update_cursor(FALSE, FALSE);
gui_mch_flush();
}
#endif
}
}

View File

@ -73,6 +73,7 @@ NEW_TESTS = test_arabic.res \
test_assert.res \
test_autochdir.res \
test_autocmd.res \
test_autoload.res \
test_backspace_opt.res \
test_breakindent.res \
test_bufwintabinfo.res \

View File

@ -0,0 +1,7 @@
let g:loaded_foo_vim += 1
let foo#bar = {}
func foo#bar.echo()
let g:called_foo_bar_echo += 1
endfunc

View File

@ -0,0 +1 @@
" used by Test_globpath()

View File

@ -0,0 +1 @@
" used by Test_globpath()

View File

@ -0,0 +1,3 @@
let g:loaded_sourced_vim += 1
func! sourced#something()
endfunc

View File

@ -0,0 +1,17 @@
" Tests for autoload
set runtimepath=./sautest
func Test_autoload_dict_func()
let g:loaded_foo_vim = 0
let g:called_foo_bar_echo = 0
call g:foo#bar.echo()
call assert_equal(1, g:loaded_foo_vim)
call assert_equal(1, g:called_foo_bar_echo)
endfunc
func Test_source_autoload()
let g:loaded_sourced_vim = 0
source sautest/autoload/sourced.vim
call assert_equal(1, g:loaded_sourced_vim)
endfunc

View File

@ -515,7 +515,7 @@ func Test_nl_pipe()
call assert_equal("AND this", ch_readraw(handle))
call ch_sendraw(handle, "split this line\n")
call assert_equal("this linethis linethis line", ch_readraw(handle))
call assert_equal("this linethis linethis line", ch_read(handle))
let reply = ch_evalraw(handle, "quit\n")
call assert_equal("Goodbye!", reply)
@ -1266,6 +1266,31 @@ func Test_read_in_close_cb()
endtry
endfunc
" Use channel in NL mode but received text does not end in NL.
func Test_read_in_close_cb_incomplete()
if !has('job')
return
endif
call ch_log('Test_read_in_close_cb_incomplete()')
let g:Ch_received = ''
func! CloseHandler(chan)
while ch_status(a:chan, {'part': 'out'}) == 'buffered'
let g:Ch_received .= ch_read(a:chan)
endwhile
endfunc
let job = job_start(s:python . " test_channel_pipe.py incomplete",
\ {'close_cb': 'CloseHandler'})
call assert_equal("run", job_status(job))
try
call WaitFor('g:Ch_received != ""')
call assert_equal('incomplete', g:Ch_received)
finally
call job_stop(job)
delfunc CloseHandler
endtry
endfunc
func Test_out_cb_lambda()
if !has('job')
return

View File

@ -14,6 +14,10 @@ if __name__ == "__main__":
if sys.argv[1].startswith("err"):
print(sys.argv[1], file=sys.stderr)
sys.stderr.flush()
elif sys.argv[1].startswith("incomplete"):
print(sys.argv[1], end='')
sys.stdout.flush()
sys.exit(0)
else:
print(sys.argv[1])
sys.stdout.flush()

View File

@ -25,8 +25,8 @@ function Test_glob()
endfunction
function Test_globpath()
call assert_equal("sautest/autoload/Test104.vim\nsautest/autoload/footest.vim",
\ globpath('sautest/autoload', '*.vim'))
call assert_equal(['sautest/autoload/Test104.vim', 'sautest/autoload/footest.vim'],
\ globpath('sautest/autoload', '*.vim', 0, 1))
call assert_equal("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim",
\ globpath('sautest/autoload', 'glob*.vim'))
call assert_equal(['sautest/autoload/globone.vim', 'sautest/autoload/globtwo.vim'],
\ globpath('sautest/autoload', 'glob*.vim', 0, 1))
endfunction

View File

@ -30,3 +30,22 @@ func Test_help_keyword()
close
bwipe!
endfunc
func Test_help_local_additions()
call mkdir('Xruntime/doc', 'p')
call writefile(['*mydoc.txt* my awesome doc'], 'Xruntime/doc/mydoc.txt')
call writefile(['*mydoc-ext.txt* my extended awesome doc'], 'Xruntime/doc/mydoc-ext.txt')
let rtp_save = &rtp
set rtp+=./Xruntime
help
1
call search('mydoc.txt')
call assert_equal('|mydoc.txt| my awesome doc', getline('.'))
1
call search('mydoc-ext.txt')
call assert_equal('|mydoc-ext.txt| my extended awesome doc', getline('.'))
close
call delete('Xruntime', 'rf')
let &rtp = rtp_save
endfunc

View File

@ -364,11 +364,25 @@ endfunc
" Expected:
" 1) Ctrl-a on visually selected zero
" 111
"
" Also: 019 with "01" selected increments to "029".
func Test_visual_increment_15()
call setline(1, ["101"])
exec "norm! lv\<C-A>"
call assert_equal(["111"], getline(1, '$'))
call assert_equal([0, 1, 2, 0], getpos('.'))
call setline(1, ["019"])
exec "norm! 0vl\<C-A>"
call assert_equal("029", getline(1))
call setline(1, ["01239"])
exec "norm! 0vlll\<C-A>"
call assert_equal("01249", getline(1))
call setline(1, ["01299"])
exec "norm! 0vlll\<C-A>"
call assert_equal("1309", getline(1))
endfunc
" 16) increment right aligned numbers
@ -756,5 +770,12 @@ func Test_normal_increment_03()
call assert_equal([0, 3, 25, 0], getpos('.'))
endfunc
func Test_increment_empty_line()
new
call setline(1, ['0', '0', '0', '0', '0', '0', ''])
exe "normal Gvgg\<C-A>"
call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7))
bwipe!
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@ -28,7 +28,7 @@ func s:setup_commands(cchar)
command! -count -nargs=* -bang Xprev <mods><count>cprev<bang> <args>
command! -nargs=* -bang Xfirst <mods>cfirst<bang> <args>
command! -nargs=* -bang Xlast <mods>clast<bang> <args>
command! -nargs=* -bang Xnfile <mods>cnfile<bang> <args>
command! -nargs=* -bang -range Xnfile <mods><count>cnfile<bang> <args>
command! -nargs=* -bang Xpfile <mods>cpfile<bang> <args>
command! -nargs=* Xexpr <mods>cexpr <args>
command! -range -nargs=* Xvimgrep <mods><count>vimgrep <args>
@ -36,6 +36,7 @@ func s:setup_commands(cchar)
command! -nargs=* Xgrep <mods> grep <args>
command! -nargs=* Xgrepadd <mods> grepadd <args>
command! -nargs=* Xhelpgrep helpgrep <args>
command! -nargs=0 -count Xcc <count>cc
let g:Xgetlist = function('getqflist')
let g:Xsetlist = function('setqflist')
call setqflist([], 'f')
@ -60,7 +61,7 @@ func s:setup_commands(cchar)
command! -count -nargs=* -bang Xprev <mods><count>lprev<bang> <args>
command! -nargs=* -bang Xfirst <mods>lfirst<bang> <args>
command! -nargs=* -bang Xlast <mods>llast<bang> <args>
command! -nargs=* -bang Xnfile <mods>lnfile<bang> <args>
command! -nargs=* -bang -range Xnfile <mods><count>lnfile<bang> <args>
command! -nargs=* -bang Xpfile <mods>lpfile<bang> <args>
command! -nargs=* Xexpr <mods>lexpr <args>
command! -range -nargs=* Xvimgrep <mods><count>lvimgrep <args>
@ -68,6 +69,7 @@ func s:setup_commands(cchar)
command! -nargs=* Xgrep <mods> lgrep <args>
command! -nargs=* Xgrepadd <mods> lgrepadd <args>
command! -nargs=* Xhelpgrep lhelpgrep <args>
command! -nargs=0 -count Xcc <count>ll
let g:Xgetlist = function('getloclist', [0])
let g:Xsetlist = function('setloclist', [0])
call setloclist(0, [], 'f')
@ -382,12 +384,18 @@ endfunc
func Xtest_browse(cchar)
call s:setup_commands(a:cchar)
call g:Xsetlist([], 'f')
" Jumping to first or next location list entry without any error should
" result in failure
if a:cchar == 'l'
call assert_fails('lfirst', 'E776:')
call assert_fails('lnext', 'E776:')
if a:cchar == 'c'
let err = 'E42:'
else
let err = 'E776:'
endif
call assert_fails('Xnext', err)
call assert_fails('Xprev', err)
call assert_fails('Xnfile', err)
call assert_fails('Xpfile', err)
call s:create_test_file('Xqftestfile1')
call s:create_test_file('Xqftestfile2')
@ -408,6 +416,12 @@ func Xtest_browse(cchar)
Xpfile
call assert_equal('Xqftestfile1', bufname('%'))
call assert_equal(6, line('.'))
5Xcc
call assert_equal(5, g:Xgetlist({'idx':0}).idx)
2Xcc
call assert_equal(2, g:Xgetlist({'idx':0}).idx)
10Xcc
call assert_equal(6, g:Xgetlist({'idx':0}).idx)
Xlast
Xprev
call assert_equal('Xqftestfile2', bufname('%'))
@ -425,6 +439,23 @@ func Xtest_browse(cchar)
call assert_equal('Xqftestfile1', bufname('%'))
call assert_equal(5, line('.'))
" Jumping to an error from the error window using cc command
Xgetexpr ['Xqftestfile1:5:Line5',
\ 'Xqftestfile1:6:Line6',
\ 'Xqftestfile2:10:Line10',
\ 'Xqftestfile2:11:Line11']
Xopen
10Xcc
call assert_equal(11, line('.'))
call assert_equal('Xqftestfile2', bufname('%'))
" Jumping to an error from the error window (when only the error window is
" present)
Xopen | only
Xlast 1
call assert_equal(5, line('.'))
call assert_equal('Xqftestfile1', bufname('%'))
Xexpr ""
call assert_fails('Xnext', 'E42:')
@ -1497,13 +1528,18 @@ func Test_switchbuf()
set switchbuf=usetab
tabedit Xqftestfile1
tabedit Xqftestfile2
tabedit Xqftestfile3
tabfirst
cfirst | cnext
call assert_equal(2, tabpagenr())
2cnext
call assert_equal(3, tabpagenr())
2cnext
call assert_equal(3, tabpagenr())
6cnext
call assert_equal(4, tabpagenr())
2cpfile
call assert_equal(2, tabpagenr())
2cnfile
call assert_equal(4, tabpagenr())
tabfirst | tabonly | enew
set switchbuf=split
@ -2320,7 +2356,7 @@ func XfreeTests(cchar)
Xclose
endfunc
" Tests for the quickifx free functionality
" Tests for the quickfix free functionality
func Test_qf_free()
call XfreeTests('c')
call XfreeTests('l')
@ -2747,3 +2783,100 @@ func Test_qf_id()
call Xqfid_tests('c')
call Xqfid_tests('l')
endfunc
func Xqfjump_tests(cchar)
call s:setup_commands(a:cchar)
call writefile(["Line1\tFoo", "Line2"], 'F1')
call writefile(["Line1\tBar", "Line2"], 'F2')
call writefile(["Line1\tBaz", "Line2"], 'F3')
call g:Xsetlist([], 'f')
" Tests for
" Jumping to a line using a pattern
" Jumping to a column greater than the last column in a line
" Jumping to a line greater than the last line in the file
let l = []
for i in range(1, 7)
call add(l, {})
endfor
let l[0].filename='F1'
let l[0].pattern='Line1'
let l[1].filename='F2'
let l[1].pattern='Line1'
let l[2].filename='F3'
let l[2].pattern='Line1'
let l[3].filename='F3'
let l[3].lnum=1
let l[3].col=9
let l[3].vcol=1
let l[4].filename='F3'
let l[4].lnum=99
let l[5].filename='F3'
let l[5].lnum=1
let l[5].col=99
let l[5].vcol=1
let l[6].filename='F3'
let l[6].pattern='abcxyz'
call g:Xsetlist([], ' ', {'items' : l})
Xopen | only
2Xnext
call assert_equal(3, g:Xgetlist({'idx' : 0}).idx)
call assert_equal('F3', bufname('%'))
Xnext
call assert_equal(7, col('.'))
Xnext
call assert_equal(2, line('.'))
Xnext
call assert_equal(9, col('.'))
2
Xnext
call assert_equal(2, line('.'))
if a:cchar == 'l'
" When jumping to a location list entry in the location list window and
" no usable windows are available, then a new window should be opened.
enew! | new | only
call g:Xsetlist([], 'f')
setlocal buftype=nofile
new
call g:Xsetlist([], ' ', {'lines' : ['F1:1:1:Line1', 'F1:2:2:Line2', 'F2:1:1:Line1', 'F2:2:2:Line2', 'F3:1:1:Line1', 'F3:2:2:Line2']})
Xopen
let winid = win_getid()
wincmd p
close
call win_gotoid(winid)
Xnext
call assert_equal(3, winnr('$'))
call assert_equal(1, winnr())
call assert_equal(2, line('.'))
" When jumping to an entry in the location list window and the window
" associated with the location list is not present and a window containing
" the file is already present, then that window should be used.
close
belowright new
call g:Xsetlist([], 'f')
edit F3
call win_gotoid(winid)
Xlast
call assert_equal(3, winnr())
call assert_equal(6, g:Xgetlist({'size' : 1}).size)
call assert_equal(winid, g:Xgetlist({'winid' : 1}).winid)
endif
" Cleanup
enew!
new | only
call delete('F1')
call delete('F2')
call delete('F3')
endfunc
func Test_qfjump()
call Xqfjump_tests('c')
call Xqfjump_tests('l')
endfunc

View File

@ -3523,6 +3523,8 @@ u_save_line(linenr_T lnum)
* Check if the 'modified' flag is set, or 'ff' has changed (only need to
* check the first character, because it can only be "dos", "unix" or "mac").
* "nofile" and "scratch" type buffers are considered to always be unchanged.
* Also considers a buffer changed when a terminal window contains a running
* job.
*/
int
bufIsChanged(buf_T *buf)
@ -3531,6 +3533,15 @@ bufIsChanged(buf_T *buf)
if (term_job_running(buf->b_term))
return TRUE;
#endif
return bufIsChangedNotTerm(buf);
}
/*
* Like bufIsChanged() but ignoring a terminal window.
*/
int
bufIsChangedNotTerm(buf_T *buf)
{
return !bt_dontwrite(buf)
&& (buf->b_changed || file_ff_differs(buf, TRUE));
}

View File

@ -1594,7 +1594,7 @@ trans_function_name(
start += lead;
/* Note that TFN_ flags use the same values as GLV_ flags. */
end = get_lval(start, NULL, &lv, FALSE, skip, flags,
end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY,
lead > 2 ? 0 : FNE_CHECK_START);
if (end == start)
{
@ -1886,7 +1886,7 @@ ex_function(exarg_T *eap)
* g:func global function name, same as "func"
*/
p = eap->arg;
name = trans_function_name(&p, eap->skip, 0, &fudi, NULL);
name = trans_function_name(&p, eap->skip, TFN_NO_AUTOLOAD, &fudi, NULL);
paren = (vim_strchr(p, '(') != NULL);
if (name == NULL && (fudi.fd_dict == NULL || !paren) && !eap->skip)
{

View File

@ -771,6 +771,30 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1385,
/**/
1384,
/**/
1383,
/**/
1382,
/**/
1381,
/**/
1380,
/**/
1379,
/**/
1378,
/**/
1377,
/**/
1376,
/**/
1375,
/**/
1374,
/**/
1373,
/**/

View File

@ -1478,8 +1478,10 @@ typedef UINT32_TYPEDEF UINT32_T;
#define STATUS_HEIGHT 1 /* height of a status line under a window */
#ifdef FEAT_MENU /* height of a status line under a window */
# define WINBAR_HEIGHT(wp) (wp)->w_winbar_height
# define VISIBLE_HEIGHT(wp) ((wp)->w_height + (wp)->w_winbar_height)
#else
# define WINBAR_HEIGHT(wp) 0
# define VISIBLE_HEIGHT(wp) (wp)->w_height
#endif
#define QF_WINHEIGHT 10 /* default height for quickfix window */

View File

@ -782,7 +782,7 @@ win_split_ins(
/* add a status line when p_ls == 1 and splitting the first window */
if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0)
{
if (oldwin->w_height <= p_wmh && new_wp == NULL)
if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL)
{
EMSG(_(e_noroom));
return FAIL;
@ -892,7 +892,7 @@ win_split_ins(
* height.
*/
/* Current window requires at least 1 space. */
wmh1 = (p_wmh == 0 ? 1 : p_wmh);
wmh1 = (p_wmh == 0 ? 1 : p_wmh) + WINBAR_HEIGHT(curwin);
needed = wmh1 + STATUS_HEIGHT;
if (flags & WSP_ROOM)
needed += p_wh - wmh1;
@ -1105,7 +1105,7 @@ win_split_ins(
{
/* height and row of new window is same as current window */
wp->w_winrow = oldwin->w_winrow;
win_new_height(wp, oldwin->w_height + WINBAR_HEIGHT(oldwin));
win_new_height(wp, VISIBLE_HEIGHT(oldwin));
wp->w_status_height = oldwin->w_status_height;
}
frp->fr_height = curfrp->fr_height;
@ -1180,8 +1180,8 @@ win_split_ins(
}
else /* new window below current one */
{
wp->w_winrow = oldwin->w_winrow + oldwin->w_height
+ STATUS_HEIGHT + WINBAR_HEIGHT(oldwin);
wp->w_winrow = oldwin->w_winrow + VISIBLE_HEIGHT(oldwin)
+ STATUS_HEIGHT;
wp->w_status_height = oldwin->w_status_height;
if (!(flags & WSP_BOT))
oldwin->w_status_height = STATUS_HEIGHT;
@ -1422,7 +1422,7 @@ make_windows(
else
{
/* Each window needs at least 'winminheight' lines and a status line. */
maxcount = (curwin->w_height + curwin->w_status_height
maxcount = (VISIBLE_HEIGHT(curwin) + curwin->w_status_height
- (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT);
}
@ -3204,8 +3204,7 @@ frame_fix_width(win_T *wp)
static void
frame_fix_height(win_T *wp)
{
wp->w_frame->fr_height = wp->w_height + wp->w_status_height
+ WINBAR_HEIGHT(wp) ;
wp->w_frame->fr_height = VISIBLE_HEIGHT(wp) + wp->w_status_height;
}
/*
@ -3230,9 +3229,14 @@ frame_minheight(frame_T *topfrp, win_T *next_curwin)
{
/* window: minimal height of the window plus status line */
m = p_wmh + topfrp->fr_win->w_status_height;
/* Current window is minimal one line high */
if (p_wmh == 0 && topfrp->fr_win == curwin && next_curwin == NULL)
if (topfrp->fr_win == curwin && next_curwin == NULL)
{
/* Current window is minimal one line high and WinBar is
* visible. */
if (p_wmh == 0)
++m;
m += WINBAR_HEIGHT(curwin);
}
}
}
else if (topfrp->fr_layout == FR_ROW)
@ -4972,6 +4976,7 @@ frame_comp_pos(frame_T *topfrp, int *row, int *col)
frame_T *frp;
int startcol;
int startrow;
int h;
wp = topfrp->fr_win;
if (wp != NULL)
@ -4984,7 +4989,9 @@ frame_comp_pos(frame_T *topfrp, int *row, int *col)
redraw_win_later(wp, NOT_VALID);
wp->w_redr_status = TRUE;
}
*row += wp->w_height + wp->w_status_height;
/* WinBar will not show if the window height is zero */
h = VISIBLE_HEIGHT(wp) + wp->w_status_height;
*row += h > topfrp->fr_height ? topfrp->fr_height : h;
*col += wp->w_width + wp->w_vsep_width;
}
else
@ -5029,6 +5036,7 @@ win_setheight_win(int height, win_T *win)
height = p_wmh;
if (height == 0)
height = 1;
height += WINBAR_HEIGHT(curwin);
}
frame_setheight(win->w_frame, height + win->w_status_height);
@ -5126,7 +5134,8 @@ frame_setheight(frame_T *curfrp, int height)
else
{
room_cmdline = Rows - p_ch - (lastwin->w_winrow
+ lastwin->w_height + lastwin->w_status_height);
+ VISIBLE_HEIGHT(lastwin)
+ lastwin->w_status_height);
if (room_cmdline < 0)
room_cmdline = 0;
}
@ -5415,7 +5424,7 @@ win_setminheight(void)
/* TODO: handle vertical splits */
room = -p_wh;
FOR_ALL_WINDOWS(wp)
room += wp->w_height - p_wmh;
room += VISIBLE_HEIGHT(wp) - p_wmh;
if (room >= 0)
break;
--p_wmh;