Re: Win32-binary lost for the latest gvim (7.4.1842)

2016-05-24 Fir de Conversatie Christian Brabandt
Hi skywind3000!

On Mi, 25 Mai 2016, skywind3...@163.com wrote:

> Win32-binary (7.4.1842) cannot be located in the gvim release:
> https://github.com/vim/vim-win32-installer/releases: 
> 
> only find x64 binary and pdb.
> 
> win32 is very important for many people whose toolchains (python/lua)
> or os is 32-bit 

The build for the 32bit version failed, because a download did not 
succeed. I just pushed the rebuild button. If it doesn't brake because 
of the python test mentioned by Ken, it will be uploaded soon. However, 
if you want to use the if_pyth functionality, it might not be a good 
idea to use this version.

> Will the maintainer of gvim give up 32 bit version ?

No.

Best,
Christian
-- 
"Herr Doktor, alle behaupten, ich sei eine Uhr."
"Ach was, die wollen Sie doch nur aufziehen."

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Strawberry Perl 5.24 doesn't work.

2016-05-24 Fir de Conversatie Ken Takata
Hi tux.,

2016/5/25 Wed 7:27:04 UTC+9 tux. wrote:
> Well ...
> 
> > if_perl.obj : error LNK2001: Nicht aufgelöstes externes Symbol 
> > "__imp__Perl_savetmps".
> > gvim.exe : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.
> 
> :-(

How about trying Damien's patch for Perl 5.22.2?
https://groups.google.com/d/msg/vim_dev/xLXIFC8p3EY/VaEapvJ-BAAJ

Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Win32-binary lost for the latest gvim (7.4.1842)

2016-05-24 Fir de Conversatie Ken Takata
Hi,

2016/5/25 Wed 11:45:30 UTC+9 skywi...@163.com wrote:
> Win32-binary (7.4.1842) cannot be located in the gvim release:
> https://github.com/vim/vim-win32-installer/releases: 
> 
> 
> only find x64 binary and pdb.
> 
> 
> win32 is very important for many people whose toolchains (python/lua) or os 
> is 32-bit 
> Will the maintainer of gvim give up 32 bit version ?

This is because the 32-bit build didn't pass the tests.
The problem is discussed at here: 
https://groups.google.com/d/msg/vim_dev/jFg6AnPAyDw/Ux8EO_qdHwAJ
This means that the 64-bit build might also has the same problem.
So you may want to avoid using this version.

The 32-bit build will be available after this problem is fixed.

Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1838

2016-05-24 Fir de Conversatie h_east
Hi Bram,

2016-5-25(Wed) 12:49:13 UTC+9 h_east:
> Hi Bram,
> 
> 2016-5-25(Wed) 0:33:53 UTC+9 Bram Moolenaar:
> > Patch 7.4.1838
> > Problem:Functions specifically for testing do not sort together.
> > Solution:   Rename garbagecollect_for_testing() to 
> > test_garbagecollect_now().
> > Add test_null_list(), test_null_dict(), etc.
> > Files:  src/eval.c, src/testdir/test_expr.vim,
> > src/testdir/test_channel.vim, runtime/doc/eval.txt
> [...]
> 
> I found a fix leaks in the comment.
> Please check an attached patch.
> 
> And, Is disable_char_avail_for_testing() not to rename?

Also alloc_fail() :-)

--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1838

2016-05-24 Fir de Conversatie h_east
Hi Bram,

2016-5-25(Wed) 0:33:53 UTC+9 Bram Moolenaar:
> Patch 7.4.1838
> Problem:Functions specifically for testing do not sort together.
> Solution:   Rename garbagecollect_for_testing() to test_garbagecollect_now().
> Add test_null_list(), test_null_dict(), etc.
> Files:  src/eval.c, src/testdir/test_expr.vim,
> src/testdir/test_channel.vim, runtime/doc/eval.txt
[...]

I found a fix leaks in the comment.
Please check an attached patch.

