Re: Patch 8.0.0105

2016-11-29 Fir de Conversatie skywind3000
Bram Moolenaar wrote:
> Patch 8.0.0105
> Problem:When using ch_read() with zero timeout, can't tell the difference
> between reading an empty line and nothing available.
> Solution:   Add ch_canread().
> Files:  src/evalfunc.c, src/channel.c, src/proto/channel.pro,
> src/testdir/test_channel.vim, src/testdir/shared.vim,
> runtime/doc/eval.txt, runtime/doc/channel.txt

This is fabulous, thanks for ch_canread()
However, a lot of messages are still dropped in spite of adding a sleep before 
exiting:

-
timerjob.vim
-
function! MyTimer(id)
let ch = job_getchannel(g:job)
let st = ch_status(ch)
if st == "fail" || st == "closed"
return
endif
if ch_canread(ch)
let text = ch_read(ch, {'timeout':0})
caddexpr text
cbottom
endif
endfunc

" according to channel.txt, add a close callback
function! MyClose(channel)
caddexpr "[channel closed]"
cbottom
endfunc

copen 8
cexpr "[python output]"
wincmd k

let cmd = ['/usr/bin/python', 'timerjob.py']
let opt = {"out_io": "pipe", "err_io": "out", "close_cb": "MyClose"}

let job = job_start(cmd, opt)
let timer = timer_start(10, "MyTimer", {"repeat":-1})

-
timerjob.py
-
#! /usr/bin/env python2
import sys, time

for i in xrange(8):
sys.stdout.write('timer job: this is line %d\n'%(i))
sys.stdout.flush()

# as channel.txt said, we need a sleep here
time.sleep(1)

-
output in quickfix
-
|| [python output]
|| timer job: this is line 0
|| timer job: this is line 1
|| timer job: this is line 2
|| timer job: this is line 3
|| timer job: this is line 4
|| timer job: this is line 5
.
|| timer job: this is line 57
|| timer job: this is line 58
|| timer job: this is line 59
|| timer job: this is line 60
|| timer job: this is line 61
|| [channel closed]

Only 62 messages have been received, almost 8 - 62 = 79938 messages have 
been dropped.

I can sleep longer in timerjob.py, but I can't add a single sleep if I start 
grep as a job. And I can't decide how long should I sleep to avoid dropping.




-- 
-- 
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: backupext option

2016-11-29 Fir de Conversatie 'Jeff' via vim_dev
Thanks for the clarification.  I guess what threw me was that the
backupext documentation says that only "/\*?[|<>" are illegal.  So
according to that a semicolon should be good :)

On 11/29/2016 4:11 PM, Bram Moolenaar wrote:
> 
> Jeff wrote:
> 
>> I think there might be an issue with the backupext option after the
>> latest patches were applied.  My Vim version is version 8.0 which
>> includes patches 1 through 104.
>>
>> I use to be able to set backupext with "set backupext=;1".  Now I get a
>> E474 error.
>>
>> E474: Invalid argument: backupext=;1
>>
>> Any ideas?
> 
> This was done intentionally to avoid weird characters to end up in
> option values.  I suppose it would be OK to use a semicolon if you
> really want to.
> 

-- 
-- 
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 typo in runtime/doc/channel.txt

2016-11-29 Fir de Conversatie Dominique Pellé
Hi

Attached patch fixes a typo in runtime/doc/channel.txt

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.
diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt
index 2c3f837..dd9f643 100644
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -638,7 +638,7 @@ See |job_setoptions()| and |ch_setoptions()|.
 "channel": {channel}	Use an existing channel instead of creating a new one.
 			The parts of the channel that get used for the new job
 			will be disconnected from what they were used before.
-			If the channel was still use by another job this may
+			If the channel was still used by another job this may
 			cause I/O errors.
 			Existing callbacks and other settings remain.
 


Patch 8.0.0106

2016-11-29 Fir de Conversatie Bram Moolenaar

Patch 8.0.0106 (after 8.0.0100)
Problem:Cannot use a semicolon in 'backupext'. (Jeff)
Solution:   Allow for a few more characters when "secure" isn't set.
Files:  src/option.c


