Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2016-05-24 20:42:17 -07:00
29 changed files with 601 additions and 214 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
*channel.txt* For Vim version 7.4. Last change: 2016 May 19
*channel.txt* For Vim version 7.4. Last change: 2016 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -61,7 +61,7 @@ Common combination are:
crosss-refrences in a database.
==============================================================================
2. Channel demo *channel-demo*
2. Channel demo *channel-demo* *demoserver.py*
This requires Python. The demo program can be found in
$VIMRUNTIME/tools/demoserver.py
+98 -18
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2016 May 20
*eval.txt* For Vim version 7.4. Last change: 2016 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -59,6 +59,9 @@ Dictionary An associative, unordered array: Each entry has a key and a
Funcref A reference to a function |Funcref|.
Example: function("strlen")
It can be bound to a dictionary and arguments, it then works
like a Partial.
Example: function("Callback", [arg], myDict)
Special |v:false|, |v:true|, |v:none| and |v:null|. *Special*
@@ -150,6 +153,43 @@ The name of the referenced function can be obtained with |string()|. >
You can use |call()| to invoke a Funcref and use a list variable for the
arguments: >
:let r = call(Fn, mylist)
<
*Partial*
A Funcref optionally binds a Dictionary and/or arguments. This is also called
a Partial. This is created by passing the Dictionary and/or arguments to
function(). When calling the function the Dictionary and/or arguments will be
passed to the function. Example: >
let Cb = function('Callback', ['foo'], myDict)
call Cb()
This will invoke the function as if using: >
call myDict.Callback('foo')
This is very useful when passing a function around, e.g. in the arguments of
|ch_open()|.
Note that binding a function to a Dictionary also happens when the function is
a member of the Dictionary: >
let myDict.myFunction = MyFunction
call myDict.myFunction()
Here MyFunction() will get myDict passed as "self". This happens when the
"myFunction" member is accessed. When making assigning "myFunction" to
otherDict and calling it, it will be bound to otherDict: >
let otherDict.myFunction = myDict.myFunction
call otherDict.myFunction()
Now "self" will be "otherDict". But when the dictionary was bound explicitly
this won't happen: >
let myDict.myFunction = function(MyFunction, myDict)
let otherDict.myFunction = myDict.myFunction
call otherDict.myFunction()
Here "self" will be "myDict", because it was bound explitly.
1.3 Lists ~
@@ -1915,9 +1955,9 @@ foreground() Number bring the Vim window to the foreground
function({name} [, {arglist}] [, {dict}])
Funcref reference to function {name}
garbagecollect([{atexit}]) none free memory, breaking cyclic references
garbagecollect_for_testing() none free memory right now
get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def}
get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def}
get({func}, {what}) any get property of funcref/partial {func}
getbufline({expr}, {lnum} [, {end}])
List lines {lnum} to {end} of buffer {expr}
getbufvar({expr}, {varname} [, {def}])
@@ -2163,6 +2203,13 @@ tagfiles() List tags files used
tan({expr}) Float tangent of {expr}
tanh({expr}) Float hyperbolic tangent of {expr}
tempname() String name for a temporary file
test_garbagecollect_now() none free memory right now for testing
test_null_channel() Channel null value for testing
test_null_dict() Dict null value for testing
test_null_job() Job null value for testing
test_null_list() List null value for testing
test_null_partial() Funcref null value for testing
test_null_string() String null value for testing
timer_start({time}, {callback} [, {options}])
Number create a timer
timer_stop({timer}) none stop a timer
@@ -3712,11 +3759,10 @@ garbagecollect([{atexit}]) *garbagecollect()*
collection will also be done when exiting Vim, if it wasn't
done before. This is useful when checking for memory leaks.
garbagecollect_for_testing() *garbagecollect_for_testing()*
Like garbagecollect(), but executed right away. This must
only be called directly to avoid any structure to exist
internally, and |v:testing| must have been set before calling
any function.
The garbage collection is not done immediately but only when
it's safe to perform. This is when waiting for the user to
type a character. To force garbage collection immediately use
|test_garbagecollect_now()|.
get({list}, {idx} [, {default}]) *get()*
Get item {idx} from |List| {list}. When this item is not
@@ -3726,6 +3772,13 @@ get({dict}, {key} [, {default}])
Get item with key {key} from |Dictionary| {dict}. When this
item is not available return {default}. Return zero when
{default} is omitted.
get({func}, {what})
Get an item with from Funcref {func}. Possible values for
{what} are:
'name' The function name
'func' The function
'dict' The dictionary
'args' The list with arguments
*getbufline()*
getbufline({expr}, {lnum} [, {end}])
@@ -7125,17 +7178,6 @@ taglist({expr}) *taglist()*
located by Vim. Refer to |tags-file-format| for the format of
the tags file generated by the different ctags tools.
tempname() *tempname()* *temp-file-name*
The result is a String, which is the name of a file that
doesn't exist. It can be used for a temporary file. The name
is different for at least 26 consecutive calls. Example: >
:let tmpfile = tempname()
:exe "redir > " . tmpfile
< For Unix, the file will be in a private directory |tempfile|.
For MS-Windows forward slashes are used when the 'shellslash'
option is set or when 'shellcmdflag' starts with '-'.
tan({expr}) *tan()*
Return the tangent of {expr}, measured in radians, as a |Float|
in the range [-inf, inf].
@@ -7160,6 +7202,44 @@ tanh({expr}) *tanh()*
{only available when compiled with the |+float| feature}
tempname() *tempname()* *temp-file-name*
The result is a String, which is the name of a file that
doesn't exist. It can be used for a temporary file. The name
is different for at least 26 consecutive calls. Example: >
:let tmpfile = tempname()
:exe "redir > " . tmpfile
< For Unix, the file will be in a private directory |tempfile|.
For MS-Windows forward slashes are used when the 'shellslash'
option is set or when 'shellcmdflag' starts with '-'.
test_garbagecollect_now() *test_garbagecollect_now()*
Like garbagecollect(), but executed right away. This must
only be called directly to avoid any structure to exist
internally, and |v:testing| must have been set before calling
any function.
test_null_channel() *test_null_channel()*
Return a Channel that is null. Only useful for testing.
{only available when compiled with the +channel feature}
test_null_dict() *test_null_dict()*
Return a Dict that is null. Only useful for testing.
test_null_job() *test_null_job()*
Return a Job that is null. Only useful for testing.
{only available when compiled with the +job feature}
test_null_list() *test_null_list()*
Return a List that is null. Only useful for testing.
test_null_partial() *test_null_partial()*
Return a Partial that is null. Only useful for testing.
test_null_string() *test_null_string()*
Return a String that is null. Only useful for testing.
*timer_start()*
timer_start({time}, {callback} [, {options}])
Create a timer and return the timer ID.
+5 -1
View File
@@ -1,4 +1,4 @@
*filetype.txt* For Vim version 7.4. Last change: 2016 Apr 30
*filetype.txt* For Vim version 7.4. Last change: 2016 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -585,6 +585,10 @@ If you do not like the default folding, use an autocommand to add your desired
folding style instead. For example: >
autocmd FileType man setlocal foldmethod=indent foldenable
You may also want to set 'keywordprg' to make the |K| command open a manual
page in a Vim window: >
set keywordprg=:Man
MANPAGER *manpager.vim*
+10 -5
View File
@@ -1,4 +1,4 @@
*options.txt* For Vim version 7.4. Last change: 2016 May 10
*options.txt* For Vim version 7.4. Last change: 2016 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4697,16 +4697,18 @@ A jump table for the options with a short description can be found at |Q_op|.
*'keywordprg'* *'kp'*
'keywordprg' 'kp' string (default "man" or "man -s", DOS: ":help",
OS/2: "view /", VMS: "help")
VMS: "help")
global or local to buffer |global-local|
{not in Vi}
Program to use for the |K| command. Environment variables are
expanded |:set_env|. ":help" may be used to access the Vim internal
help. (Note that previously setting the global option to the empty
value did this, which is now deprecated.)
When "man" is used, Vim will automatically translate a count for the
"K" command to a section number. Also for "man -s", in which case the
"-s" is removed when there is no count.
When the first character is ":", the command is invoked as a Vim
Ex command prefixed with [count].
When "man", "man -s" or an Ex command is used, Vim will automatically
translate a count for the "K" command and pass it as the first
argument. For "man -s" the "-s" is removed when there is no count.
See |option-backslash| about including spaces and backslashes.
Example: >
:set keywordprg=man\ -s
@@ -6199,6 +6201,7 @@ A jump table for the options with a short description can be found at |Q_op|.
keymap/ key mapping files |mbyte-keymap|
lang/ menu translations |:menutrans|
menu.vim GUI menus |menu.vim|
pack/ packages |:packadd|
plugin/ plugin scripts |write-plugin|
print/ files for printing |postscript-print-encoding|
spell/ spell checking files |spell|
@@ -6220,6 +6223,8 @@ A jump table for the options with a short description can be found at |Q_op|.
personal preferences to overrule or add to the distributed defaults
or system-wide settings (rarely needed).
More entries are added when using |packages|.
Note that, unlike 'path', no wildcards like "**" are allowed. Normal
wildcards are allowed, but can significantly slow down searching for
runtime files. For speed, use as few items as possible and avoid
+6 -1
View File
@@ -1,4 +1,4 @@
*repeat.txt* For Vim version 7.4. Last change: 2016 Apr 05
*repeat.txt* For Vim version 7.4. Last change: 2016 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -232,6 +232,8 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
pack/*/opt/{name} ~
The directory is added to 'runtimepath' if it wasn't
there yet.
If the directory pack/*/opt/{name}/after exists it is
added at the end of 'runtimepath'.
Note that {name} is the directory name, not the name
of the .vim file. All the files matching the pattern
@@ -507,6 +509,9 @@ To load packages earlier, so that 'runtimepath' gets updated: >
This also works when loading plugins is disabled. The automatic loading will
only happen once.
If the package has an "after" directory, that directory is added to the end of
'runtimepath', so that anything there will be loaded later.
Using a single plugin and loading it automatically ~
+9 -1
View File
@@ -4638,6 +4638,7 @@ PHP_outdentSLComments indent.txt /*PHP_outdentSLComments*
PHP_outdentphpescape indent.txt /*PHP_outdentphpescape*
PHP_removeCRwhenUnix indent.txt /*PHP_removeCRwhenUnix*
PHP_vintage_case_default_indent indent.txt /*PHP_vintage_case_default_indent*
Partial eval.txt /*Partial*
Pattern pattern.txt /*Pattern*
Perl if_perl.txt /*Perl*
Posix intro.txt /*Posix*
@@ -5617,6 +5618,7 @@ delete() eval.txt /*delete()*
delete-insert change.txt /*delete-insert*
delete-menus gui.txt /*delete-menus*
deleting change.txt /*deleting*
demoserver.py channel.txt /*demoserver.py*
design-assumptions develop.txt /*design-assumptions*
design-compatible develop.txt /*design-compatible*
design-decisions develop.txt /*design-decisions*
@@ -6407,7 +6409,6 @@ g` motion.txt /*g`*
g`a motion.txt /*g`a*
ga various.txt /*ga*
garbagecollect() eval.txt /*garbagecollect()*
garbagecollect_for_testing() eval.txt /*garbagecollect_for_testing()*
gd pattern.txt /*gd*
gdb debug.txt /*gdb*
ge motion.txt /*ge*
@@ -8705,6 +8706,13 @@ terminal-options term.txt /*terminal-options*
terminfo term.txt /*terminfo*
termresponse-variable eval.txt /*termresponse-variable*
test-functions usr_41.txt /*test-functions*
test_garbagecollect_now() eval.txt /*test_garbagecollect_now()*
test_null_channel() eval.txt /*test_null_channel()*
test_null_dict() eval.txt /*test_null_dict()*
test_null_job() eval.txt /*test_null_job()*
test_null_list() eval.txt /*test_null_list()*
test_null_partial() eval.txt /*test_null_partial()*
test_null_string() eval.txt /*test_null_string()*
testing-variable eval.txt /*testing-variable*
tex-cchar syntax.txt /*tex-cchar*
tex-cole syntax.txt /*tex-cole*
+16 -24
View File
@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.4. Last change: 2016 May 20
*todo.txt* For Vim version 7.4. Last change: 2016 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -42,41 +42,26 @@ Any other callbacks that could be invoked at the wrong moment?
If removing buffer that's being read from, close channel?
problem with "Ignore" after adding 'guicolors'. (Charles Campbell, 2016 Apr
Problem with "Ignore" after adding 'guicolors'. (Charles Campbell, 2016 Apr
27)
In test_partial when start_job() has a non-existing command memory leaks.
Rename garbagecollect_for_testing() to test_garbagecollect_now().
Add test_get_null_list(), use in test_expr.
In test_partial when start_job() has a non-existing command memory (a dict
item) leaks.
Memory leak in test49
Memory leak in test_alot, with matchstrpos()
Packages:
- Add the "after" directory to 'runtimepath' only if it exists.
- Add the "after" directory to 'runtimepath', only if it exists.
(Greg Hurrell, May 1)
- Also keep a list of loaded plugins, skip when encountered again?
Vim.org: when a user already has a homepage, do show the field so that it can
be deleted.
Patch to fix memory leak (Justin Keyes, 2016 May 16, #811)
Instead free before assigning, set to NULL after free.
Comparing partials doesn't work well. (Nikolai Pavlov, 2016 May 17, #813)
Examples in the form of a test (May 19)
Documentation for partials is lacking.
- Add "partial" and "partials" tag.
- Assigning to a dict member creates a partial.
How to store a partial associated with dictA in dictB? Add help for this.
See comments on #812.
- using dict.Func for function() is broken: not true (Nikolai Pavlov, May 20)
Patch to fix that BufUnload is triggered twice. (Hirohito Higashi, 2016 May
14)
+channel:
- Feedback from Ramel Eshed, May 7. Occasional crashes.
- Close_cb isn't invoked when output goes to a buffer. (Luc Hermitte)
@@ -153,15 +138,14 @@ Regexp problems:
Using freed memory in quickfix code. (Dominique, 2016 Mar 21)
User commands: add a <> item to pass on command modifiers, such as ":tab".
jsonencode(): should convert to utf-8. (Nikolai Pavlov, 2016 Jan 23)
What if there is an invalid character?
Once .exe with updated installer is available: Add remark to download page
about /S and /D options (Ken Takata, 2016 Apr 13)
Patch to avoid reallocating buffer for quickfix lines three times.
(Yegappan Lakshmanan, 2016 May 7)
Patch to make cursor blinking work better with GTK3. (Kazunobu Kuriyama, 2016
Apr 19) Need to check this works on Linux.
Alternative:
@@ -180,14 +164,22 @@ Invalid behavior with NULL list. (Nikolai Pavlov, #768)
Patch to fix using CTRL-] on "{address}." in help. (Hirohito Higashi, 2016 May
18, #814)
Patch to reduce number of memory allocations for quickfix lines.
(Yegappan Lakshmanan, 2016 May 22, #831)
Patch to fix greying popup menu items. (Shane Harper, 2016 May 23, #834)
&t_ut not used with 'termguicolors' is set. (Jacob Niehus, 2016 May 14, #804)
Patch to fix this, Jacob Niehus, 2016 May 14, #805)
For current Windows build .pdb file is missing. (Gabriele Fava, 2016 May 11)
5)
Problem with whitespace in errorformat. (Gerd Wachsmuth, 2016 May 15, #807)
When 'autochdir' is set, writing new file does not change the current dir.
(Dan Church, issue #777)
Patch to fix this. (mister fish (Allen Haim), 2016 May 14, #803)
ml_get errors when reloading file. (Chris Desjardins, 2016 Apr 19)
Also with latest version.
@@ -420,7 +412,7 @@ Value returned by virtcol() changes depending on how lines wrap. This is
inconsistent with the documentation.
Patch to add filtering of the quickfix list. (Yegappan Lakshmanan, 2016 Mar
13, last version) Update Mar 21., Apr 2.
13, last version) Update May 22, #830.
Can we cache the syntax attributes, so that updates for 'relativenumber' and
'cursorline'/'cursorcolumn' are a lot faster?
+8 -5
View File
@@ -1,4 +1,4 @@
*various.txt* For Vim version 7.4. Last change: 2016 May 05
*various.txt* For Vim version 7.4. Last change: 2016 May 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -610,13 +610,16 @@ K Run a program to lookup the keyword under the
directory of Vim. It is called 'ref' and does a
simple spelling check.
Special cases:
- If 'keywordprg' begins with ":" it is invoked as
a Vim Ex command with [count].
- If 'keywordprg' is empty, the ":help" command is
used. It's a good idea to include more characters
in 'iskeyword' then, to be able to find more help.
- When 'keywordprg' is equal to "man", a count before
"K" is inserted after the "man" command and before
the keyword. For example, using "2K" while the
cursor is on "mkdir", results in: >
- When 'keywordprg' is equal to "man" or starts with
":", a [count] before "K" is inserted after
keywordprg and before the keyword. For example,
using "2K" while the cursor is on "mkdir", results
in: >
!man 2 mkdir
< - When 'keywordprg' is equal to "man -s", a count
before "K" is inserted after the "-s". If there is
+19
View File
@@ -0,0 +1,19 @@
" Vim filetype plugin file
" Language: groovy
" Maintainer: Justin M. Keyes <justinkz@gmail.com>
" Last Change: 2016 May 22
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo-=C
let b:undo_ftplugin = 'setlocal commentstring<'
setlocal commentstring=//%s
let &cpo = s:cpo_save
unlet s:cpo_save
+3 -2
View File
@@ -1,7 +1,7 @@
" Vim support file to detect file types in scripts
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2014 Aug 24
" Last change: 2016 May 21
" This file is called by an autocommand for every file that has just been
" loaded into a buffer. It checks if the type of file can be recognized by
@@ -245,7 +245,8 @@ else
set ft=xhtml
" HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
" Avoid "doctype html", used by slim.
elseif s:line1 =~? '<!DOCTYPE\s\+html\>'
set ft=html
" PDF
+7 -4
View File
@@ -2,9 +2,9 @@
" Language: Groovy
" Original Author: Alessio Pace <billy.corgan@tiscali.it>
" Maintainer: Tobias Rapp <yahuxo@gmx.de>
" Version: 0.1.14
" Version: 0.1.16
" URL: http://www.vim.org/scripts/script.php?script_id=945
" Last Change: 2015 Apr 21
" Last Change: 2016 May 23
" THE ORIGINAL AUTHOR'S NOTES:
"
@@ -255,8 +255,11 @@ syn region groovyString start=+"+ end=+"+ end=+$+ contains=groovySpeci
syn region groovyString start=+'+ end=+'+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell
syn region groovyString start=+"""+ end=+"""+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
syn region groovyString start=+'''+ end=+'''+ contains=groovySpecialChar,groovySpecialError,@Spell
" regex string
syn region groovyString start='/[^/]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr
if exists("groovy_regex_strings")
" regex strings interfere with the division operator and thus are disabled
" by default
syn region groovyString start='/[^/*]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr
endif
" syn region groovyELExpr start=+${+ end=+}+ keepend contained
syn match groovyELExpr /\${.\{-}}/ contained
syn match groovyELExpr /\$[a-zA-Z_][a-zA-Z0-9_.]*/ contained
+16 -1
View File
@@ -1,6 +1,6 @@
" Vim syntax file
" Language: Scheme (R5RS + some R6RS extras)
" Last Change: 2012 May 13
" Last Change: 2016 May 23
" Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
" Original author: Dirk van Deun <dirk@igwe.vub.ac.be>
@@ -245,6 +245,18 @@ if exists("b:is_mzscheme") || exists("is_mzscheme")
syn region schemeUnquote matchgroup=Delimiter start="#,@\[" end="\]" contains=ALL
syn region schemeQuoted matchgroup=Delimiter start="#['`]" end=![ \t()\[\]";]!me=e-1 contains=ALL
syn region schemeQuoted matchgroup=Delimiter start="#['`](" matchgroup=Delimiter end=")" contains=ALL
" Identifiers are very liberal in MzScheme/Racket
syn match schemeOther ![^()[\]{}",'`;#|\\ ]\+!
" Language setting
syn match schemeLang "#lang [-+_/A-Za-z0-9]\+\>"
" Various number forms
syn match schemeNumber "[-+]\=[0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\>"
syn match schemeNumber "[-+]\=\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\>"
syn match schemeNumber "[-+]\=[0-9]\+/[0-9]\+\>"
syn match schemeNumber "\([-+]\=\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\)\=[-+]\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\=i\>"
endif
@@ -321,6 +333,9 @@ if version >= 508 || !exists("did_scheme_syntax_inits")
HiLink schemeExtSyntax Type
HiLink schemeExtFunc PreProc
HiLink schemeLang PreProc
delcommand HiLink
endif
+6 -3
View File
@@ -578,9 +578,12 @@ buf_freeall(buf_T *buf, int flags)
int is_curbuf = (buf == curbuf);
buf->b_closing = TRUE;
apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf);
if (!buf_valid(buf)) /* autocommands may delete the buffer */
return;
if (buf->b_ml.ml_mfp != NULL)
{
apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf);
if (!buf_valid(buf)) /* autocommands may delete the buffer */
return;
}
if ((flags & BFA_DEL) && buf->b_p_bl)
{
apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf);
+148 -56
View File
@@ -583,7 +583,6 @@ static void f_foldtextresult(typval_T *argvars, typval_T *rettv);
static void f_foreground(typval_T *argvars, typval_T *rettv);
static void f_function(typval_T *argvars, typval_T *rettv);
static void f_garbagecollect(typval_T *argvars, typval_T *rettv);
static void f_garbagecollect_for_testing(typval_T *argvars, typval_T *rettv);
static void f_get(typval_T *argvars, typval_T *rettv);
static void f_getbufline(typval_T *argvars, typval_T *rettv);
static void f_getbufvar(typval_T *argvars, typval_T *rettv);
@@ -806,7 +805,17 @@ static void f_tabpagewinnr(typval_T *argvars, typval_T *rettv);
static void f_taglist(typval_T *argvars, typval_T *rettv);
static void f_tagfiles(typval_T *argvars, typval_T *rettv);
static void f_tempname(typval_T *argvars, typval_T *rettv);
static void f_test(typval_T *argvars, typval_T *rettv);
static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_JOB_CHANNEL
static void f_test_null_channel(typval_T *argvars, typval_T *rettv);
#endif
static void f_test_null_dict(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_JOB_CHANNEL
static void f_test_null_job(typval_T *argvars, typval_T *rettv);
#endif
static void f_test_null_list(typval_T *argvars, typval_T *rettv);
static void f_test_null_partial(typval_T *argvars, typval_T *rettv);
static void f_test_null_string(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_FLOAT
static void f_tan(typval_T *argvars, typval_T *rettv);
static void f_tanh(typval_T *argvars, typval_T *rettv);
@@ -6925,7 +6934,7 @@ static garray_T funcargs = GA_EMPTY;
/*
* Do garbage collection for lists and dicts.
* When "testing" is TRUE this is called from garbagecollect_for_testing().
* When "testing" is TRUE this is called from test_garbagecollect_now().
* Return TRUE if some memory was freed.
*/
int
@@ -8451,7 +8460,6 @@ static struct fst
{"foreground", 0, 0, f_foreground},
{"function", 1, 3, f_function},
{"garbagecollect", 0, 1, f_garbagecollect},
{"garbagecollect_for_testing", 0, 0, f_garbagecollect_for_testing},
{"get", 2, 3, f_get},
{"getbufline", 2, 3, f_getbufline},
{"getbufvar", 2, 3, f_getbufvar},
@@ -8681,7 +8689,17 @@ static struct fst
{"tanh", 1, 1, f_tanh},
#endif
{"tempname", 0, 0, f_tempname},
{"test", 1, 1, f_test},
{"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now},
#ifdef FEAT_JOB_CHANNEL
{"test_null_channel", 0, 0, f_test_null_channel},
#endif
{"test_null_dict", 0, 0, f_test_null_dict},
#ifdef FEAT_JOB_CHANNEL
{"test_null_job", 0, 0, f_test_null_job},
#endif
{"test_null_list", 0, 0, f_test_null_list},
{"test_null_partial", 0, 0, f_test_null_partial},
{"test_null_string", 0, 0, f_test_null_string},
#ifdef FEAT_TIMERS
{"timer_start", 2, 3, f_timer_start},
{"timer_stop", 1, 1, f_timer_stop},
@@ -9069,14 +9087,12 @@ call_func(
if (partial != NULL)
{
if (partial->pt_dict != NULL)
{
/* When the function has a partial with a dict and there is a dict
* argument, use the dict argument. That is backwards compatible.
*/
if (selfdict_in == NULL)
selfdict = partial->pt_dict;
}
/* When the function has a partial with a dict and there is a dict
* argument, use the dict argument. That is backwards compatible.
* When the dict was bound explicitly use the one from the partial. */
if (partial->pt_dict != NULL
&& (selfdict_in == NULL || !partial->pt_auto))
selfdict = partial->pt_dict;
if (error == ERROR_NONE && partial->pt_argc > 0)
{
for (argv_clear = 0; argv_clear < partial->pt_argc; ++argv_clear)
@@ -12330,12 +12346,16 @@ f_function(typval_T *argvars, typval_T *rettv)
* use "dict". That is backwards compatible. */
if (dict_idx > 0)
{
/* The dict is bound explicitly, pt_auto is FALSE. */
pt->pt_dict = argvars[dict_idx].vval.v_dict;
++pt->pt_dict->dv_refcount;
}
else if (arg_pt != NULL)
{
/* If the dict was bound automatically the result is also
* bound automatically. */
pt->pt_dict = arg_pt->pt_dict;
pt->pt_auto = arg_pt->pt_auto;
if (pt->pt_dict != NULL)
++pt->pt_dict->dv_refcount;
}
@@ -12371,17 +12391,6 @@ f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED)
garbage_collect_at_exit = TRUE;
}
/*
* "garbagecollect_for_testing()" function
*/
static void
f_garbagecollect_for_testing(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
/* This is dangerous, any Lists and Dicts used internally may be freed
* while still in use. */
garbage_collect(TRUE);
}
/*
* "get()" function
*/
@@ -12414,6 +12423,55 @@ f_get(typval_T *argvars, typval_T *rettv)
tv = &di->di_tv;
}
}
else if (argvars[0].v_type == VAR_PARTIAL || argvars[0].v_type == VAR_FUNC)
{
partial_T *pt;
partial_T fref_pt;
if (argvars[0].v_type == VAR_PARTIAL)
pt = argvars[0].vval.v_partial;
else
{
vim_memset(&fref_pt, 0, sizeof(fref_pt));
fref_pt.pt_name = argvars[0].vval.v_string;
pt = &fref_pt;
}
if (pt != NULL)
{
char_u *what = get_tv_string(&argvars[1]);
if (STRCMP(what, "func") == 0 || STRCMP(what, "name") == 0)
{
rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING);
if (pt->pt_name == NULL)
rettv->vval.v_string = NULL;
else
rettv->vval.v_string = vim_strsave(pt->pt_name);
}
else if (STRCMP(what, "dict") == 0)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = pt->pt_dict;
if (pt->pt_dict != NULL)
++pt->pt_dict->dv_refcount;
}
else if (STRCMP(what, "args") == 0)
{
rettv->v_type = VAR_LIST;
if (rettv_list_alloc(rettv) == OK)
{
int i;
for (i = 0; i < pt->pt_argc; ++i)
list_append_tv(rettv->vval.v_list, &pt->pt_argv[i]);
}
}
else
EMSG2(_(e_invarg2), what);
return;
}
}
else
EMSG2(_(e_listdictarg), "get()");
@@ -20627,35 +20685,6 @@ f_tempname(typval_T *argvars UNUSED, typval_T *rettv)
} while (x == 'I' || x == 'O');
}
/*
* "test(list)" function: Just checking the walls...
*/
static void
f_test(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
/* Used for unit testing. Change the code below to your liking. */
#if 0
listitem_T *li;
list_T *l;
char_u *bad, *good;
if (argvars[0].v_type != VAR_LIST)
return;
l = argvars[0].vval.v_list;
if (l == NULL)
return;
li = l->lv_first;
if (li == NULL)
return;
bad = get_tv_string(&li->li_tv);
li = li->li_next;
if (li == NULL)
return;
good = get_tv_string(&li->li_tv);
rettv->vval.v_number = test_edit_score(bad, good);
#endif
}
#ifdef FEAT_FLOAT
/*
* "tan()" function
@@ -20688,6 +20717,63 @@ f_tanh(typval_T *argvars, typval_T *rettv)
}
#endif
/*
* "test_garbagecollect_now()" function
*/
static void
f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
/* This is dangerous, any Lists and Dicts used internally may be freed
* while still in use. */
garbage_collect(TRUE);
}
#ifdef FEAT_JOB_CHANNEL
static void
f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
rettv->v_type = VAR_CHANNEL;
rettv->vval.v_channel = NULL;
}
#endif
static void
f_test_null_dict(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
rettv->v_type = VAR_DICT;
rettv->vval.v_dict = NULL;
}
#ifdef FEAT_JOB_CHANNEL
static void
f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
rettv->v_type = VAR_JOB;
rettv->vval.v_job = NULL;
}
#endif
static void
f_test_null_list(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = NULL;
}
static void
f_test_null_partial(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
rettv->v_type = VAR_PARTIAL;
rettv->vval.v_partial = NULL;
}
static void
f_test_null_string(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
}
#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_TIMERS) || defined(PROTO)
/*
* Get a callback from "arg". It can be a Funcref or a function name.
@@ -22306,8 +22392,14 @@ handle_subscript(
}
}
if ((rettv->v_type == VAR_FUNC || rettv->v_type == VAR_PARTIAL)
&& selfdict != NULL)
/* Turn "dict.Func" into a partial for "Func" bound to "dict".
* Don't do this when "Func" is already a partial that was bound
* explicitly (pt_auto is FALSE). */
if (selfdict != NULL
&& (rettv->v_type == VAR_FUNC
|| (rettv->v_type == VAR_PARTIAL
&& (rettv->vval.v_partial->pt_auto
|| rettv->vval.v_partial->pt_dict == NULL))))
{
char_u *fname = rettv->v_type == VAR_FUNC ? rettv->vval.v_string
: rettv->vval.v_partial->pt_name;
@@ -22321,7 +22413,6 @@ handle_subscript(
fp = find_func(fname);
vim_free(tofree);
/* Turn "dict.Func" into a partial for "Func" with "dict". */
if (fp != NULL && (fp->uf_flags & FC_DICT))
{
partial_T *pt = (partial_T *)alloc_clear(sizeof(partial_T));
@@ -22330,6 +22421,7 @@ handle_subscript(
{
pt->pt_refcount = 1;
pt->pt_dict = selfdict;
pt->pt_auto = TRUE;
selfdict = NULL;
if (rettv->v_type == VAR_FUNC)
{
+18 -5
View File
@@ -3399,13 +3399,15 @@ add_pack_plugin(char_u *fname, void *cookie)
int keep;
int oldlen;
int addlen;
char_u *afterdir;
int afterlen = 0;
char_u *ffname = fix_fname(fname);
if (ffname == NULL)
return;
if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)ffname) == NULL)
{
/* directory not in 'runtimepath', add it */
/* directory is not yet in 'runtimepath', add it */
p4 = p3 = p2 = p1 = get_past_head(ffname);
for (p = p1; *p; mb_ptr_adv(p))
if (vim_ispathsep_nocolon(*p))
@@ -3433,20 +3435,31 @@ add_pack_plugin(char_u *fname, void *cookie)
}
*p4 = c;
/* check if rtp/pack/name/start/name/after exists */
afterdir = concat_fnames(ffname, (char_u *)"after", TRUE);
if (afterdir != NULL && mch_isdir(afterdir))
afterlen = STRLEN(afterdir) + 1; /* add one for comma */
oldlen = (int)STRLEN(p_rtp);
addlen = (int)STRLEN(ffname);
new_rtp = alloc(oldlen + addlen + 2);
addlen = (int)STRLEN(ffname) + 1; /* add one for comma */
new_rtp = alloc(oldlen + addlen + afterlen + 1); /* add one for NUL */
if (new_rtp == NULL)
goto theend;
keep = (int)(insp - p_rtp);
mch_memmove(new_rtp, p_rtp, keep);
new_rtp[keep] = ',';
mch_memmove(new_rtp + keep + 1, ffname, addlen + 1);
mch_memmove(new_rtp + keep + 1, ffname, addlen);
if (p_rtp[keep] != NUL)
mch_memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
mch_memmove(new_rtp + keep + addlen, p_rtp + keep,
oldlen - keep + 1);
if (afterlen > 0)
{
STRCAT(new_rtp, ",");
STRCAT(new_rtp, afterdir);
}
set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
vim_free(new_rtp);
vim_free(afterdir);
}
if (cookie != &APP_ADD_DIR)
+15 -2
View File
@@ -5519,10 +5519,12 @@ nv_ident(cmdarg_T *cap)
{
char_u *ptr = NULL;
char_u *buf;
unsigned buflen;
char_u *newbuf;
char_u *p;
char_u *kp; /* value of 'keywordprg' */
int kp_help; /* 'keywordprg' is ":help" */
int kp_help; /* 'keywordprg' is ":he" */
int kp_ex; /* 'keywordprg' starts with ":" */
int n = 0; /* init for GCC */
int cmdchar;
int g_cmd; /* "g" command */
@@ -5570,7 +5572,9 @@ nv_ident(cmdarg_T *cap)
kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp);
kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0
|| STRCMP(kp, ":help") == 0);
buf = alloc((unsigned)(n * 2 + 30 + STRLEN(kp)));
kp_ex = (*kp == ':');
buflen = (unsigned)(n * 2 + 30 + STRLEN(kp));
buf = alloc(buflen);
if (buf == NULL)
return;
buf[0] = NUL;
@@ -5596,6 +5600,15 @@ nv_ident(cmdarg_T *cap)
case 'K':
if (kp_help)
STRCPY(buf, "he! ");
else if (kp_ex)
{
if (cap->count0 != 0)
vim_snprintf((char *)buf, buflen, "%s %ld",
kp, cap->count0);
else
STRCPY(buf, kp);
STRCAT(buf, " ");
}
else
{
/* An external command will probably use an argument starting
+37 -48
View File
@@ -179,6 +179,31 @@ qf_init(
*/
#define LINE_MAXLEN 4096
static char_u *
qf_grow_linebuf(char_u **growbuf, int *growbufsiz, int newsz, int *allocsz)
{
/*
* If the line exceeds LINE_MAXLEN exclude the last
* byte since it's not a NL character.
*/
*allocsz = newsz > LINE_MAXLEN ? LINE_MAXLEN - 1 : newsz;
if (*growbuf == NULL)
{
*growbuf = alloc(*allocsz + 1);
if (*growbuf == NULL)
return NULL;
*growbufsiz = *allocsz;
}
else if (*allocsz > *growbufsiz)
{
*growbuf = vim_realloc(*growbuf, *allocsz + 1);
if (*growbuf == NULL)
return NULL;
*growbufsiz = *allocsz;
}
return *growbuf;
}
/*
* Read the errorfile "efile" into memory, line by line, building the error
* list.
@@ -538,24 +563,10 @@ qf_init_ext(
if (len > IOSIZE - 2)
{
/*
* If the line exceeds LINE_MAXLEN exclude the last
* byte since it's not a NL character.
*/
linelen = len > LINE_MAXLEN ? LINE_MAXLEN - 1 : len;
if (growbuf == NULL)
{
growbuf = alloc(linelen + 1);
growbufsiz = linelen;
}
else if (linelen > growbufsiz)
{
growbuf = vim_realloc(growbuf, linelen + 1);
if (growbuf == NULL)
goto qf_init_end;
growbufsiz = linelen;
}
linebuf = growbuf;
linebuf = qf_grow_linebuf(&growbuf, &growbufsiz, len,
&linelen);
if (linebuf == NULL)
goto qf_init_end;
}
else
{
@@ -584,22 +595,10 @@ qf_init_ext(
len = (int)STRLEN(p_li->li_tv.vval.v_string);
if (len > IOSIZE - 2)
{
linelen = len;
if (linelen > LINE_MAXLEN)
linelen = LINE_MAXLEN - 1;
if (growbuf == NULL)
{
growbuf = alloc(linelen + 1);
growbufsiz = linelen;
}
else if (linelen > growbufsiz)
{
if ((growbuf = vim_realloc(growbuf,
linelen + 1)) == NULL)
goto qf_init_end;
growbufsiz = linelen;
}
linebuf = growbuf;
linebuf = qf_grow_linebuf(&growbuf, &growbufsiz, len,
&linelen);
if (linebuf == NULL)
goto qf_init_end;
}
else
{
@@ -621,20 +620,10 @@ qf_init_ext(
linelen = (int)STRLEN(p_buf);
if (linelen > IOSIZE - 2)
{
if (growbuf == NULL)
{
growbuf = alloc(linelen + 1);
growbufsiz = linelen;
}
else if (linelen > growbufsiz)
{
if (linelen > LINE_MAXLEN)
linelen = LINE_MAXLEN - 1;
if ((growbuf = vim_realloc(growbuf, linelen + 1)) == NULL)
goto qf_init_end;
growbufsiz = linelen;
}
linebuf = growbuf;
linebuf = qf_grow_linebuf(&growbuf, &growbufsiz, len,
&linelen);
if (linebuf == NULL)
goto qf_init_end;
}
else
linebuf = IObuff;
+4
View File
@@ -801,6 +801,10 @@ update_single_line(win_T *wp, linenr_T lnum)
int row;
int j;
/* Don't do anything if the screen structures are (not yet) valid. */
if (!screen_valid(TRUE))
return;
if (lnum >= wp->w_topline && lnum < wp->w_botline
&& foldedCount(wp, lnum, &win_foldinfo) == 0)
{
+2
View File
@@ -1261,6 +1261,8 @@ struct partial_S
{
int pt_refcount; /* reference count */
char_u *pt_name; /* function name */
int pt_auto; /* when TRUE the partial was created for using
dict.member in handle_subscript() */
int pt_argc; /* number of arguments */
typval_T *pt_argv; /* arguments in allocated array */
dict_T *pt_dict; /* dict for "self" */
+1
View File
@@ -32,3 +32,4 @@ source test_tagjump.vim
source test_timers.vim
source test_undolevels.vim
source test_unlet.vim
source test_window_cmd.vim
+48 -21
View File
@@ -7,29 +7,56 @@ func Test_vim_did_enter()
" becomes one.
endfunc
if !has('timers')
finish
if has('timers')
func ExitInsertMode(id)
call feedkeys("\<Esc>")
endfunc
func Test_cursorhold_insert()
let g:triggered = 0
au CursorHoldI * let g:triggered += 1
set updatetime=20
call timer_start(100, 'ExitInsertMode')
call feedkeys('a', 'x!')
call assert_equal(1, g:triggered)
endfunc
func Test_cursorhold_insert_ctrl_x()
let g:triggered = 0
au CursorHoldI * let g:triggered += 1
set updatetime=20
call timer_start(100, 'ExitInsertMode')
" CursorHoldI does not trigger after CTRL-X
call feedkeys("a\<C-X>", 'x!')
call assert_equal(0, g:triggered)
endfunc
endif
func ExitInsertMode(id)
call feedkeys("\<Esc>")
endfunc
function Test_bufunload()
augroup test_bufunload_group
autocmd!
autocmd BufUnload * call add(s:li, "bufunload")
autocmd BufDelete * call add(s:li, "bufdelete")
autocmd BufWipeout * call add(s:li, "bufwipeout")
augroup END
func Test_cursorhold_insert()
let g:triggered = 0
au CursorHoldI * let g:triggered += 1
set updatetime=20
call timer_start(100, 'ExitInsertMode')
call feedkeys('a', 'x!')
call assert_equal(1, g:triggered)
endfunc
let s:li=[]
new
setlocal bufhidden=
bunload
call assert_equal(["bufunload", "bufdelete"], s:li)
func Test_cursorhold_insert_ctrl_x()
let g:triggered = 0
au CursorHoldI * let g:triggered += 1
set updatetime=20
call timer_start(100, 'ExitInsertMode')
" CursorHoldI does not trigger after CTRL-X
call feedkeys("a\<C-X>", 'x!')
call assert_equal(0, g:triggered)
let s:li=[]
new
setlocal bufhidden=delete
bunload
call assert_equal(["bufunload", "bufdelete"], s:li)
let s:li=[]
new
setlocal bufhidden=unload
bwipeout
call assert_equal(["bufunload", "bufdelete", "bufwipeout"], s:li)
augroup! test_bufunload_group
endfunc
+2 -2
View File
@@ -183,7 +183,7 @@ func s:communicate(port)
call assert_equal('got it', s:responseMsg)
" Collect garbage, tests that our handle isn't collected.
call garbagecollect_for_testing()
call test_garbagecollect_now()
" check setting options (without testing the effect)
call ch_setoptions(handle, {'callback': 's:NotUsed'})
@@ -1302,7 +1302,7 @@ endfunc
func Test_using_freed_memory()
let g:a = job_start(['ls'])
sleep 10m
call garbagecollect_for_testing()
call test_garbagecollect_now()
endfunc
+1 -1
View File
@@ -85,7 +85,7 @@ func Test_getreg_empty_list()
endfunc
func Test_loop_over_null_list()
let null_list = submatch(1, 1)
let null_list = test_null_list()
for i in null_list
call assert_true(0, 'should not get here')
endfor
+3 -1
View File
@@ -13,6 +13,7 @@ endfunc
func Test_packadd()
call mkdir(s:plugdir . '/plugin/also', 'p')
call mkdir(s:plugdir . '/ftdetect', 'p')
call mkdir(s:plugdir . '/after', 'p')
set rtp&
let rtp = &rtp
filetype on
@@ -35,7 +36,8 @@ func Test_packadd()
call assert_equal(77, g:plugin_also_works)
call assert_equal(17, g:ftdetect_works)
call assert_true(len(&rtp) > len(rtp))
call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
call assert_true(&rtp =~ '/testdir/Xdir/pack/mine/opt/mytest/after$')
" Check exception
call assert_fails("packadd directorynotfound", 'E919:')
+40
View File
@@ -257,3 +257,43 @@ func Test_ref_job_partial_dict()
call job_setoptions(g:ref_job, {'exit_cb': function('string', [], d)})
endif
endfunc
func Test_auto_partial_rebind()
let dict1 = {'name': 'dict1'}
func! dict1.f1()
return self.name
endfunc
let dict1.f2 = function(dict1.f1, dict1)
call assert_equal('dict1', dict1.f1())
call assert_equal('dict1', dict1['f1']())
call assert_equal('dict1', dict1.f2())
call assert_equal('dict1', dict1['f2']())
let dict2 = {'name': 'dict2'}
let dict2.f1 = dict1.f1
let dict2.f2 = dict1.f2
call assert_equal('dict2', dict2.f1())
call assert_equal('dict2', dict2['f1']())
call assert_equal('dict1', dict2.f2())
call assert_equal('dict1', dict2['f2']())
endfunc
func Test_get_partial_items()
let dict = {'name': 'hello'}
let args = ["foo", "bar"]
let Func = function('MyDictFunc')
let Cb = function('MyDictFunc', args, dict)
call assert_equal(Func, get(Cb, 'func'))
call assert_equal('MyDictFunc', get(Cb, 'name'))
call assert_equal(args, get(Cb, 'args'))
call assert_equal(dict, get(Cb, 'dict'))
call assert_fails('call get(Cb, "xxx")', 'E475:')
call assert_equal(Func, get(Func, 'func'))
call assert_equal('MyDictFunc', get(Func, 'name'))
call assert_equal([], get(Func, 'args'))
call assert_true(empty( get(Func, 'dict')))
endfunc
+11 -2
View File
@@ -700,14 +700,14 @@ endfunc
" Tests for the setqflist() and setloclist() functions
function SetXlistTests(cchar, bnum)
let Xwindow = a:cchar . 'window'
let Xnext = a:cchar . 'next'
if a:cchar == 'c'
let Xsetlist = function('setqflist')
let Xgetlist = function('getqflist')
let Xnext = 'cnext'
else
let Xsetlist = function('setloclist', [0])
let Xgetlist = function('getloclist', [0])
let Xnext = 'lnext'
endif
call Xsetlist([{'bufnr': a:bnum, 'lnum': 1},
@@ -723,6 +723,15 @@ function SetXlistTests(cchar, bnum)
exe Xnext
call assert_equal(3, line('.'))
" Appending entries to the list should not change the cursor position
" in the quickfix window
exe Xwindow
1
call Xsetlist([{'bufnr': a:bnum, 'lnum': 4},
\ {'bufnr': a:bnum, 'lnum': 5}], 'a')
call assert_equal(1, line('.'))
close
call Xsetlist([{'bufnr': a:bnum, 'lnum': 3},
\ {'bufnr': a:bnum, 'lnum': 4},
\ {'bufnr': a:bnum, 'lnum': 5}], 'r')
+37
View File
@@ -0,0 +1,37 @@
" Tests for window cmd (:wincmd, :split, :vsplit, :resize and etc...)
func Test_window_cmd_ls0_with_split()
set ls=0
set splitbelow
split
quit
call assert_equal(0, &lines - &cmdheight - winheight(0))
new | only!
"
set splitbelow&vim
botright split
quit
call assert_equal(0, &lines - &cmdheight - winheight(0))
new | only!
set ls&vim
endfunc
func Test_window_cmd_cmdwin_with_vsp()
let efmt='Expected 0 but got %d (in ls=%d, %s window)'
for v in range(0, 2)
exec "set ls=" . v
vsplit
call feedkeys("q:\<CR>")
let ac = &lines - (&cmdheight + winheight(0) + !!v)
let emsg = printf(efmt, ac, v, 'left')
call assert_equal(0, ac, emsg)
wincmd w
let ac = &lines - (&cmdheight + winheight(0) + !!v)
let emsg = printf(efmt, ac, v, 'right')
call assert_equal(0, ac, emsg)
new | only!
endfor
set ls&vim
endfunc
" vim: sw=2 et
+20
View File
@@ -768,6 +768,26 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1842,
/**/
1841,
/**/
1840,
/**/
1839,
/**/
1838,
/**/
1837,
/**/
1836,
/**/
1835,
/**/
1834,
/**/
1833,
/**/
1832,
/**/
+9 -9
View File
@@ -1165,8 +1165,13 @@ win_split_ins(
* one row for the status line */
win_new_height(wp, new_size);
if (flags & (WSP_TOP | WSP_BOT))
frame_new_height(curfrp, curfrp->fr_height
- (new_size + STATUS_HEIGHT), flags & WSP_TOP, FALSE);
{
int new_fr_height = curfrp->fr_height - new_size;
if (!((flags & WSP_BOT) && p_ls == 0))
new_fr_height -= STATUS_HEIGHT;
frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE);
}
else
win_new_height(oldwin, oldwin_height - (new_size + STATUS_HEIGHT));
if (before) /* new window above current one */
@@ -1179,18 +1184,13 @@ win_split_ins(
{
wp->w_winrow = oldwin->w_winrow + oldwin->w_height + STATUS_HEIGHT;
wp->w_status_height = oldwin->w_status_height;
/* Don't set the status_height for oldwin yet, this might break
* frame_fix_height(oldwin), therefore will be set below. */
if (!(flags & WSP_BOT))
oldwin->w_status_height = STATUS_HEIGHT;
}
if (flags & WSP_BOT)
frame_add_statusline(curfrp);
frame_fix_height(wp);
frame_fix_height(oldwin);
if (!before)
/* new window above current one, set the status_height after
* frame_fix_height(oldwin) */
oldwin->w_status_height = STATUS_HEIGHT;
}
if (flags & (WSP_TOP | WSP_BOT))