And, Is disable_char_avail_for_testing() not to rename?
--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/eval.c b/src/eval.c
index 41f98d2..6727615 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -8949,7 +8949,7 @@ get_func_tv(
 
 	if (get_vim_var_nr(VV_TESTING))
 	{
-	/* Prepare for calling garbagecollect_for_testing(), need to know
+	/* Prepare for calling test_garbagecollect_now(), need to know
 	 * what variables are used on the call stack. */
 	if (funcargs.ga_itemsize == 0)
 		ga_init2(, (int)sizeof(typval_T *), 50);
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 2b38981..57edcc1 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -60,7 +60,7 @@ let $HOME = '/does/not/exist'
 
 let s:srcdir = expand('%:p:h:h')
 
-" Prepare for calling garbagecollect_for_testing().
+" Prepare for calling test_garbagecollect_now().
 let v:testing = 1
 
 " Support function: get the alloc ID by name.


Win32-binary lost for the latest gvim (7.4.1842)

2016-05-24 Fir de Conversatie skywind3...@163.com
Win32-binary (7.4.1842) cannot be located in the gvim release:
https://github.com/vim/vim-win32-installer/releases: 

only find x64 binary and pdb.

win32 is very important for many people whose toolchains (python/lua) or os is 
32-bit 
Will the maintainer of gvim give up 32 bit version ?



skywind3...@163.com

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Use 'out_io': 'buffer' with nomodifiable

2016-05-24 Fir de Conversatie Ramel Eshed
Hi,

Is there any way to use a nomodifiable buffer as an output buffer for a job? If 
not, I think that it could be very useful.

Thanks,
Ramel

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Asynchronous grep plugin - thoughts and issues

2016-05-24 Fir de Conversatie Ramel Eshed
On Sunday, May 8, 2016 at 8:50:30 PM UTC+3, Ramel Eshed wrote:
> On Sunday, May 8, 2016 at 2:26:05 PM UTC+3, Bram Moolenaar wrote:
> > Ramel Eshed wrote:
> > 
> > > On Sunday, May 8, 2016 at 8:59:24 AM UTC+3, Bram Moolenaar wrote:
> > > > Ramel Eshed wrote:
> > > > 
> > > > > Thanks to Bram and his recent work on channels, I have a preliminary
> > > > > version of an asynchronous grep plugin which lets you work with the
> > > > > available results while grep is still running. I would like to take
> > > > > advantage of this relatively short script to raise some issues and
> > > > > thoughts I have. The plugin can be found at
> > > > > https://github.com/ramele/agrep.
> > > > > 
> > > > > My original idea was to use the quickfix list and add each match to it
> > > > > from the out callback. I had some issues with it, so temporarily (I
> > > > > hope..) I’m using my own window to display the results (“agrep
> > > > > window”). This is the default now and it should demonstrate what this
> > > > > plugin should do eventually. In order to reproduce the quickfix
> > > > > issues, you'll need to tell agrep to use quickfix list instead of
> > > > > agrep window (:let qgrep_use_qf=1). You can install the plugin as is
> > > > > or load it with $vim -u NONE -N -S 
> > > > > 
> > > > > 1. Stability:
> > > > > Currently (7.4.1819) when :Agrep returns high number of results
> > > > > (~2800. So we get similar number of callbacks in a time frame of ~2:45
> > > > > seconds) Vim crashes with:
> > > > > 
> > > > > Caught deadly signal SEGV
> > > > > Vim: Finished.
> > > > > Segmentation fault (core dumped)
> > > > 
> > > > What system are you using?  If on Windows, what compiler?
> > > > 
> > > This plugin is for Linux. I'm using Ubuntu 16.04 (and tested it also on 
> > > RHEL 5.5).
> > > 
> > > > > This is more likely to happen when using the quickfix list. But it
> > > > > happens sometimes with agrep window as well. I never see this when I
> > > > > change the out_cb to only process the msg without adding the results
> > > > > to neither agrep window or qf list (-with lines 108-118 commented
> > > > > out).
> > > > > 
> > > > > 2. Quickfix issues
> > > > > a.As long as there are not too many matches and the quickfix
> > > > > window is closed you can fire up a search and start jumping to the
> > > > > available matches while the search is still running using the quickfix
> > > > > navigation commands (:cn, for example). The problem is when the
> > > > > quickfix window is opened while the search is active – here there is a
> > > > > serious performance issue, and Vim hangs for a while. You can see this
> > > > > by running :copen and then :Agrep. Choose a search that will generate
> > > > > many results (> 1000).
> > > > 
> > > > You could use the channel log to find out where Vim spends time.  You
> > > > may need to add more log statements in the code and recompile.
> > > >
> > > I think that this is a quickfix issue rather than channels. I don't see 
> > > that problem when running with agrep window or even with quickfix without 
> > > the qf window opened (there is also the other issue (see #b below) but 
> > > this one is much more serious). The channels code does exactly the same, 
> > > no matter which mode we're using to display the results.
> > >  
> > > > > b.As the matches rate becomes higher, Vim will become
> > > > > unresponsive. It may happen for short intervals or it can hangs for a
> > > > > while (for very high rate). By “rate” I simply mean to
> > > > > number_of_matches / sec. To compare, the performance is much better
> > > > > with the agrep window.
> > > > > 
> > > > > As I understand (and please correct me if I’m wrong) when using
> > > > > setqflist() to create a new list or add items to the current list, Vim
> > > > > reads all the buffers (as an unlisted buffers) in order to set the
> > > > > hidden marks. I think that this is the reason of the slowness I’m
> > > > > experiencing. If I'm right, maybe the way Vim loads the buffers of the
> > > > > qf list should be changed so buffers will be loaded only when they're
> > > > > been accessed and not when they're added to the list. What do you
> > > > > think?
> > > > 
> > > > Then it would also be slow if you add all the matches at once.  Does
> > > > that happen?
> > > >  
> > > You're right, I forgot to mention that. It is noticeable also when adding 
> > > many results at once (you can see this by running :Agrepsetqf after you 
> > > have a long list of results).
> > > 
> > > > > 3. Changing other buffers:
> > > > > As far as I know, there is no nice way to change buffers other than
> > > > > the current one. There is the getbufline() function, but the symmetry
> > > > > is broken since there is no setbufline(). I found a discussion about
> > > > > this from 10 years ago
> > > > > (http://vim.1045645.n5.nabble.com/missing-setbufline-td1155970.html)
> > > > > but I'm not sure if Bram added it to his TODO list or not. In this
> > > > > 

Strawberry Perl 5.24 doesn't work.

2016-05-24 Fir de Conversatie tux.
Well ...

> if_perl.obj : error LNK2001: Nicht aufgelöstes externes Symbol 
> "__imp__Perl_savetmps".
> gvim.exe : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.

:-(

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1836

2016-05-24 Fir de Conversatie Nikolay Aleksandrovich Pavlov
2016-05-24 23:14 GMT+03:00 Christian Brabandt :
> Hi Bram!
>
> On Di, 24 Mai 2016, Bram Moolenaar wrote:
>
>>
>> Patch 7.4.1836
>> Problem:When using a partial on a dictionary it always gets bound to that
>> dictionary.
>> Solution:   Make a difference between binding a function to a dictionary
>> explicitly or automatically.
>> Files:  src/structs.h, src/eval.c, src/testdir/test_partial.vim,
>> runtime/doc/eval.txt
>
> Starting with this patch, I see sporadic failures on appveyor:
> https://ci.appveyor.com/project/chrisbra/vim/build/1234/job/wlpgqc4vnyvrdgqo
> https://ci.appveyor.com/project/chrisbra/vim/build/1239/job/2p6y8dru0sv216dv#L2073
> https://ci.appveyor.com/project/chrisbra/vim/build/1238/job/q4e5huq9x6opj6id#L2073
>
>
> test86:
> ..\gvim -u dos.vim -U NONE --noplugin --not-a-term "+set ff=unix|f
> test.out|wq"  dostmp\test86.out
> 522c522
> < psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'abcSelfPSA3':
> 'abcSelfPSA3Val'}]
> ---
>> psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'20': 1}

Uninitialized memory: set_partial() in if_py_both.h is not setting new
attribute.

diff -r c35c9121c72b runtime/doc/if_pyth.txt
--- a/runtime/doc/if_pyth.txt Tue May 24 22:30:07 2016 +0200
+++ b/runtime/doc/if_pyth.txt Wed May 25 01:14:35 2016 +0300
@@ -659,19 +659,31 @@
 `vim.bindeval('function(%s)'%json.dumps(name))`.

 Attributes (read-only):
-Attribute  Description ~
-name   Function name.
-args   `None` or a |python-List| object with arguments.  Note that
-   this is a copy of the arguments list, constructed each time
-   you request this attribute. Modifications made to the list
-   will be ignored (but not to the containers inside argument
-   list: this is like |copy()| and not |deepcopy()|).
-self   `None` or a |python-Dictionary| object with self
-   dictionary. Note that explicit `self` keyword used when
-   calling resulting object overrides this attribute.
+AttributeDescription ~
+name Function name.
+args `None` or a |python-List| object with arguments.  Note
+ that this is a copy of the arguments list, constructed
+ each time you request this attribute. Modifications made
+ to the list will be ignored (but not to the containers
+ inside argument list: this is like |copy()| and not
+ |deepcopy()|).
+self `None` or a |python-Dictionary| object with self
+ dictionary. Note that explicit `self` keyword used when
+ calling resulting object overrides this attribute.
+auto_rebind  Boolean. True if partial created from this Python object
+ and stored in the VimL dictionary should be automatically
+ rebound to the dictionary it is stored in when this
+ dictionary is indexed. Exposes Vim internal difference
+ between `dict.func` (auto_rebind=True) and
+ `function(dict.func,dict)` (auto_rebind=False). This
+ attribute makes no sense if `self` attribute is `None`.

-Constructor additionally accepts `args` and `self` keywords.  If any of
-them is given then it constructs a partial, see |function()|.
+Constructor additionally accepts `args`, `self` and `auto_rebind`
+keywords.  If `args` and/or `self` argument is given then it constructs
+a partial, see |function()|.  `auto_rebind` is only used when `self`
+argument is given, otherwise it is assumed to be `True` regardless of
+whether it was given or not.  If `self` is given then it defaults to
+`False`.

 Examples: >
 f = vim.Function('tr') # Constructor
diff -r c35c9121c72b src/if_py_both.h
--- a/src/if_py_both.h Tue May 24 22:30:07 2016 +0200
+++ b/src/if_py_both.h Wed May 25 01:14:35 2016 +0300
@@ -2835,16 +2835,17 @@
 typval_T *argv;
 dict_T *self;
 pylinkedlist_T ref;
+int auto_rebind;
 } FunctionObject;

 static PyTypeObject FunctionType;

-#define NEW_FUNCTION(name, argc, argv, self) \
-FunctionNew(, name, argc, argv, self)
+#define NEW_FUNCTION(name, argc, argv, self, pt_auto) \
+FunctionNew(, (name), (argc), (argv), (self), (pt_auto))

 static PyObject *
 FunctionNew(PyTypeObject *subtype, char_u *name, int argc, typval_T *argv,
- dict_T *selfdict)
+ dict_T *selfdict, int auto_rebind)
 {
 FunctionObject *self;

@@ -2877,6 +2878,7 @@
 self->argc = argc;
 self->argv = argv;
 self->self = selfdict;
+self->auto_rebind = selfdict == NULL ? TRUE : auto_rebind;

 if (self->argv || self->self)
  pyll_add((PyObject *)(self), >ref, );
@@ -2889,6 +2891,7 @@
 {
 PyObject *self;
 PyObject *selfdictObject;
+PyObject 

Re: Patch 7.4.1836

2016-05-24 Fir de Conversatie Bram Moolenaar

Christian Brabandt wrote:

> On Di, 24 Mai 2016, Bram Moolenaar wrote:
> 
> > 
> > Patch 7.4.1836
> > Problem:When using a partial on a dictionary it always gets bound to 
> > that
> > dictionary.
> > Solution:   Make a difference between binding a function to a dictionary
> > explicitly or automatically.
> > Files:  src/structs.h, src/eval.c, src/testdir/test_partial.vim,
> > runtime/doc/eval.txt
> 
> Starting with this patch, I see sporadic failures on appveyor:
> https://ci.appveyor.com/project/chrisbra/vim/build/1234/job/wlpgqc4vnyvrdgqo
> https://ci.appveyor.com/project/chrisbra/vim/build/1239/job/2p6y8dru0sv216dv#L2073
> https://ci.appveyor.com/project/chrisbra/vim/build/1238/job/q4e5huq9x6opj6id#L2073
> 
> 
> test86:
> ..\gvim -u dos.vim -U NONE --noplugin --not-a-term "+set ff=unix|f 
> test.out|wq"  dostmp\test86.out
> 522c522
> < psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'abcSelfPSA3': 
> 'abcSelfPSA3Val'}]
> ---
> > psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'20': 1}