*** ../vim-8.0.0105/src/option.c2016-11-26 17:45:50.040909819 +0100
--- src/option.c2016-11-29 22:05:29.171482041 +0100
***
*** 5879,5887 
  
  /* Check for a "normal" directory or file name in some options.  Disallow 
a
   * path separator (slash and/or backslash), wildcards and characters that
!  * are often illegal in a file name. */
  else if (((options[opt_idx].flags & P_NFNAME)
!   && vim_strpbrk(*varp, (char_u *)"/\\*?[|;&<>\r\n") != NULL)
  || ((options[opt_idx].flags & P_NDNAME)
&& vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL))
  {
--- 5879,5889 
  
  /* Check for a "normal" directory or file name in some options.  Disallow 
a
   * path separator (slash and/or backslash), wildcards and characters that
!  * are often illegal in a file name. Be more permissive if "secure" is 
off.
!  */
  else if (((options[opt_idx].flags & P_NFNAME)
!   && vim_strpbrk(*varp, (char_u *)(secure
!   ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
  || ((options[opt_idx].flags & P_NDNAME)
&& vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL))
  {
*** ../vim-8.0.0105/src/version.c   2016-11-29 21:54:41.120260177 +0100
--- src/version.c   2016-11-29 22:07:10.726739408 +0100
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 106,
  /**/

-- 
ERROR 047: Keyboard not found.  Press RETURN to continue.

 /// 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: backupext option

2016-11-29 Fir de Conversatie Bram Moolenaar

Jeff wrote:

> I think there might be an issue with the backupext option after the
> latest patches were applied.  My Vim version is version 8.0 which
> includes patches 1 through 104.
> 
> I use to be able to set backupext with "set backupext=;1".  Now I get a
> E474 error.
> 
> E474: Invalid argument: backupext=;1
> 
> Any ideas?

This was done intentionally to avoid weird characters to end up in
option values.  I suppose it would be OK to use a semicolon if you
really want to.

-- 
"I simultaneously try to keep my head in the clouds and my feet on the
ground.  Sometimes it's a stretch, though."  -- Larry Wall

 /// 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 8.0.0105

2016-11-29 Fir de Conversatie Bram Moolenaar

Patch 8.0.0105
Problem:When using ch_read() with zero timeout, can't tell the difference
between reading an empty line and nothing available.
Solution:   Add ch_canread().
Files:  src/evalfunc.c, src/channel.c, src/proto/channel.pro,
src/testdir/test_channel.vim, src/testdir/shared.vim,
runtime/doc/eval.txt, runtime/doc/channel.txt


*** ../vim-8.0.0104/src/evalfunc.c  2016-11-24 15:09:03.409856638 +0100
--- src/evalfunc.c  2016-11-29 20:23:04.633430178 +0100
***
*** 76,81 
--- 76,82 
  static void f_ceil(typval_T *argvars, typval_T *rettv);
  #endif
  #ifdef FEAT_JOB_CHANNEL
+ static void f_ch_canread(typval_T *argvars, typval_T *rettv);
  static void f_ch_close(typval_T *argvars, typval_T *rettv);
  static void f_ch_close_in(typval_T *argvars, typval_T *rettv);
  static void f_ch_evalexpr(typval_T *argvars, typval_T *rettv);
***
*** 499,504 
--- 500,506 
  {"ceil",  1, 1, f_ceil},
  #endif
  #ifdef FEAT_JOB_CHANNEL
+ {"ch_canread",1, 1, f_ch_canread},
  {"ch_close",  1, 1, f_ch_close},
  {"ch_close_in",   1, 1, f_ch_close_in},
  {"ch_evalexpr",   2, 3, f_ch_evalexpr},
***
*** 1779,1784 
--- 1781,1801 
  
  #ifdef FEAT_JOB_CHANNEL
  /*
+  * "ch_canread()" function
+  */
+ static void
+ f_ch_canread(typval_T *argvars, typval_T *rettv)
+ {
+ channel_T *channel = get_channel_arg(&argvars[0], TRUE, TRUE, 0);
+ 
+ rettv->vval.v_number = 0;
+ if (channel != NULL)
+   rettv->vval.v_number = channel_has_readahead(channel, PART_SOCK)
+   || channel_has_readahead(channel, PART_OUT)
+   || channel_has_readahead(channel, PART_ERR);
+ }
+ 
+ /*
   * "ch_close()" function
   */
  static void
*** ../vim-8.0.0104/src/channel.c   2016-11-26 15:13:29.402218088 +0100
--- src/channel.c   2016-11-29 20:13:58.177247346 +0100
***
*** 2603,2609 
  /*
   * Return TRUE if "channel" has JSON or other typeahead.
   */
! static int
  channel_has_readahead(channel_T *channel, ch_part_T part)
  {
  ch_mode_T ch_mode = channel->ch_part[part].ch_mode;
--- 2603,2609 
  /*
   * Return TRUE if "channel" has JSON or other typeahead.
   */
! int
  channel_has_readahead(channel_T *channel, ch_part_T part)
  {
  ch_mode_T ch_mode = channel->ch_part[part].ch_mode;
*** ../vim-8.0.0104/src/proto/channel.pro   2016-11-26 15:13:29.402218088 
+0100
--- src/proto/channel.pro   2016-11-29 20:14:03.549209705 +0100
***
*** 25,30 
--- 25,31 
  int channel_collapse(channel_T *channel, ch_part_T part, int want_nl);
  int channel_can_write_to(channel_T *channel);
  int channel_is_open(channel_T *channel);
+ int channel_has_readahead(channel_T *channel, ch_part_T part);
  char *channel_status(channel_T *channel, int req_part);
  void channel_info(channel_T *channel, dict_T *dict);
  void channel_close(channel_T *channel, int invoke_close_cb);
*** ../vim-8.0.0104/src/testdir/test_channel.vim2016-11-17 
17:25:28.212093109 +0100
--- src/testdir/test_channel.vim2016-11-29 21:52:55.853041485 +0100
***
*** 58,63 
--- 58,66 
" string with ][ should work
call assert_equal('this][that', ch_evalexpr(handle, 'echo this][that'))
  
+   " nothing to read now
+   call assert_equal(0, ch_canread(handle))
+ 
" sending three messages quickly then reading should work
for i in range(3)
  call ch_sendexpr(handle, 'echo hello ' . i)
***
*** 368,374 
endif
call ch_setoptions(handle, {'mode': 'raw'})
  
!   " The message are sent raw, we do our own JSON strings here.
call ch_sendraw(handle, "[1, \"hello!\"]\n", {'callback': 'Ch_handleRaw1'})
call WaitFor('g:Ch_reply1 != ""')
call assert_equal("[1, \"got it\"]", g:Ch_reply1)
--- 371,377 
endif
call ch_setoptions(handle, {'mode': 'raw'})
  
!   " The messages are sent raw, we do our own JSON strings here.
call ch_sendraw(handle, "[1, \"hello!\"]\n", {'callback': 'Ch_handleRaw1'})
call WaitFor('g:Ch_reply1 != ""')
call assert_equal("[1, \"got it\"]", g:Ch_reply1)
***
*** 431,437 
  return
endif
call ch_log('Test_raw_pipe()')
!   let job = job_start(s:python . " test_channel_pipe.py", {'mode': 'raw'})
call assert_equal(v:t_job, type(job))
call assert_equal("run", job_status(job))
  
--- 434,443 
  return
endif
call ch_log('Test_raw_pipe()')
!   " Add a dummy close callback to avoid that messages are dropped when calling
!   " ch_canread().
!   let job = job_start(s:python . " test_channel_pipe.py",
!   \ {'mode': 'raw', 'close_cb': {chan -> 0}})
call assert_equal(v:t_job, type(job))
call assert_equal("run", job_status(job))
  
***
*** 458,463 
--- 464,472 
  call assert_equal("something\n", substitute(msg, "\r", "", 'g'))
  
  call ch_sendraw(j

backupext option

2016-11-29 Fir de Conversatie 'Jeff' via vim_dev
Hello,

I think there might be an issue with the backupext option after the
latest patches were applied.  My Vim version is version 8.0 which
includes patches 1 through 104.

I use to be able to set backupext with "set backupext=;1".  Now I get a
E474 error.

E474: Invalid argument: backupext=;1

Any ideas?

Thanks,

-- 
-- 
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: [proposal] new 'cursorlinenr' option

2016-11-29 Fir de Conversatie Ozaki Kiichi
> Using the magic numbers is hard to understand.  New options are probably
> better done with string values, such as "on", "off", and empty for not
> set.  Perhaps in this case "number", "line" and "both"?  But then naming
> it 'cursorlineopt' would be better.

I have tried making out 'cursorlineopt' patch.

https://gist.github.com/ichizok/691aa7e848afd4aa8229c7a51aec895b

And test (also requires 
https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI).

https://gist.github.com/ichizok/698abaef579911ec5157ba2be138739c

Thank you.

-- 
-- 
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: Fold-related bug and pointer to fix

2016-11-29 Fir de Conversatie Ben Fritz
On Wednesday, November 23, 2016 at 4:39:24 AM UTC-6, Efraim Yawitz wrote:
> I had the following problem and I think it is a bug in some fold-related code:
> 
> I was trying to use the NarrowRegion plugin to do diffs between two functions 
> in the same file by creating narrowed buffers for each function and calling 
> :diffthis on them.  When I tried to do this using folds, i.e. 
> :.,+2NarrowRegion to create a buffer for a folded-up function which looked 
> like this:
> 
> int FuncName() {
> .folded
> }
> 
> I got everything but the final brace in the narrowed buffer.  Eventually I 
> discovered that this has nothing to do with NarrowRegion, but just a yank 
> such as:
> 
> :.,+2y
> 
> over a fold gives only the folded lines but not the line after the fold.
> 
> A normal command of y2j works just fine and gets the line after the fold.  

I can confirm this looks like a bug, seeing the same behavior in 64-bit Vim 
8.0.95 on Windows 7.

It gets worse actually. I tried several yanks from code that looks like this in 
Vim:

  else
  { ---3 lines folded--- }
#endif

  if ( ---2 lines folded--- )

With the cursor on the top "else" line:

:.,+2y yanks only the "else" and the folded lines beneath, when I expect to 
also get the #endif

:.,+3y yanks the exact same thing (omitting the #endif *and* the empty line)

:.,+4y finally includes the #endif (with nothing after it) but I expected it to 
yank everything from "else" to the content of the second folded section.

The :d command acts in the same way.

It appears something is wrong with handling of folded lines in the ranges 
specified for ex commands.

Forwarding to vim_dev as this appears to be a bug.

-- 
-- 
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.