Re: [proposal] new 'cursorlinenr' option

2016-11-26 Fir de Conversatie Ozaki Kiichi
I updated; changed type of 'cursorlinenr' to number.

https://gist.github.com/ichizok/8d016c1e4c791499d092

And added test.

https://gist.github.com/ichizok/aa54ecfe8aa7c94ce6711b940de16453

* which requires https://groups.google.com/forum/#!topic/vim_dev/tzNKP7EDWYI

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

2016-11-26 Fir de Conversatie Bram Moolenaar

Patch 8.0.0104
Problem:Value of 'thesaurus' option not checked properly.
Solution:   Add P_NDNAME flag. (Daisuke Suzuki)
Files:  src/option.c, src/testdir/test_options.vim


*** ../vim-8.0.0103/src/option.c2016-11-25 22:04:09.607397081 +0100
--- src/option.c2016-11-26 17:35:20.089224386 +0100
***
*** 2660,2666 
  {"textwidth",   "tw",   P_NUM|P_VI_DEF|P_VIM|P_RBUF,
(char_u *)_tw, PV_TW,
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
! {"thesaurus",   "tsr",  P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP,
  #ifdef FEAT_INS_EXPAND
(char_u *)_tsr, PV_TSR,
  #else
--- 2660,2666 
  {"textwidth",   "tw",   P_NUM|P_VI_DEF|P_VIM|P_RBUF,
(char_u *)_tw, PV_TW,
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
! {"thesaurus",   "tsr",  
P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME,
  #ifdef FEAT_INS_EXPAND
(char_u *)_tsr, PV_TSR,
  #else
*** ../vim-8.0.0103/src/testdir/test_options.vim2016-11-25 
22:04:09.607397081 +0100
--- src/testdir/test_options.vim2016-11-26 17:41:00.722891085 +0100
***
*** 107,123 
call assert_fails(":set kmp=trunc\x00name", "trunc")
  endfunc
  
! func Test_dictionary()
" Check that it's possible to set the option.
!   set dictionary=/usr/share/dict/words
!   call assert_equal('/usr/share/dict/words', )
!   set dictionary=/usr/share/dict/words,/and/there
!   call assert_equal('/usr/share/dict/words,/and/there', )
!   set dictionary=/usr/share/dict\ words
!   call assert_equal('/usr/share/dict words', )
  
" Check rejecting weird characters.
!   call assert_fails("set dictionary=/not", "E474:")
!   call assert_fails("set dictionary=/not>there", "E474:")
!   call assert_fails("set dictionary=/not.*there", "E474:")
  endfunc
--- 107,131 
call assert_fails(":set kmp=trunc\x00name", "trunc")
  endfunc
  
! func Check_dir_option(name)
" Check that it's possible to set the option.
!   exe 'set ' . a:name . '=/usr/share/dict/words'
!   call assert_equal('/usr/share/dict/words', eval('&' . a:name))
!   exe 'set ' . a:name . '=/usr/share/dict/words,/and/there'
!   call assert_equal('/usr/share/dict/words,/and/there', eval('&' . a:name))
!   exe 'set ' . a:name . '=/usr/share/dict\ words'
!   call assert_equal('/usr/share/dict words', eval('&' . a:name))
  
" Check rejecting weird characters.
!   call assert_fails("set " . a:name . "=/not", "E474:")
!   call assert_fails("set " . a:name . "=/not>there", "E474:")
!   call assert_fails("set " . a:name . "=/not.*there", "E474:")
! endfunc
! 
! func Test_dictionary()
!   call Check_dir_option('dictionary')
! endfunc
! 
! func Test_thesaurus()
!   call Check_dir_option('thesaurus')
  endfunc
*** ../vim-8.0.0103/src/version.c   2016-11-26 15:13:29.410218034 +0100
--- src/version.c   2016-11-26 17:36:23.568793629 +0100
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 104,
  /**/

-- 
Never go to the toilet in a paperless office.

 /// 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: "ch_read()" couldn't tell the difference between "not enough message" and "a empty line"

2016-11-26 Fir de Conversatie Bram Moolenaar

Skywind wrote:

> Bram Moolenaar wrote:
> > > This will not break the plugins, and will make ch_read better.
> > > It could be used in a timer for congestion control manually.
> > 
> > That changes what you get back, that is a bit strange.
> > How about adding a function that returns whether there is something to
> > read?  Could call it ch_canread().
> > 
> 
> I think "ch_canread()" is a nice design !

Please try out patch 8.0.0103, it should no longer get stuck.

-- 
hundred-and-one symptoms of being an internet addict:
51. You put a pillow case over your laptop so your lover doesn't see it while
you are pretending to catch your breath.

 /// 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] Incorrect cursor position on a long wrapped-line

2016-11-26 Fir de Conversatie h_east
Hi Kiichi,

2016-11-27(Sun) 0:09:20 UTC+9 Ozaki Kiichi:
> https://gist.github.com/ichizok/4d177e3bf8cc9d47d47243577c8d847b
>  
> * add test_number.vim
> * separate some functions from test_breakindent.vim and add view.vim

I think that file name and function names that can be used with the whole test 
script should be named accordingly.  Maybe we need a prefix?

Bram and Vim contributors>
How do you think?

> * change to easily visible expected values of tests in test_breakindent.vim
> 
> Thank you.

--
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] Incorrect cursor position on a long wrapped-line

2016-11-26 Fir de Conversatie Ozaki Kiichi
https://gist.github.com/ichizok/4d177e3bf8cc9d47d47243577c8d847b
 
* add test_number.vim
* separate some functions from test_breakindent.vim and add view.vim
* change to easily visible expected values of tests in test_breakindent.vim

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: "ch_read()" couldn't tell the difference between "not enough message" and "a empty line"

2016-11-26 Fir de Conversatie skywind3000
Bram Moolenaar wrote:
> > This will not break the plugins, and will make ch_read better.
> > It could be used in a timer for congestion control manually.
> 
> That changes what you get back, that is a bit strange.
> How about adding a function that returns whether there is something to
> read?  Could call it ch_canread().
> 

I think "ch_canread()" is a nice design !

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

2016-11-26 Fir de Conversatie Bram Moolenaar

Patch 8.0.0103
Problem:May not process channel readahead. (skywind)
Solution:   If there is readahead don't block on input.
Files:  src/channel.c, src/proto/channel.pro, src/os_unix.c,
src/os_win32.c, src/misc2.c


*** ../vim-8.0.0102/src/channel.c   2016-11-24 17:22:46.154837060 +0100
--- src/channel.c   2016-11-26 15:03:44.386121667 +0100
***
*** 3900,3905 
--- 3900,3930 
  }
  
  /*
+  * Return TRUE if any channel has readahead.  That means we should not block 
on
+  * waiting for input.
+  */
+ int
+ channel_any_readahead(void)
+ {
+ channel_T *channel = first_channel;
+ ch_part_T part = PART_SOCK;
+ 
+ while (channel != NULL)
+ {
+   if (channel_has_readahead(channel, part))
+   return TRUE;
+   if (part < PART_ERR)
+   ++part;
+   else
+   {
+   channel = channel->ch_next;
+   part = PART_SOCK;
+   }
+ }
+ return FALSE;
+ }
+ 
+ /*
   * Mark references to lists used in channels.
   */
  int
*** ../vim-8.0.0102/src/proto/channel.pro   2016-10-09 17:27:56.863388510 
+0200
--- src/proto/channel.pro   2016-11-26 15:03:47.522100708 +0100
***
*** 44,49 
--- 44,50 
  int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in);
  int channel_select_check(int ret_in, void *rfds_in, void *wfds_in);
  int channel_parse_messages(void);
+ int channel_any_readahead(void);
  int set_ref_in_channel(int copyID);
  ch_part_T channel_part_send(channel_T *channel);
  ch_part_T channel_part_read(channel_T *channel);
*** ../vim-8.0.0102/src/os_unix.c   2016-11-24 17:22:46.146837112 +0100
--- src/os_unix.c   2016-11-26 15:06:11.005142143 +0100
***
*** 462,467 
--- 462,471 
/* Checking if a job ended requires polling.  Do this every 100 msec. */
if (has_pending_job() && (wait_time < 0 || wait_time > 100L))
wait_time = 100L;
+   /* If there is readahead then parse_queued_messages() timed out and we
+* should call it again soon. */
+   if ((wait_time < 0 || wait_time > 100L) && channel_any_readahead())
+   wait_time = 10L;
  #endif
  
/*
*** ../vim-8.0.0102/src/os_win32.c  2016-11-24 17:22:46.150837087 +0100
--- src/os_win32.c  2016-11-26 15:09:12.055933715 +0100
***
*** 1351,1359 
DWORD dwWaitTime = dwEndTime - dwNow;
  
  #ifdef FEAT_JOB_CHANNEL
!   /* Check channel while waiting input. */
if (dwWaitTime > 100)
dwWaitTime = 100;
  #endif
  #ifdef FEAT_MZSCHEME
if (mzthreads_allowed() && p_mzq > 0
--- 1351,1365 
DWORD dwWaitTime = dwEndTime - dwNow;
  
  #ifdef FEAT_JOB_CHANNEL
!   /* Check channel while waiting for input. */
if (dwWaitTime > 100)
+   {
dwWaitTime = 100;
+   /* If there is readahead then parse_queued_messages() timed out
+* and we should call it again soon. */
+   if (channel_any_readahead())
+   dwWaitTime = 10;
+   }
  #endif
  #ifdef FEAT_MZSCHEME
if (mzthreads_allowed() && p_mzq > 0
*** ../vim-8.0.0102/src/misc2.c 2016-11-24 17:22:46.150837087 +0100
--- src/misc2.c 2016-11-26 14:52:17.202709633 +0100
***
*** 6264,6270 
  }
  #endif
  
! #ifdef ELAPSED_TIMEVAL  /* proto is defined in vim.h */
  /*
   * Return time in msec since "start_tv".
   */
--- 6264,6270 
  }
  #endif
  
! #ifdef ELAPSED_TIMEVAL  /* no PROTO here, proto is defined in vim.h */
  /*
   * Return time in msec since "start_tv".
   */
***
*** 6288,6296 
  {
  DWORD now = GetTickCount();
  
- if (now < start_tick)
-   /* overflow */
-   return (long)now;
  return (long)now - (long)start_tick;
  }
  #endif
--- 6288,6293 
*** ../vim-8.0.0102/src/version.c   2016-11-25 22:04:09.607397081 +0100
--- src/version.c   2016-11-26 15:02:23.754660704 +0100
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 103,
  /**/

-- 
CVS sux, men don't like commitment

 /// 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: "ch_read()" couldn't tell the difference between "not enough message" and "a empty line"

2016-11-26 Fir de Conversatie Bram Moolenaar

Skywind wrote:

> What about provide an option "nl" in ch_read to make it better ?
> 
> :call ch_read(mych, {"timeout": 0, "nl":1})
> 
> returns "abc\n" for a line "abc"
> returns "\n" for an empty line
> returns "" for not enough data
> 
> This will not break the plugins, and will make ch_read better.
> It could be used in a timer for congestion control manually.

That changes what you get back, that is a bit strange.
How about adding a function that returns whether there is something to
read?  Could call it ch_canread().

-- 
The real
trick is
this: to
keep the
lines as
short as
possible
and keep
the size
the same
yet free
from the
need for
hyphena-
Dammit!!  (Matthew Winn)

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

2016-11-26 Fir de Conversatie Bram Moolenaar

Ken Takata wrote:

> 2016/11/25 Fri 1:23:12 UTC+9 Bram Moolenaar wrote:
> > Patch 8.0.0097
> > Problem:When a channel callback consumes a lot of time Vim becomes
> > unresponsive. (skywind)
> > Solution:   Bail out of checking channel readahead after 100 msec.
> > Files:  src/os_unix.c, src/misc2.c, src/vim.h, src/os_win32.c
> 
> > + long
> > + elapsed(DWORD start_tick)
> > + {
> > + DWORD now = GetTickCount();
> > + 
> > + if (now < start_tick)
> > +   /* overflow */
> > +   return (long)now;
> > + return (long)now - (long)start_tick;
> > + }
> 
> I don't think overflow checking is needed here.
> 
> return (long)now - (long)start_tick;
> 
> should work on Windows even if overflow occurs.

DWORD is 32 bits unsigned, right?  And long is 32 bits signed.
I suppose that works.

-- 
hundred-and-one symptoms of being an internet addict:
49. You never have to deal with busy signals when calling your ISP...because
you never log off.

 /// 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: "ch_read()" couldn't tell the difference between "not enough message" and "a empty line"

2016-11-26 Fir de Conversatie Bram Moolenaar

Skywind wrote:

> Thanks for the patch,
> 
> I wrote a test :
> (benchjob.vim for starting job, benchjob.py for printing 8 lines)
> 
> ---
> benchjob.vim:
> 
> function! MyCallback(job, text)
>   " make cpu a little busy
>   for i in range(100)
>   for j in range(10)
>   cbottom 
>   endfor
>   endfor
>   let text = iconv(a:text, "gbk", )
>   caddexpr a:text
>   cbottom
> endfunc
> 
> copen 8
> cexpr "[python output]"
> wincmd k
> 
> let cmd = ['/usr/bin/python', 'benchjob.py']
> let opt = {"out_cb": "MyCallback", "out_io": "pipe", "err_io": "out"}
> 
> let job = job_start(cmd, opt)
> 
> 
> 
> --
> benchjob.py:
> 
> #! /usr/bin/env python2
> import sys
> 
> for i in xrange(8):
>   sys.stdout.write('benchjob:%s: this is line %d\n'%(i, i))
>   sys.stdout.flush()
> 
> 
> I can move cursor with the latest version (8.0.101), gui doesn't freeze as 
> the older versions. But I also find some issues:
> 
> 1. Although I can move cursor while benchjob.py is running, but I
> nearly can't input any thing, when I type a single character in insert
> mode, I can see the character appears in the screen, cursor moves
> right and then cursor rewinds to the head of the line, and then redraw
> the whole line. (delete the whole line at first, then display them
> again). It seems gui is very busy, especially accessing a remote vim
> from terminal.

It's hard to avoid this, since Vim is indeed 100% busy.

> 2. After a while, the output in quickfix stopped (benchjob.py isn't finished 
> yet), until I move cursor or type something in vim, and it resumes and 
> updates a few lines in quickfix and stops again until I type something again. 
> If I don't touch my keyboard, the the output will pause forever.

That sounds like a bug.  I suppose that when no key is available the
loop doesn't go back to checking for messages.

-- 
hundred-and-one symptoms of being an internet addict:
48. You get a tatoo that says "This body best viewed with Netscape 3.1 or
higher."

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