I noticed.  It's strange that it only fails sometimes.
This is an old style test without any comments, it's hard to see what
it's doing.  I believe Nikolai wrote this, hopefully he knows.

-- 
A)bort, R)etry, B)ang it with a large hammer

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1839

2016-05-24 Fir de Conversatie Nikolay Aleksandrovich Pavlov
2016-05-24 23:25 GMT+03:00 Bram Moolenaar :
>
> Nikolay Pavlov wrote:
>
>> 2016-05-24 19:37 GMT+03:00 Bram Moolenaar :
>> >
>> > Patch 7.4.1839
>> > Problem:Cannot get the items stored in a partial.
>> > Solution:   Support using get() on a partial.
>> > Files:  src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.tx=
>
> [...]
>
>> > +   {what} are:
>> > +   'func'  The function
>>
>> This should be “the function name” I think. When reading “the
>> function” I expect returning funcref. Maybe even this is what should
>> actually be returned (I would expect something like “name” key to
>> return the function name, “func” sounds like returning a funcref as
>> well):
>
> Yeah, when writing this I was also wondering whether to return the name
> or something else.  Returning both is the most flexible.
>
> I don't think "subtype" makes sense.  This difference is only used
> internally, the help only talks about Funcref, of which partial is a
> form where args or dict is bound.  get() already indicates a Funcref is
> like a Partial without arguments or dict.

This is needed to check whether getting args/dict makes any sense. And
note that your patch created significant difference: trying to use
`get()` on a funcref errors out, but not on partial.

>
> --
> You have heard the saying that if you put a thousand monkeys in a room with a
> thousand typewriters and waited long enough, eventually you would have a room
> full of dead monkeys.
> (Scott Adams - The Dilbert principle)
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
> ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org///
>  \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.1842

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1842 (after 7.4.1839)
Problem:get() works for Partial but not for Funcref.
Solution:   Accept Funcref.  Also return the function itself. (Nikolai Pavlov)
Files:  src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.txt


*** ../vim-7.4.1841/src/eval.c  2016-05-24 18:36:48.099153830 +0200
--- src/eval.c  2016-05-24 22:13:21.538975095 +0200
***
*** 12423,12439 
tv = >di_tv;
}
  }
! else if (argvars[0].v_type == VAR_PARTIAL)
  {
!   partial_T   *pt = argvars[0].vval.v_partial;
  
if (pt != NULL)
{
char_u *what = get_tv_string([1]);
  
!   if (STRCMP(what, "func") == 0)
{
!   rettv->v_type = VAR_STRING;
if (pt->pt_name == NULL)
rettv->vval.v_string = NULL;
else
--- 12423,12449 
tv = >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(_pt, 0, sizeof(fref_pt));
!   fref_pt.pt_name = argvars[0].vval.v_string;
!   pt = _pt;
!   }
  
if (pt != NULL)
{
char_u *what = get_tv_string([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
*** ../vim-7.4.1841/src/testdir/test_partial.vim2016-05-24 
18:36:48.099153830 +0200
--- src/testdir/test_partial.vim2016-05-24 22:18:05.522971188 +0200
***
*** 282,290 
  
  func Test_get_partial_items()
let dict = {'name': 'hello'}
!   let Cb = function('MyDictFunc', ["foo", "bar"], dict)
!   call assert_equal('MyDictFunc', get(Cb, 'func'))
!   call assert_equal(["foo", "bar"], get(Cb, 'args'))
call assert_equal(dict, get(Cb, 'dict'))
call assert_fails('call get(Cb, "xxx")', 'E475:')
  endfunc
--- 282,299 
  
  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
*** ../vim-7.4.1841/runtime/doc/eval.txt2016-05-24 18:36:48.099153830 
+0200
--- runtime/doc/eval.txt2016-05-24 22:28:44.118962404 +0200
***
*** 1938,1943 
--- 1957,1963 
  garbagecollect([{atexit}])nonefree memory, breaking cyclic references
  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}])
Listlines {lnum} to {end} of buffer {expr}
  getbufvar({expr}, {varname} [, {def}])
***
*** 3721,3729 
Get item with key {key} from |Dictionary| {dict}.  When this
item is not available return {default}.  Return zero when
{default} is omitted.
! get({partial}, {what})
!   Get an item with from Funcref {partial}.  Possible values for
{what} are:
'func'  The function
'dict'  The dictionary
'args'  The list with arguments
--- 3772,3781 
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
*** ../vim-7.4.1841/src/version.c   2016-05-24 19:59:48.207085324 +0200
--- src/version.c   2016-05-24 22:24:08.134966200 +0200
***
*** 755,756 
--- 755,758 
  {   /* Add new patch number below this line */
+ /**/
+ 1842,
  /**/

-- 
Often you're less important than your furniture.  If you think about it, you
can get fired but your furniture stays behind, 

Re: Patch 7.4.1839

2016-05-24 Fir de Conversatie Bram Moolenaar

Nikolay Pavlov wrote:

> 2016-05-24 19:37 GMT+03:00 Bram Moolenaar :
> >
> > Patch 7.4.1839
> > Problem:Cannot get the items stored in a partial.
> > Solution:   Support using get() on a partial.
> > Files:  src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.tx=

[...]

> > +   {what} are:
> > +   'func'  The function
> 
> This should be “the function name” I think. When reading “the
> function” I expect returning funcref. Maybe even this is what should
> actually be returned (I would expect something like “name” key to
> return the function name, “func” sounds like returning a funcref as
> well):

Yeah, when writing this I was also wondering whether to return the name
or something else.  Returning both is the most flexible.

I don't think "subtype" makes sense.  This difference is only used
internally, the help only talks about Funcref, of which partial is a
form where args or dict is bound.  get() already indicates a Funcref is
like a Partial without arguments or dict.

-- 
You have heard the saying that if you put a thousand monkeys in a room with a
thousand typewriters and waited long enough, eventually you would have a room
full of dead monkeys.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [patch] fixed multiplication overflow in term.c:5039 detected by ubsan

2016-05-24 Fir de Conversatie Bram Moolenaar

Dominique wrote:

> Vim-7.4.1841 (and older) built with ubsan (undefined
> sanitizer) on x86 shows a multiplication overflow when
> clicking in the vim terminal for the first time:
> 
> term.c:5039:37: runtime error: signed integer overflow: 1464114431 *
> 1000 cannot be represented in type 'long int'
> 
> Steps to reproduce:
> 
> 1) build vim with ubsan. It can be done by
>uncommenting this line in vim/src/Makefile
> 
> SANITIZER_CFLAGS = -g -O0 -fsanitize=undefined -fno-omit-frame-pointer
> 
> 2) start vim with:
>   $ vim -u NONE --noplugin -c 'set mouse=a' 2> log
> 
> 3) left-click in the terminal with the mouse
> 
> 4) observe the error in 'log' file.
> 
> It happens only on the first click.
> It also only happens on 32-bits Linux x86 and not on x86_64.
> 
> Code at term.c:5039:
> 
>   5030   /*
>   5031* Compute the time elapsed since the previous mouse click.
>   5032*/
>   5033   gettimeofday(_time, NULL);
>   5034   timediff = (mouse_time.tv_usec
>   5035   - orig_mouse_time.tv_usec) / 1000;
>   5036   if (timediff < 0)
>   5037   --orig_mouse_time.tv_sec;
>   5038   timediff += (mouse_time.tv_sec
> !!5039- orig_mouse_time.tv_sec) * 1000;
> 
> Adding printf, I can see that:
> 
> * mouse_time.tv_sec is 1464115088 (this value changes slightly
>   every time I reproduce the bug, as it depends on time)
> * orig_mouse_time.tv_sec is 0
> 
> So the multiplication by 1000 at line 5039 overflows in 32-bits
> on x86. Overflow does not happen on x86_64 as tv_sec is then
> a 64-bits number.
> 
> Attached patch fixes it.

Attachment is missing...

-- 
All good vision statements are created by groups of people with bloated
bladders who would rather be doing anything else.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1836

2016-05-24 Fir de Conversatie Christian Brabandt
Hi Bram!

On Di, 24 Mai 2016, Bram Moolenaar wrote:

> 
> Patch 7.4.1836
> Problem:When using a partial on a dictionary it always gets bound to that
> dictionary.
> Solution:   Make a difference between binding a function to a dictionary
> explicitly or automatically.
> Files:  src/structs.h, src/eval.c, src/testdir/test_partial.vim,
> runtime/doc/eval.txt

Starting with this patch, I see sporadic failures on appveyor:
https://ci.appveyor.com/project/chrisbra/vim/build/1234/job/wlpgqc4vnyvrdgqo
https://ci.appveyor.com/project/chrisbra/vim/build/1239/job/2p6y8dru0sv216dv#L2073
https://ci.appveyor.com/project/chrisbra/vim/build/1238/job/q4e5huq9x6opj6id#L2073


test86:
..\gvim -u dos.vim -U NONE --noplugin --not-a-term "+set ff=unix|f 
test.out|wq"  dostmp\test86.out
522c522
< psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'abcSelfPSA3': 
'abcSelfPSA3Val'}]
---
> psa3(self={"20": 1}): !result: [['abcArgsPSA3'], {'20': 1}


Best,
Christian
-- 
Was ist das Allgemeine?
Der einzelne Fall.
Was ist das Besondere?
Millionen Fälle.
-- Goethe, Maximen und Reflektionen, Nr. 875

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [patch] fixed multiplication overflow in term.c:5039 detected by ubsan

2016-05-24 Fir de Conversatie Nikolay Aleksandrovich Pavlov
2016-05-24 22:24 GMT+03:00 Dominique Pellé :
> Hi
>
> Vim-7.4.1841 (and older) built with ubsan (undefined
> sanitizer) on x86 shows a multiplication overflow when
> clicking in the vim terminal for the first time:
>
> term.c:5039:37: runtime error: signed integer overflow: 1464114431 *
> 1000 cannot be represented in type 'long int'
>
> Steps to reproduce:
>
> 1) build vim with ubsan. It can be done by
>uncommenting this line in vim/src/Makefile
>
> SANITIZER_CFLAGS = -g -O0 -fsanitize=undefined -fno-omit-frame-pointer
>
> 2) start vim with:
>   $ vim -u NONE --noplugin -c 'set mouse=a' 2> log
>
> 3) left-click in the terminal with the mouse
>
> 4) observe the error in 'log' file.
>
> It happens only on the first click.
> It also only happens on 32-bits Linux x86 and not on x86_64.
>
> Code at term.c:5039:
>
>   5030   /*
>   5031* Compute the time elapsed since the previous mouse click.
>   5032*/
>   5033   gettimeofday(_time, NULL);
>   5034   timediff = (mouse_time.tv_usec
>   5035   - orig_mouse_time.tv_usec) / 1000;
>   5036   if (timediff < 0)
>   5037   --orig_mouse_time.tv_sec;
>   5038   timediff += (mouse_time.tv_sec
> !!5039- orig_mouse_time.tv_sec) * 1000;
>
> Adding printf, I can see that:
>
> * mouse_time.tv_sec is 1464115088 (this value changes slightly
>   every time I reproduce the bug, as it depends on time)
> * orig_mouse_time.tv_sec is 0
>
> So the multiplication by 1000 at line 5039 overflows in 32-bits
> on x86. Overflow does not happen on x86_64 as tv_sec is then
> a 64-bits number.
>
> Attached patch fixes it.

I do not see any attachements.

>
> Regards
> Dominique
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups 
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to vim_dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[patch] fixed multiplication overflow in term.c:5039 detected by ubsan

2016-05-24 Fir de Conversatie Dominique Pellé
Hi

Vim-7.4.1841 (and older) built with ubsan (undefined
sanitizer) on x86 shows a multiplication overflow when
clicking in the vim terminal for the first time:

term.c:5039:37: runtime error: signed integer overflow: 1464114431 *
1000 cannot be represented in type 'long int'

Steps to reproduce:

1) build vim with ubsan. It can be done by
   uncommenting this line in vim/src/Makefile

SANITIZER_CFLAGS = -g -O0 -fsanitize=undefined -fno-omit-frame-pointer

2) start vim with:
  $ vim -u NONE --noplugin -c 'set mouse=a' 2> log

3) left-click in the terminal with the mouse

4) observe the error in 'log' file.

It happens only on the first click.
It also only happens on 32-bits Linux x86 and not on x86_64.

Code at term.c:5039:

  5030   /*
  5031* Compute the time elapsed since the previous mouse click.
  5032*/
  5033   gettimeofday(_time, NULL);
  5034   timediff = (mouse_time.tv_usec
  5035   - orig_mouse_time.tv_usec) / 1000;
  5036   if (timediff < 0)
  5037   --orig_mouse_time.tv_sec;
  5038   timediff += (mouse_time.tv_sec
!!5039- orig_mouse_time.tv_sec) * 1000;

Adding printf, I can see that:

* mouse_time.tv_sec is 1464115088 (this value changes slightly
  every time I reproduce the bug, as it depends on time)
* orig_mouse_time.tv_sec is 0

So the multiplication by 1000 at line 5039 overflows in 32-bits
on x86. Overflow does not happen on x86_64 as tv_sec is then
a 64-bits number.

Attached patch fixes it.

Regards
Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1839

2016-05-24 Fir de Conversatie Nikolay Aleksandrovich Pavlov
2016-05-24 19:37 GMT+03:00 Bram Moolenaar :
>
> Patch 7.4.1839
> Problem:Cannot get the items stored in a partial.
> Solution:   Support using get() on a partial.
> Files:  src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.txt
>
>
> *** ../vim-7.4.1838/src/eval.c  2016-05-24 17:33:29.139206088 +0200
> --- src/eval.c  2016-05-24 18:26:06.919162650 +0200
> ***
> *** 12423,12428 
> --- 12423,12467 
> tv = >di_tv;
> }
>   }
> + else if (argvars[0].v_type == VAR_PARTIAL)
> + {
> +   partial_T   *pt = argvars[0].vval.v_partial;
> +
> +   if (pt != NULL)
> +   {
> +   char_u *what = get_tv_string([1]);
> +
> +   if (STRCMP(what, "func") == 0)
> +   {
> +   rettv->v_type = 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_argv[i]);
> +   }
> +   }
> +   else
> +   EMSG2(_(e_invarg2), what);
> +   return;
> +   }
> + }
>   else
> EMSG2(_(e_listdictarg), "get()");
>
> *** ../vim-7.4.1838/src/testdir/test_partial.vim2016-05-24 
> 15:43:46.699296634 +0200
> --- src/testdir/test_partial.vim2016-05-24 18:35:10.563155171 +0200
> ***
> *** 279,281 
> --- 279,290 
> call assert_equal('dict1', dict2.f2())
> call assert_equal('dict1', dict2['f2']())
>   endfunc
> +
> + func Test_get_partial_items()
> +   let dict = {'name': 'hello'}
> +   let Cb = function('MyDictFunc', ["foo", "bar"], dict)
> +   call assert_equal('MyDictFunc', get(Cb, 'func'))
> +   call assert_equal(["foo", "bar"], get(Cb, 'args'))
> +   call assert_equal(dict, get(Cb, 'dict'))
> +   call assert_fails('call get(Cb, "xxx")', 'E475:')
> + endfunc
> *** ../vim-7.4.1838/runtime/doc/eval.txt2016-05-24 17:33:29.143206087 
> +0200
> --- runtime/doc/eval.txt2016-05-24 18:05:54.387179329 +0200
> ***
> *** 3721,3726 
> --- 3771,3782 
> Get item with key {key} from |Dictionary| {dict}.  When this
> item is not available return {default}.  Return zero when
> {default} is omitted.
> + get({partial}, {what})
> +   Get an item with from Funcref {partial}.  Possible values for
> +   {what} are:
> +   'func'  The function

This should be “the function name” I think. When reading “the
function” I expect returning funcref. Maybe even this is what should
actually be returned (I would expect something like “name” key to
return the function name, “func” sounds like returning a funcref as
well):

diff -r bc38030aec7d runtime/doc/eval.txt
--- a/runtime/doc/eval.txt Tue May 24 20:15:05 2016 +0200
+++ b/runtime/doc/eval.txt Tue May 24 22:40:44 2016 +0300
@@ -1953,10 +1953,11 @@
 foldtextresult({lnum}) String text for closed fold at {lnum}
 foreground() Number bring the Vim window to the foreground
 function({name} [, {arglist}] [, {dict}])
- Funcref reference to function {name}
+ Funcref reference to function {name}
 garbagecollect([{atexit}]) none free memory, breaking cyclic references
 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}])
@@ -3771,12 +3772,14 @@
  Get item with key {key} from |Dictionary| {dict}.  When this
  item is not available return {default}.  Return zero when
  {default} is omitted.
-get({partial}, {what})
- Get an item with from Funcref {partial}.  Possible values for
+get({func}, {what})
+ Get an item with from |Funcref| {func}.  Possible values for
  {what} are:
- 'func' The function
- 'dict' The dictionary
- 'args' The list with arguments
+ "func" The function
+ "name" The function name
+ "dict" The dictionary
+ "args" The list with arguments
+ "subtype" "partial" or "funcref"

  *getbufline()*
 getbufline({expr}, {lnum} [, {end}])
diff -r bc38030aec7d src/eval.c
--- a/src/eval.c Tue May 24 20:15:05 2016 +0200
+++ b/src/eval.c Tue May 24 

Patch 7.4.1841

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1841
Problem:The code to reallocate the buffer used for quickfix is repeated.
Solution:   Move the code to a function. (Yegappan Lakshmanan, closes #831)
Files:  src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-7.4.1840/src/quickfix.c  2016-05-08 12:51:57.436135992 +0200
--- src/quickfix.c  2016-05-24 19:59:42.151085408 +0200
***
*** 179,184 
--- 179,209 
   */
  #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,561 
  
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;
}
else
{
--- 563,572 
  
if (len > IOSIZE - 2)
{
!   linebuf = qf_grow_linebuf(, , len,
!   );
!   if (linebuf == NULL)
!   goto qf_init_end;
}
else
{
***
*** 584,605 
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;
}
else
{
--- 595,604 
len = (int)STRLEN(p_li->li_tv.vval.v_string);
if (len > IOSIZE - 2)
{
!   linebuf = qf_grow_linebuf(, , len,
!   );
!   if (linebuf == NULL)
!   goto qf_init_end;
}
else
{
***
*** 621,640 
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;
}
else
linebuf = IObuff;
--- 620,629 
linelen = (int)STRLEN(p_buf);
if (linelen > IOSIZE - 2)
{
!   linebuf = 

Patch 7.4.1840

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1840
Problem:When using packages an "after" directory cannot be used.
Solution:   Add the "after" directory of the package to 'runtimepath' if it
exists.
Files:  src/ex_cmds2.c, src/testdir/test_packadd.vim


*** ../vim-7.4.1839/src/ex_cmds2.c  2016-05-17 17:45:24.307426095 +0200
--- src/ex_cmds2.c  2016-05-24 19:28:55.735110807 +0200
***
*** 3326,3338 
  int   keep;
  int   oldlen;
  int   addlen;
  char_u  *ffname = fix_fname(fname);
  
  if (ffname == NULL)
return;
  if (cookie != _LOAD && strstr((char *)p_rtp, (char *)ffname) == NULL)
  {
!   /* directory not 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))
--- 3326,3340 
  int   keep;
  int   oldlen;
  int   addlen;
+ char_u  *afterdir;
+ int   afterlen = 0;
  char_u  *ffname = fix_fname(fname);
  
  if (ffname == NULL)
return;
  if (cookie != _LOAD && strstr((char *)p_rtp, (char *)ffname) == NULL)
  {
!   /* 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))
***
*** 3360,3379 
}
*p4 = c;
  
oldlen = (int)STRLEN(p_rtp);
!   addlen = (int)STRLEN(ffname);
!   new_rtp = alloc(oldlen + addlen + 2);
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);
if (p_rtp[keep] != NUL)
!   mch_memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
   oldlen - keep + 1);
set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
vim_free(new_rtp);
  }
  
  if (cookie != _ADD_DIR)
--- 3362,3392 
}
*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) + 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);
if (p_rtp[keep] != NUL)
!   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 != _ADD_DIR)
*** ../vim-7.4.1839/src/testdir/test_packadd.vim2016-04-05 
21:12:55.975983365 +0200
--- src/testdir/test_packadd.vim2016-05-24 19:30:39.127109384 +0200
***
*** 13,18 
--- 13,19 
  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 = 
filetype on
***
*** 35,41 
call assert_equal(77, g:plugin_also_works)
call assert_equal(17, g:ftdetect_works)
call assert_true(len() > len(rtp))
!   call assert_true( =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
  
" Check exception
call assert_fails("packadd directorynotfound", 'E919:')
--- 36,43 
call assert_equal(77, g:plugin_also_works)
call assert_equal(17, g:ftdetect_works)
call assert_true(len() > len(rtp))
!   call assert_true( =~ '/testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
!   call assert_true( =~ '/testdir/Xdir/pack/mine/opt/mytest/after$')
  
" Check exception
call assert_fails("packadd directorynotfound", 'E919:')
*** ../vim-7.4.1839/src/version.c   2016-05-24 18:36:48.103153830 +0200
--- src/version.c   2016-05-24 19:36:41.471104400 +0200
***
*** 755,756 
--- 755,758 
  {   /* Add new patch number below this line */
+ /**/
+ 1840,
  /**/

-- 
An operatingsystem is just a name you give to the rest of bloating
idiosyncratic machine-based-features you left out of your editor.
(author unknown)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- 

Patch 7.4.1839

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1839
Problem:Cannot get the items stored in a partial.
Solution:   Support using get() on a partial.
Files:  src/eval.c, src/testdir/test_partial.vim, runtime/doc/eval.txt


*** ../vim-7.4.1838/src/eval.c  2016-05-24 17:33:29.139206088 +0200
--- src/eval.c  2016-05-24 18:26:06.919162650 +0200
***
*** 12423,12428 
--- 12423,12467 
tv = >di_tv;
}
  }
+ else if (argvars[0].v_type == VAR_PARTIAL)
+ {
+   partial_T   *pt = argvars[0].vval.v_partial;
+ 
+   if (pt != NULL)
+   {
+   char_u *what = get_tv_string([1]);
+ 
+   if (STRCMP(what, "func") == 0)
+   {
+   rettv->v_type = 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_argv[i]);
+   }
+   }
+   else
+   EMSG2(_(e_invarg2), what);
+   return;
+   }
+ }
  else
EMSG2(_(e_listdictarg), "get()");
  
*** ../vim-7.4.1838/src/testdir/test_partial.vim2016-05-24 
15:43:46.699296634 +0200
--- src/testdir/test_partial.vim2016-05-24 18:35:10.563155171 +0200
***
*** 279,281 
--- 279,290 
call assert_equal('dict1', dict2.f2())
call assert_equal('dict1', dict2['f2']())
  endfunc
+ 
+ func Test_get_partial_items()
+   let dict = {'name': 'hello'}
+   let Cb = function('MyDictFunc', ["foo", "bar"], dict)
+   call assert_equal('MyDictFunc', get(Cb, 'func'))
+   call assert_equal(["foo", "bar"], get(Cb, 'args'))
+   call assert_equal(dict, get(Cb, 'dict'))
+   call assert_fails('call get(Cb, "xxx")', 'E475:')
+ endfunc
*** ../vim-7.4.1838/runtime/doc/eval.txt2016-05-24 17:33:29.143206087 
+0200
--- runtime/doc/eval.txt2016-05-24 18:05:54.387179329 +0200
***
*** 3721,3726 
--- 3771,3782 
Get item with key {key} from |Dictionary| {dict}.  When this
item is not available return {default}.  Return zero when
{default} is omitted.
+ get({partial}, {what})
+   Get an item with from Funcref {partial}.  Possible values for
+   {what} are:
+   'func'  The function
+   'dict'  The dictionary
+   'args'  The list with arguments
  
*getbufline()*
  getbufline({expr}, {lnum} [, {end}])
*** ../vim-7.4.1838/src/version.c   2016-05-24 17:33:29.143206087 +0200
--- src/version.c   2016-05-24 18:01:48.043182718 +0200
***
*** 755,756 
--- 755,758 
  {   /* Add new patch number below this line */
+ /**/
+ 1839,
  /**/

-- 
Never enter the boss's office unless it's absolutely necessary.  Every boss
saves one corner of the desk for useless assignments that are doled out like
Halloween candy to each visitor.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [vim/vim] ":tab Foo" does not work for user commands (#802)

2016-05-24 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Tue, May 24, 2016 at 7:01 AM, Yegappan Lakshmanan
 wrote:
> Hi Bram,
>
> On Mon, May 23, 2016 at 12:57 PM, Bram Moolenaar  wrote:
>>> >> >
>>> >> > We could make the modifiers available in <> form, so that the user
>>> >> > command can apply them where needed. Possibly just , to pass on
>>> >> > all modifiers.
>>> >>
>>> >> The attached patch adds support for the  user command escape
>>> >> sequence.
>>> >
>>> > Thanks.  It would be nice if the help has an example that shows how the
>>> > modifiers are applied to only one of the commands.  E.g. do something
>>> > else before the "split".
>>> >
>>>
>>> We can use the example quoted by the OP:
>>>
>>>   :command! -nargs=1 Foo  split 
>>>
>>> Now the ":tab Foo bar" command will open the file in a new tab.
>>
>> It would be clearer if there is another command before or after the
>> "split".  E.g.
>>  split  | edit Results
>> So that we see that  only applies to "split", not to "edit".
>>
>
> The above command will always load the file named Results.
> How about this example?
>
> command! -nargs=+ -complete=file MyEdit for f in expand(, 0,
> 1) | exe ' split ' . f | endfor
>
> This command opens one or more files in a new split window. If the
> command modifiers like "vert" or "tab" are specified, then it opens them
> in a vertically split windows or tab pages.
>

And the below example for :

function! SpecialEdit(files, mods)
for f in expand(a:files, 0, 1)
   exe a:mods . ' split ' . f
endfor
endfunction

command! -nargs=+ -complete=file Sedit
 \ call SpecialEdit(, )

- Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1836

2016-05-24 Fir de Conversatie Bram Moolenaar

I wrote:

> Patch 7.4.1836
> Problem:When using a partial on a dictionary it always gets bound to that
> dictionary.
> Solution:   Make a difference between binding a function to a dictionary
> explicitly or automatically.
> Files:  src/structs.h, src/eval.c, src/testdir/test_partial.vim,
> runtime/doc/eval.txt

I hope this doesn't break anything.  At least code that was written
before Partials were introduced.

I hope it's not too difficult to understand:
- When using dict.member the dict is bound automatically to member
- When using function() to bind a dict that dict is kept and not change
  by automatic binding.

It might be useful to add some more explanation in the documentation.
Let me know if you have a suggestion.

-- 
The process for understanding customers primarily involves sitting around with
other marketing people and talking about what you would to if you were dumb
enough to be a customer.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.1838

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1838
Problem:Functions specifically for testing do not sort together.
Solution:   Rename garbagecollect_for_testing() to test_garbagecollect_now().
Add test_null_list(), test_null_dict(), etc.
Files:  src/eval.c, src/testdir/test_expr.vim,
src/testdir/test_channel.vim, runtime/doc/eval.txt


*** ../vim-7.4.1837/src/eval.c  2016-05-24 15:43:46.699296634 +0200
--- src/eval.c  2016-05-24 16:26:04.979261718 +0200
***
*** 583,589 
  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);
--- 583,588 
***
*** 806,812 
  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);
  #ifdef FEAT_FLOAT
  static void f_tan(typval_T *argvars, typval_T *rettv);
  static void f_tanh(typval_T *argvars, typval_T *rettv);
--- 805,821 
  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_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,6931 
  
  /*
   * Do garbage collection for lists and dicts.
!  * When "testing" is TRUE this is called from garbagecollect_for_testing().
   * Return TRUE if some memory was freed.
   */
  int
--- 6934,6940 
  
  /*
   * Do garbage collection for lists and dicts.
!  * When "testing" is TRUE this is called from test_garbagecollect_now().
   * Return TRUE if some memory was freed.
   */
  int
***
*** 8451,8457 
  {"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},
--- 8460,8465 
***
*** 8681,8687 
  {"tanh",  1, 1, f_tanh},
  #endif
  {"tempname",  0, 0, f_tempname},
! {"test",  1, 1, f_test},
  #ifdef FEAT_TIMERS
  {"timer_start",   2, 3, f_timer_start},
  {"timer_stop",1, 1, f_timer_stop},
--- 8689,8705 
  {"tanh",  1, 1, f_tanh},
  #endif
  {"tempname",  0, 0, f_tempname},
! {"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},
***
*** 12374,12390 
  }
  
  /*
-  * "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
   */
  static void
--- 12392,12397 
***
*** 20602,20636 
  } 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)
-   

Patch 7.4.1837

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1837
Problem:The BufUnload event is triggered twice, when :bunload is used with
`bufhidden` set to `unload` or `delete`.
Solution:   Do not trigger the event when ml_mfp is NULL. (Hirohito Higashi)
Files:  src/buffer.c, src/testdir/test_autocmd.vim


*** ../vim-7.4.1836/src/buffer.c2016-05-09 20:38:48.576112188 +0200
--- src/buffer.c2016-05-24 16:05:07.911279010 +0200
***
*** 574,582 
  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 ((flags & BFA_DEL) && buf->b_p_bl)
  {
apply_autocmds(EVENT_BUFDELETE, buf->b_fname, buf->b_fname, FALSE, buf);
--- 574,585 
  int   is_curbuf = (buf == curbuf);
  
  buf->b_closing = TRUE;
! 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);
*** ../vim-7.4.1836/src/testdir/test_autocmd.vim2016-04-20 
20:18:16.957270339 +0200
--- src/testdir/test_autocmd.vim2016-05-24 16:04:28.091279558 +0200
***
*** 7,35 
" becomes one.
  endfunc
  
! if !has('timers')
!   finish
  endif
  
! func ExitInsertMode(id)
!   call feedkeys("\")
! 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\", 'x!')
!   call assert_equal(0, g:triggered)
  endfunc
--- 7,62 
" becomes one.
  endfunc
  
! if has('timers')
!   func ExitInsertMode(id)
! call feedkeys("\")
!   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\", 'x!')
! call assert_equal(0, g:triggered)
!   endfunc
  endif
  
! 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
  
!   let s:li=[]
!   new
!   setlocal bufhidden=
!   bunload
!   call assert_equal(["bufunload", "bufdelete"], s:li)
! 
!   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
*** ../vim-7.4.1836/src/version.c   2016-05-24 15:43:46.703296634 +0200
--- src/version.c   2016-05-24 16:04:04.311279885 +0200
***
*** 755,756 
--- 755,758 
  {   /* Add new patch number below this line */
+ /**/
+ 1837,
  /**/

-- 
If someone questions your market projections, simply point out that your
target market is "People who are nuts" and "People who will buy any damn
thing".  Nobody is going to tell you there aren't enough of those people
to go around.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [vim/vim] ":tab Foo" does not work for user commands (#802)

2016-05-24 Fir de Conversatie Yegappan Lakshmanan
Hi Bram,

On Mon, May 23, 2016 at 12:57 PM, Bram Moolenaar  wrote:
>> >> >
>> >> > We could make the modifiers available in <> form, so that the user
>> >> > command can apply them where needed. Possibly just , to pass on
>> >> > all modifiers.
>> >>
>> >> The attached patch adds support for the  user command escape
>> >> sequence.
>> >
>> > Thanks.  It would be nice if the help has an example that shows how the
>> > modifiers are applied to only one of the commands.  E.g. do something
>> > else before the "split".
>> >
>>
>> We can use the example quoted by the OP:
>>
>>   :command! -nargs=1 Foo  split 
>>
>> Now the ":tab Foo bar" command will open the file in a new tab.
>
> It would be clearer if there is another command before or after the
> "split".  E.g.
>  split  | edit Results
> So that we see that  only applies to "split", not to "edit".
>

The above command will always load the file named Results.
How about this example?

command! -nargs=+ -complete=file MyEdit for f in expand(, 0,
1) | exe ' split ' . f | endfor

This command opens one or more files in a new split window. If the
command modifiers like "vert" or "tab" are specified, then it opens them
in a vertically split windows or tab pages.

- Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.1836

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1836
Problem:When using a partial on a dictionary it always gets bound to that
dictionary.
Solution:   Make a difference between binding a function to a dictionary
explicitly or automatically.
Files:  src/structs.h, src/eval.c, src/testdir/test_partial.vim,
runtime/doc/eval.txt


*** ../vim-7.4.1835/src/structs.h   2016-05-09 17:57:59.810722519 +0200
--- src/structs.h   2016-05-24 13:13:50.267420387 +0200
***
*** 1261,1266 
--- 1261,1268 
  {
  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" */
*** ../vim-7.4.1835/src/eval.c  2016-05-15 18:00:11.510811069 +0200
--- src/eval.c  2016-05-24 15:37:25.719301875 +0200
***
*** 9069,9082 
  
  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;
!   }
if (error == ERROR_NONE && partial->pt_argc > 0)
{
for (argv_clear = 0; argv_clear < partial->pt_argc; ++argv_clear)
--- 9069,9080 
  
  if (partial != NULL)
  {
!   /* 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,12341 
--- 12328,12343 
 * 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;
}
***
*** 22279,22286 
}
  }
  
! if ((rettv->v_type == VAR_FUNC || rettv->v_type == VAR_PARTIAL)
! && selfdict != NULL)
  {
char_u  *fname = rettv->v_type == VAR_FUNC ? rettv->vval.v_string
 : rettv->vval.v_partial->pt_name;
--- 22281,22294 
}
  }
  
! /* 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;
***
*** 22294,22300 
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));
--- 22302,22307 
***
*** 22303,22308 
--- 22310,22316 
{
pt->pt_refcount = 1;
pt->pt_dict = selfdict;
+   pt->pt_auto = TRUE;
selfdict = NULL;
if (rettv->v_type == VAR_FUNC)
{
*** ../vim-7.4.1835/src/testdir/test_partial.vim2016-04-08 
17:25:15.198702510 +0200
--- src/testdir/test_partial.vim2016-05-24 15:41:07.923298818 +0200
***
*** 257,259 
--- 257,281 
  call job_setoptions(g:ref_job, {'exit_cb': function('string', [], d)})
endif
  endfunc
+ 
+ func Test_auto_partial_rebind()
+   let dict1 = {'name': 'dict1'}
+  

Re: Patch 7.4.1834

2016-05-24 Fir de Conversatie Bram Moolenaar

Christian Brabandt wrote:

> On Di, 24 Mai 2016, Bram Moolenaar wrote:
> 
> > 
> > Patch 7.4.1834
> > Problem:Possible crash when conceal is active.
> > Solution:   Check for the screen to be valid when redrawing a line.
> > Files:  src/screen.c
> 
> I thought, this didn't fix the crash?

No, but I had it sitting there and thought it would be useful to include
anyway.

-- 
Q:  What's a light-year?
A:  One-third less calories than a regular year.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.1835

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1835
Problem:When splitting and closing a window the status height changes.
Solution:   Compute the frame height correctly. (Hirohito Higashi)
Files:  src/window.c, src/testdir/test_alot.vim,
src/testdir/test_window_cmd.vim


*** ../vim-7.4.1834/src/window.c2016-04-03 21:22:53.246228473 +0200
--- src/window.c2016-05-24 11:24:28.151510654 +0200
***
*** 1165,1172 
 * 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);
else
win_new_height(oldwin, oldwin_height - (new_size + STATUS_HEIGHT));
if (before) /* new window above current one */
--- 1165,1177 
 * one row for the status line */
win_new_height(wp, new_size);
if (flags & (WSP_TOP | WSP_BOT))
!   {
!   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,1196 
{
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)
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))
--- 1184,1196 
{
wp->w_winrow = oldwin->w_winrow + oldwin->w_height + STATUS_HEIGHT;
wp->w_status_height = oldwin->w_status_height;
!   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 (flags & (WSP_TOP | WSP_BOT))
*** ../vim-7.4.1834/src/testdir/test_alot.vim   2016-04-20 16:19:10.030987632 
+0200
--- src/testdir/test_alot.vim   2016-05-24 11:22:57.267511905 +0200
***
*** 32,34 
--- 32,35 
  source test_timers.vim
  source test_undolevels.vim
  source test_unlet.vim
+ source test_window_cmd.vim
*** ../vim-7.4.1834/src/testdir/test_window_cmd.vim 2016-05-24 
11:29:44.927506297 +0200
--- src/testdir/test_window_cmd.vim 2016-05-24 11:23:26.679511500 +0200
***
*** 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,  -  - winheight(0))
+   new | only!
+   "
+   set splitbelow
+   botright split
+   quit
+   call assert_equal(0,  -  - winheight(0))
+   new | only!
+   set ls
+ 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:\")
+ let ac =  - ( + winheight(0) + !!v)
+ let emsg = printf(efmt, ac, v, 'left')
+ call assert_equal(0, ac, emsg)
+ wincmd w
+ let ac =  - ( + winheight(0) + !!v)
+ let emsg = printf(efmt, ac, v, 'right')
+ call assert_equal(0, ac, emsg)
+ new | only!
+   endfor
+   set ls
+ endfunc
+ 
+ " vim: sw=2 et
*** ../vim-7.4.1834/src/version.c   2016-05-24 10:51:26.543537913 +0200
--- src/version.c   2016-05-24 11:25:18.467509962 +0200
***
*** 755,756 
--- 755,758 
  {   /* Add new patch number below this line */
+ /**/
+ 1835,
  /**/

-- 
No engineer can take a shower without wondering if some sort of Teflon coating
would make showering unnecessary.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 

Re: [patch] fix :split with laststatus=0 issues

2016-05-24 Fir de Conversatie Bram Moolenaar

Hirohito Higashi wrote:

> Hi Bram and Vimmers,
> 
> I have received reports of problems related to :split and laststatus=0.
> 
> I was confirmed by CUI Vim 7.4.1832 on fedora 23 via PuTTY (80x24)
> 
> Issue 1:
> - Start pure Vim with some options.
>   $ vim -Nu NONE -c "set ls=0 splitbelow"
> - Check window height.
>   :echo winheight(0)
>   23
> - split and quit window.
>   :sp | q
> - Recheck window height.
>   :echo winheight(0)
> 
>   Expected value: 23
>   Actual value:   22 and command-line line has moved up by one line.
> 
> 
> Issue 2:
> - Start pure Vim with some options.
>   $ vim -Nu NONE -c "set ls=0"
> - Split window.
>   :botright sp
> - Type `:`.
>   Expected behavior:
>   - Cursor move to last line.  Because 'cmdheight' is 1 (default).
>   Actual behavior:
>   - Cursor has moved to the second from the bottom.  It's wrong.
> 
> 
> Issue 3:
> - Start pure Vim with some options.
>   $ vim -Nu NONE -c "set ls=0"
> - Vertical split window.
>   :vsp
> - Open command-line window.
>   q:
>   Expected behavior:
>   - Command line window is opened.
>   Actual behavior:
>   - Likewise opened, but obviously the second line from the bottom strange.
> 
> 
> REMARKS:
> The issue 3 is related to the following patch and thread.
> 
> patch 7.4.706
> https://github.com/vim/vim/commit/5b14f89164fa2f40f52283226c98005887568317
> 
> Re: [bug] cmdline-window given laststatus=0 and vertical split
> https://groups.google.com/forum/#!searchin/vim_dev/Yclept$20Nemo/vim_dev/fNq8tHTcKfA/7yg4GZ1h8agJ
> 
> I think patch 7.4.706 is no good solution.
> This patch is updating the window information after updating the frame 
> information.
> It generates a Inconsistencies between the frame information and the window 
> information, and It cause abnormal window drawing.
> 
> I wrote a patch to fix above all issues.  Of course, the test was also added.
> Please check an attached patch.

Thanks!

-- 
It doesn't really matter what you are able to do if you don't do it.
(Bram Moolenaar)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Patch 7.4.1834

2016-05-24 Fir de Conversatie Christian Brabandt
Hi Bram!

On Di, 24 Mai 2016, Bram Moolenaar wrote:

> 
> Patch 7.4.1834
> Problem:Possible crash when conceal is active.
> Solution:   Check for the screen to be valid when redrawing a line.
> Files:  src/screen.c

I thought, this didn't fix the crash?

Best,
Christian
-- 
Wenn dich einer in Hast fragt,
so antworte ihm langsam.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.1834

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1834
Problem:Possible crash when conceal is active.
Solution:   Check for the screen to be valid when redrawing a line.
Files:  src/screen.c


*** ../vim-7.4.1833/src/screen.c2016-04-29 22:58:25.622876633 +0200
--- src/screen.c2016-05-08 21:05:44.131944690 +0200
***
*** 801,806 
--- 801,810 
  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, _foldinfo) == 0)
  {
*** ../vim-7.4.1833/src/version.c   2016-05-24 10:46:41.659541832 +0200
--- src/version.c   2016-05-24 10:50:48.147538441 +0200
***
*** 755,756 
--- 755,758 
  {   /* Add new patch number below this line */
+ /**/
+ 1834,
  /**/

-- 
Imagine a world without hypothetical situations.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.1833

2016-05-24 Fir de Conversatie Bram Moolenaar

Patch 7.4.1833
Problem:Cannot use an Ex command for 'keywordprg'.
Solution:   Accept an Ex command. (Nelo-Thara Wallus)
Files:  src/normal.c, runtime/doc/options.txt


*** ../vim-7.4.1832/src/normal.c2016-04-16 09:13:31.538407268 +0200
--- src/normal.c2016-05-24 10:24:39.207560023 +0200
***
*** 5485,5494 
  {
  char_u*ptr = NULL;
  char_u*buf;
  char_u*newbuf;
  char_u*p;
  char_u*kp;/* value of 'keywordprg' */
! int   kp_help;/* 'keywordprg' is ":help" */
  int   n = 0;  /* init for GCC */
  int   cmdchar;
  int   g_cmd;  /* "g" command */
--- 5485,5496 
  {
  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 ":he" */
! int   kp_ex;  /* 'keywordprg' starts with ":" */
  int   n = 0;  /* init for GCC */
  int   cmdchar;
  int   g_cmd;  /* "g" command */
***
*** 5536,5542 
  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)));
  if (buf == NULL)
return;
  buf[0] = NUL;
--- 5538,5546 
  kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp);
  kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0
 || STRCMP(kp, ":help") == 0);
! kp_ex = (*kp == ':');
! buflen = (unsigned)(n * 2 + 30 + STRLEN(kp));
! buf = alloc(buflen);
  if (buf == NULL)
return;
  buf[0] = NUL;
***
*** 5562,5567 
--- 5566,5580 
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
*** ../vim-7.4.1832/runtime/doc/options.txt 2016-05-11 21:04:59.804470690 
+0200
--- runtime/doc/options.txt 2016-05-24 10:16:12.283566996 +0200
***
*** 4591,4606 
  
*'keywordprg'* *'kp'*
  'keywordprg' 'kp' string  (default "man" or "man -s",  DOS: ":help",
!   OS/2: "view /", 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.
See |option-backslash| about including spaces and backslashes.
Example: >
:set keywordprg=man\ -s
--- 4587,4604 
  
*'keywordprg'* *'kp'*
  'keywordprg' 'kp' string  (default "man" or "man -s",  DOS: ":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 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
*** ../vim-7.4.1832/src/version.c   2016-05-17 17:45:24.307426095 +0200
--- src/version.c   2016-05-24 10:26:32.099558470 +0200
***
*** 755,756 
--- 755,758 
  {   /* Add new patch number below this line */
+ /**/
+ 1833,
  /**/

-- 
Engineers 

[patch] fix :split with laststatus=0 issues

2016-05-24 Fir de Conversatie h_east
Hi Bram and Vimmers,

I have received reports of problems related to :split and laststatus=0.

I was confirmed by CUI Vim 7.4.1832 on fedora 23 via PuTTY (80x24)

Issue 1:
- Start pure Vim with some options.
  $ vim -Nu NONE -c "set ls=0 splitbelow"
- Check window height.
  :echo winheight(0)
  23
- split and quit window.
  :sp | q
- Recheck window height.
  :echo winheight(0)

  Expected value: 23
  Actual value:   22 and command-line line has moved up by one line.


Issue 2:
- Start pure Vim with some options.
  $ vim -Nu NONE -c "set ls=0"
- Split window.
  :botright sp
- Type `:`.
  Expected behavior:
  - Cursor move to last line.  Because 'cmdheight' is 1 (default).
  Actual behavior:
  - Cursor has moved to the second from the bottom.  It's wrong.


Issue 3:
- Start pure Vim with some options.
  $ vim -Nu NONE -c "set ls=0"
- Vertical split window.
  :vsp
- Open command-line window.
  q:
  Expected behavior:
  - Command line window is opened.
  Actual behavior:
  - Likewise opened, but obviously the second line from the bottom strange.


REMARKS:
The issue 3 is related to the following patch and thread.

patch 7.4.706
https://github.com/vim/vim/commit/5b14f89164fa2f40f52283226c98005887568317

Re: [bug] cmdline-window given laststatus=0 and vertical split
https://groups.google.com/forum/#!searchin/vim_dev/Yclept$20Nemo/vim_dev/fNq8tHTcKfA/7yg4GZ1h8agJ

I think patch 7.4.706 is no good solution.
This patch is updating the window information after updating the frame 
information.
It generates a Inconsistencies between the frame information and the window 
information, and It cause abnormal window drawing.

I wrote a patch to fix above all issues.  Of course, the test was also added.
Please check an attached patch.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/Makefile b/src/Makefile
index b3b8daf..2e8665a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2057,6 +2057,7 @@ test_arglist \
 	test_viminfo \
 	test_viml \
 	test_visual \
+	test_window_cmd \
 	test_window_id \
 	test_alot_latin \
 	test_alot_utf8 \
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index 6bfd81e..d8d460a 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -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
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
new file mode 100644
index 000..d7e432d
--- /dev/null
+++ b/src/testdir/test_window_cmd.vim
@@ -0,0 +1,36 @@
+" 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,  -  - winheight(0))
+  new | only!
+  "
+  set splitbelow
+  botright split
+  quit
+  call assert_equal(0,  -  - winheight(0))
+  new | only!
+  set ls
+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:\")
+let ac =  - ( + winheight(0) + !!v)
+let emsg = printf(efmt, ac, v, 'left')
+call assert_equal(0, ac, emsg)
+wincmd w
+let ac =  - ( + winheight(0) + !!v)
+let emsg = printf(efmt, ac, v, 'right')
+call assert_equal(0, ac, emsg)
+new | only!
+  endfor
+  set ls
+endfunc
+" vim: sw=2 et
diff --git a/src/window.c b/src/window.c
index bbd0a52..01da765 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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 & 

Allow ex-commands in keyworgprg

2016-05-24 Fir de Conversatie Nelo-Thara Wallus
Attached is a modified patch from justinmk for neovim that allows other
ex-commands besides :help to be used in keywordprg.

E.g.

ru plugin/manpager.vim
set keywordprg=:Man

would open man pages in a split when 'K' is pressed over a keyword
instead of opening it in a pager, instead of relying on hacky maps from
plugins.

The original functionality is otherwise preserved.

My C isn't particularly good, but I tried to fit the patch to the
existing code style and to make as few changes as possible.

Especially the changes from L5560 to L5559 could probably be written
better.

Best regards,
Nelo-T. Wallus

--
Viktoriastrasse 22
76133 Karlsruhe
Nr.:0721 / 96 55 63 95
Handy:  0178 / 53 17 067
Web:https://nelo.wallus.de/
/"\  ASCII Ribbon Campaign
\ /  - against HTML emails
 X   - against proprietory attachments
/ \  http://en.wikipedia.org/wiki/ASCII_Ribbon_Campaign

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
>From a7300f13c798f5913ba7359e0c417e18ee4b3351 Mon Sep 17 00:00:00 2001
From: Nelo Wallus 
Date: Sat, 21 May 2016 08:06:12 +0200
Subject: [PATCH] Allow ex commands in keywordprg

Modified patch from justinmk neovim 998d0ffc09d5c7358db62dc88c2e2b87622f60b5

Neovim-specific changes were removed, minor changes to fit to the
existing code style.

Allows all ex commands to be used in keywordprg instead of just :help.

Original:
https://github.com/neovim/neovim/pull/1878/commits/998d0ffc09d5c7358db62dc88c2e2b87622f60b5
---
 runtime/doc/options.txt |  8 +---
 runtime/doc/various.txt | 11 +++
 src/normal.c| 16 ++--
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index aefbdbf..cdca1df 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4594,9 +4594,11 @@ A jump table for the options with a short description can be found at |Q_op|.
 	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
+	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.
 	See |option-backslash| about including spaces and backslashes.
 	Example: >
 		:set keywordprg=man\ -s
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 7510210..f846537 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -607,13 +607,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 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
diff --git a/src/normal.c b/src/normal.c
index 7c15c15..1030a43 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -5488,7 +5488,7 @@ nv_ident(cmdarg_T *cap)
 char_u	*newbuf;
 char_u	*p;
 char_u	*kp;		/* value of 'keywordprg' */
-int		kp_help;	/* 'keywordprg' is ":help" */
+int		kp_ex;		/* 'keywordprg' is an ex command */
 int		n = 0;		/* init for GCC */
 int		cmdchar;
 int		g_cmd;		/* "g" command */
@@ -5534,8 +5534,7 @@ nv_ident(cmdarg_T *cap)
  * double the length of the word.  p_kp / curbuf->b_p_kp could be added
  * and some numbers. */
 kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp);
-kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0
-		 || STRCMP(kp, ":help") == 0);
+kp_ex = (STRNCMP(kp, ":", 1) == 0);