Patch 8.1.0274

2018-08-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0274
Problem:'incsearch' triggers on ":source".
Solution:   Check for the whole command name.
Files:  src/ex_getln.c, src/testdir/test_search.vim


*** ../vim-8.1.0273/src/ex_getln.c  2018-08-11 19:02:18.038566056 +0200
--- src/ex_getln.c  2018-08-11 19:08:55.639612407 +0200
***
*** 293,299 
// Skip over "substitute" to find the pattern separator.
for (p = cmd; ASCII_ISALPHA(*p); ++p)
;
!   if (*p != NUL)
{
delim = *p++;
end = skip_regexp(p, delim, p_magic, NULL);
--- 293,302 
// Skip over "substitute" to find the pattern separator.
for (p = cmd; ASCII_ISALPHA(*p); ++p)
;
!   if (*p != NUL
!   && (STRNCMP(cmd, "substitute", p - cmd) == 0
!   || STRNCMP(cmd, "global", p - cmd) == 0
!   || STRNCMP(cmd, "vglobal", p - cmd) == 0))
{
delim = *p++;
end = skip_regexp(p, delim, p_magic, NULL);
*** ../vim-8.1.0273/src/testdir/test_search.vim 2018-08-11 16:40:39.068311966 
+0200
--- src/testdir/test_search.vim 2018-08-11 19:11:57.066276471 +0200
***
*** 342,367 
bw!
  endfunc
  
- func Test_search_cmdline3()
-   if !exists('+incsearch')
- return
-   endif
-   " need to disable char_avail,
-   " so that expansion of commandline works
-   call test_override("char_avail", 1)
-   new
-   call setline(1, ['  1', '  2 the~e', '  3 the theother'])
-   set incsearch
-   1
-   " first match
-   call feedkeys("/the\\", 'tx')
-   call assert_equal('  2 the~e', getline('.'))
-   " clean up
-   set noincsearch
-   call test_override("char_avail", 0)
-   bw!
- endfunc
- 
  func Cmdline3_prep()
" need to disable char_avail,
" so that expansion of commandline works
--- 342,347 
***
*** 377,382 
--- 357,375 
bw!
  endfunc
  
+ func Test_search_cmdline3()
+   if !exists('+incsearch')
+ return
+   endif
+   call Cmdline3_prep()
+   1
+   " first match
+   call feedkeys("/the\\", 'tx')
+   call assert_equal('  2 the~e', getline('.'))
+ 
+   call Cmdline3_cleanup()
+ endfunc
+ 
  func Test_search_cmdline3s()
if !exists('+incsearch')
  return
***
*** 385,390 
--- 378,389 
1
call feedkeys(":%s/the\/xxx\", 'tx')
call assert_equal('  2 xxxe', getline('.'))
+   undo
+   call feedkeys(":%subs/the\/xxx\", 'tx')
+   call assert_equal('  2 xxxe', getline('.'))
+   undo
+   call feedkeys(":%substitute/the\/xxx\", 'tx')
+   call assert_equal('  2 xxxe', getline('.'))
  
call Cmdline3_cleanup()
  endfunc
***
*** 397,402 
--- 396,404 
1
call feedkeys(":g/the\/d\", 'tx')
call assert_equal('  3 the theother', getline(2))
+   undo
+   call feedkeys(":global/the\/d\", 'tx')
+   call assert_equal('  3 the theother', getline(2))
  
call Cmdline3_cleanup()
  endfunc
***
*** 410,415 
--- 412,421 
call feedkeys(":v/the\/d\", 'tx')
call assert_equal(1, line('$'))
call assert_equal('  2 the~e', getline(1))
+   undo
+   call feedkeys(":vglobal/the\/d\", 'tx')
+   call assert_equal(1, line('$'))
+   call assert_equal('  2 the~e', getline(1))
  
call Cmdline3_cleanup()
  endfunc
***
*** 518,524 
" so that expansion of commandline works
call test_override("char_avail", 1)
new
!   let @/='b'
call setline(1, [' bbvimb', ''])
set incsearch
" first match
--- 524,530 
" so that expansion of commandline works
call test_override("char_avail", 1)
new
!   let @/ = 'b'
call setline(1, [' bbvimb', ''])
set incsearch
" first match
*** ../vim-8.1.0273/src/version.c   2018-08-11 19:02:18.038566056 +0200
--- src/version.c   2018-08-11 19:11:29.546478790 +0200
***
*** 796,797 
--- 796,799 
  {   /* Add new patch number below this line */
+ /**/
+ 274,
  /**/

-- 
You can be stopped by the police for biking over 65 miles per hour.
You are not allowed to walk across a street on your hands.
[real standing laws in Connecticut, United States of America]

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

Patch 8.1.0273

2018-08-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0273
Problem:Invalid memory access when using 'incsearch'.
Solution:   Reset "patlen" when using previous search pattern.
Files:  src/ex_getln.c


*** ../vim-8.1.0272/src/ex_getln.c  2018-08-11 16:40:39.064311995 +0200
--- src/ex_getln.c  2018-08-11 18:56:30.997198115 +0200
***
*** 504,510 
--- 504,514 
return FAIL;
  
  if (firstc == ccline.cmdbuff[skiplen])
+ {
pat = last_search_pattern();
+   skiplen = 0;
+   patlen = STRLEN(pat);
+ }
  else
pat = ccline.cmdbuff + skiplen;
  
*** ../vim-8.1.0272/src/version.c   2018-08-11 17:52:57.848311971 +0200
--- src/version.c   2018-08-11 19:01:58.394713331 +0200
***
*** 796,797 
--- 796,799 
  {   /* Add new patch number below this line */
+ /**/
+ 273,
  /**/

-- 
It is illegal for anyone to try and stop a child from playfully jumping over
puddles of water.
[real standing law in California, United States of America]

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

2018-08-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0272
Problem:Options test fails if temp var ends in slash. (Tom Briden)
Solution:   Check for optional slash. (closes #3308)
Files:  src/testdir/test_options.vim


*** ../vim-8.1.0271/src/testdir/test_options.vim2018-06-24 
16:53:31.649909925 +0200
--- src/testdir/test_options.vim2018-08-11 17:50:19.189469171 +0200
***
*** 344,350 
for var in  ['$TEMPDIR', '$TMP', '$TEMP']
  if exists(var)
let varvalue = substitute(expand(var), '\\', '/', 'g')
!   call assert_match(varvalue . '.\*', bskvalue)
  endif
endfor
  endfunc
--- 344,350 
for var in  ['$TEMPDIR', '$TMP', '$TEMP']
  if exists(var)
let varvalue = substitute(expand(var), '\\', '/', 'g')
!   call assert_match(varvalue . '/\=\*', bskvalue)
  endif
endfor
  endfunc
*** ../vim-8.1.0271/src/version.c   2018-08-11 16:40:39.068311966 +0200
--- src/version.c   2018-08-11 17:51:47.096827991 +0200
***
*** 796,797 
--- 796,799 
  {   /* Add new patch number below this line */
+ /**/
+ 272,
  /**/

-- 
It is illegal for a driver to be blindfolded while operating a vehicle.
[real standing law in Alabama, United States of America]

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

2018-08-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0271
Problem:'incsearch' doesn't work for :s, :g or :v.
Solution:   Also use 'incsearch' for other commands that use a pattern.
Files:  src/ex_getln.c, src/globals.h, src/screen.c,
src/testdir/test_search.vim


*** ../vim-8.1.0270/src/ex_getln.c  2018-08-10 22:07:28.821903829 +0200
--- src/ex_getln.c  2018-08-11 16:16:52.578317070 +0200
***
*** 264,274 
  
  /*
   * Return TRUE when 'incsearch' highlighting is to be done.
   */
  static int
! do_incsearch_highlighting(int firstc)
  {
! return p_is && !cmd_silent && (firstc == '/' || firstc == '?');
  }
  
  /*
--- 264,341 
  
  /*
   * Return TRUE when 'incsearch' highlighting is to be done.
+  * Sets search_first_line and search_last_line to the address range.
   */
  static int
! do_incsearch_highlighting(int firstc, incsearch_state_T *is_state,
!int *skiplen, int *patlen)
  {
! *skiplen = 0;
! *patlen = ccline.cmdlen;
! 
! if (p_is && !cmd_silent)
! {
!   // by default search all lines
!   search_first_line = 0;
!   search_last_line = MAXLNUM;
! 
!   if (firstc == '/' || firstc == '?')
!   return TRUE;
!   if (firstc == ':')
!   {
!   char_u *cmd = skip_range(ccline.cmdbuff, NULL);
!   char_u *p;
!   int delim;
!   char_u *end;
! 
!   if (*cmd == 's' || *cmd == 'g' || *cmd == 'v')
!   {
!   // Skip over "substitute" to find the pattern separator.
!   for (p = cmd; ASCII_ISALPHA(*p); ++p)
!   ;
!   if (*p != NUL)
!   {
!   delim = *p++;
!   end = skip_regexp(p, delim, p_magic, NULL);
!   if (end > p)
!   {
!   char_u  *dummy;
!   exarg_T ea;
!   pos_T   save_cursor = curwin->w_cursor;
! 
!   // found a non-empty pattern
!   *skiplen = (int)(p - ccline.cmdbuff);
!   *patlen = (int)(end - p);
! 
!   // parse the address range
!   vim_memset(, 0, sizeof(ea));
!   ea.line1 = 1;
!   ea.line2 = 1;
!   ea.cmd = ccline.cmdbuff;
!   ea.addr_type = ADDR_LINES;
!   parse_cmd_address(, );
!   curwin->w_cursor = is_state->search_start;
!   if (ea.addr_count > 0)
!   {
!   search_first_line = ea.line1;
!   search_last_line = ea.line2;
!   }
!   else if (*cmd == 's')
!   {
!   // :s defaults to the current line
!   search_first_line = curwin->w_cursor.lnum;
!   search_last_line = curwin->w_cursor.lnum;
!   }
! 
!   curwin->w_cursor = save_cursor;
!   return TRUE;
!   }
!   }
!   }
!   }
! }
! 
! return FALSE;
  }
  
  /*
***
*** 280,293 
longcount,
incsearch_state_T   *is_state)
  {
  int   i;
  pos_T end_pos;
  struct cmdline_info   save_ccline;
  #ifdef FEAT_RELTIME
  proftime_Ttm;
  #endif
  
! if (!do_incsearch_highlighting(firstc))
return;
  
  // If there is a character waiting, search and redraw later.
--- 347,362 
longcount,
incsearch_state_T   *is_state)
  {
+ int   skiplen, patlen;
  int   i;
  pos_T end_pos;
  struct cmdline_info   save_ccline;
  #ifdef FEAT_RELTIME
  proftime_Ttm;
  #endif
+ int   c;
  
! if (!do_incsearch_highlighting(firstc, is_state, , ))
return;
  
  // If there is a character waiting, search and redraw later.
***
*** 298,309 
  }
  is_state->incsearch_postponed = FALSE;
  
! // start at old position
! curwin->w_cursor = is_state->search_start;
  save_last_search_pattern();
  
  // If there is no command line, don't do anything.
! if (ccline.cmdlen == 0)
  {
i = 0;
set_no_hlsearch(TRUE); // turn off previous highlight
--- 367,385 
  }
  is_state->incsearch_postponed = FALSE;
  
! if (search_first_line == 0)
!   // start at the original cursor position
!   curwin->w_cursor = is_state->search_start;
! else
! {
!   // start at the first line in the range
!   curwin->w_cursor.lnum = search_first_line;
!   curwin->w_cursor.col = 0;
! }
  save_last_search_pattern();
  
  // If there is no command line, don't do anything.
! if (patlen == 0)
  {

Patch 8.1.0270

2018-08-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0270
Problem:Checking for a Tab in a line could be faster.
Solution:   Use strchr() instead of strrchr(). (closes #3312)
Files:  src/ex_cmds.c


*** ../vim-8.1.0269/src/ex_cmds.c   2018-08-02 22:23:53.342591238 +0200
--- src/ex_cmds.c   2018-08-11 14:39:13.611943727 +0200
***
*** 281,287 
  *last = NUL;
  len = linetabsize(line);  /* get line length */
  if (has_tab != NULL)  /* check for embedded TAB */
!   *has_tab = (vim_strrchr(first, TAB) != NULL);
  *last = save;
  
  return len;
--- 281,287 
  *last = NUL;
  len = linetabsize(line);  /* get line length */
  if (has_tab != NULL)  /* check for embedded TAB */
!   *has_tab = (vim_strchr(first, TAB) != NULL);
  *last = save;
  
  return len;
*** ../vim-8.1.0269/src/version.c   2018-08-11 14:24:06.945748177 +0200
--- src/version.c   2018-08-11 14:41:05.107212697 +0200
***
*** 796,797 
--- 796,799 
  {   /* Add new patch number below this line */
+ /**/
+ 270,
  /**/

-- 
BRIDGEKEEPER: What is the air-speed velocity of an unladen swallow?
ARTHUR:   What do you mean?  An African or European swallow?
BRIDGEKEEPER: Er ...  I don't know that ... Arrggghhh!
   BRIDGEKEEPER is cast into the gorge.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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: Submit syntax changes - cfg.vim

2018-08-11 Fir de Conversatie Rory Sales
Thanks for the reply and cc'ing in the maintainers.

Yes also noticed the 's/before/after/' :) forgot to mention. Thanks for adding.

Checking for white space before the // allows a comment is a much 
simpler/better solution

Thanks for the input. I assume the maintainers will add?

Kind Regards
Rory

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

2018-08-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0269
Problem:Ruby Kernel.#p method always returns nil.
Solution:   Copy p method implementation from Ruby code. (Masataka Pocke
Kuwabara, closes #3315)
Files:  src/if_ruby.c, src/testdir/test_ruby.vim


*** ../vim-8.1.0268/src/if_ruby.c   2018-08-04 17:24:39.062825210 +0200
--- src/if_ruby.c   2018-08-11 14:23:48.613860602 +0200
***
*** 299,304 
--- 299,309 
  #  define rb_string_value_ptr dll_rb_string_value_ptr
  #  define rb_float_newdll_rb_float_new
  #  define rb_ary_new  dll_rb_ary_new
+ #  ifdef rb_ary_new4
+ #define RB_ARY_NEW4_MACRO 1
+ #undef rb_ary_new4
+ #  endif
+ #  define rb_ary_new4 dll_rb_ary_new4
  #  define rb_ary_push dll_rb_ary_push
  #  if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
  #   ifdef __ia64
***
*** 441,446 
--- 446,452 
  static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
  static VALUE (*dll_rb_float_new) (double);
  static VALUE (*dll_rb_ary_new) (void);
+ static VALUE (*dll_rb_ary_new4) (long n, const VALUE *elts);
  static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
  #  if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
  #   ifdef __ia64
***
*** 647,652 
--- 653,663 
  {"rb_float_new_in_heap", (RUBY_PROC*)_rb_float_new},
  #  endif
  {"rb_ary_new", (RUBY_PROC*)_rb_ary_new},
+ #  ifdef RB_ARY_NEW4_MACRO
+ {"rb_ary_new_from_values", (RUBY_PROC*)_rb_ary_new4},
+ #  else
+ {"rb_ary_new4", (RUBY_PROC*)_rb_ary_new4},
+ #  endif
  {"rb_ary_push", (RUBY_PROC*)_rb_ary_push},
  # endif
  # ifdef RUBY19_OR_LATER
***
*** 1577,1582 
--- 1588,1594 
  {
  int i;
  VALUE str = rb_str_new("", 0);
+ VALUE ret = Qnil;
  
  for (i = 0; i < argc; i++)
  {
***
*** 1584,1590 
rb_str_concat(str, rb_inspect(argv[i]));
  }
  MSG(RSTRING_PTR(str));
! return Qnil;
  }
  
  static void ruby_io_init(void)
--- 1596,1607 
rb_str_concat(str, rb_inspect(argv[i]));
  }
  MSG(RSTRING_PTR(str));
! 
! if (argc == 1)
!   ret = argv[0];
! else if (argc > 1)
!   ret = rb_ary_new4(argc, argv);
! return ret;
  }
  
  static void ruby_io_init(void)
*** ../vim-8.1.0268/src/testdir/test_ruby.vim   2018-07-28 17:29:15.757096343 
+0200
--- src/testdir/test_ruby.vim   2018-08-11 14:17:07.396211894 +0200
***
*** 363,366 
--- 363,379 
ruby p 'Just a test'
let messages = split(execute('message'), "\n")
call assert_equal('"Just a test"', messages[-1])
+ 
+   " Check return values of p method
+ 
+   call assert_equal('123', RubyEval('p(123)'))
+   call assert_equal('[1, 2, 3]', RubyEval('p(1, 2, 3)'))
+ 
+   " Avoid the "message maintainer" line.
+   let $LANG = ''
+   messages clear
+   call assert_equal('true', RubyEval('p() == nil'))
+ 
+   let messages = split(execute('message'), "\n")
+   call assert_equal(0, len(messages))
  endfunc
*** ../vim-8.1.0268/src/version.c   2018-08-11 13:57:16.215969777 +0200
--- src/version.c   2018-08-11 14:22:56.922175770 +0200
***
*** 796,797 
--- 796,799 
  {   /* Add new patch number below this line */
+ /**/
+ 269,
  /**/

-- 
SIGFUN -- signature too funny (core dumped)

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

2018-08-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0268
Problem:File type checking has too many #ifdef.
Solution:   Always define the S_IF macros. (Ken Takata, closes #3306)
Files:  src/buffer.c, src/evalfunc.c, src/fileio.c, src/if_cscope.c,
src/os_unix.c, src/os_unix.h, src/vim.h


*** ../vim-8.1.0267/src/buffer.c2018-08-07 22:30:26.670240840 +0200
--- src/buffer.c2018-08-11 13:48:31.531925854 +0200
***
*** 204,216 
  #endif
  #ifdef UNIX
perm = mch_getperm(curbuf->b_ffname);
!   if (perm >= 0 && (0
! # ifdef S_ISFIFO
! || S_ISFIFO(perm)
! # endif
! # ifdef S_ISSOCK
  || S_ISSOCK(perm)
- # endif
  # ifdef OPEN_CHR_FILES
  || (S_ISCHR(perm) && is_dev_fd_file(curbuf->b_ffname))
  # endif
--- 204,211 
  #endif
  #ifdef UNIX
perm = mch_getperm(curbuf->b_ffname);
!   if (perm >= 0 && (S_ISFIFO(perm)
  || S_ISSOCK(perm)
  # ifdef OPEN_CHR_FILES
  || (S_ISCHR(perm) && is_dev_fd_file(curbuf->b_ffname))
  # endif
*** ../vim-8.1.0267/src/evalfunc.c  2018-08-09 22:08:53.017560100 +0200
--- src/evalfunc.c  2018-08-11 13:48:31.535925823 +0200
***
*** 5088,5150 
  rettv->v_type = VAR_STRING;
  if (mch_lstat((char *)fname, ) >= 0)
  {
- #ifdef S_ISREG
if (S_ISREG(st.st_mode))
t = "file";
else if (S_ISDIR(st.st_mode))
t = "dir";
- # ifdef S_ISLNK
else if (S_ISLNK(st.st_mode))
t = "link";
- # endif
- # ifdef S_ISBLK
else if (S_ISBLK(st.st_mode))
t = "bdev";
- # endif
- # ifdef S_ISCHR
else if (S_ISCHR(st.st_mode))
t = "cdev";
- # endif
- # ifdef S_ISFIFO
else if (S_ISFIFO(st.st_mode))
t = "fifo";
- # endif
- # ifdef S_ISSOCK
else if (S_ISSOCK(st.st_mode))
t = "socket";
- # endif
else
t = "other";
- #else
- # ifdef S_IFMT
-   switch (st.st_mode & S_IFMT)
-   {
-   case S_IFREG: t = "file"; break;
-   case S_IFDIR: t = "dir"; break;
- #  ifdef S_IFLNK
-   case S_IFLNK: t = "link"; break;
- #  endif
- #  ifdef S_IFBLK
-   case S_IFBLK: t = "bdev"; break;
- #  endif
- #  ifdef S_IFCHR
-   case S_IFCHR: t = "cdev"; break;
- #  endif
- #  ifdef S_IFIFO
-   case S_IFIFO: t = "fifo"; break;
- #  endif
- #  ifdef S_IFSOCK
-   case S_IFSOCK: t = "socket"; break;
- #  endif
-   default: t = "other";
-   }
- # else
-   if (mch_isdir(fname))
-   t = "dir";
-   else
-   t = "file";
- # endif
- #endif
type = vim_strsave((char_u *)t);
  }
  rettv->vval.v_string = type;
--- 5088,5109 
*** ../vim-8.1.0267/src/fileio.c2018-08-07 21:39:09.247060119 +0200
--- src/fileio.c2018-08-11 13:48:31.535925823 +0200
***
*** 424,435 
 */
perm = mch_getperm(fname);
if (perm >= 0 && !S_ISREG(perm) /* not a regular file ... */
- # ifdef S_ISFIFO
  && !S_ISFIFO(perm)/* ... or fifo */
- # endif
- # ifdef S_ISSOCK
  && !S_ISSOCK(perm)/* ... or socket */
- # endif
  # ifdef OPEN_CHR_FILES
  && !(S_ISCHR(perm) && is_dev_fd_file(fname))
/* ... or a character special file named /dev/fd/ */
--- 424,431 
***
*** 2497,2524 
c = FALSE;
  
  #ifdef UNIX
! # ifdef S_ISFIFO
!   if (S_ISFIFO(perm)) /* fifo or socket */
!   {
!   STRCAT(IObuff, _("[fifo/socket]"));
!   c = TRUE;
!   }
! # else
! #  ifdef S_IFIFO
!   if ((perm & S_IFMT) == S_IFIFO) /* fifo */
{
STRCAT(IObuff, _("[fifo]"));
c = TRUE;
}
! #  endif
! #  ifdef S_IFSOCK
!   if ((perm & S_IFMT) == S_IFSOCK)/* or socket */
{
STRCAT(IObuff, _("[socket]"));
c = TRUE;
}
- #  endif
- # endif
  # ifdef OPEN_CHR_FILES
if (S_ISCHR(perm))  /* or character special */
{
--- 2493,2508 
c = FALSE;
  
  #ifdef UNIX
!   if (S_ISFIFO(perm)) /* fifo */
{
STRCAT(IObuff, _("[fifo]"));
c = TRUE;
}
!   if (S_ISSOCK(perm)) /* or socket */
{
STRCAT(IObuff, _("[socket]"));
c = TRUE;
}
  # ifdef OPEN_CHR_FILES
if (S_ISCHR(perm))  /* or character special */
{
*** ../vim-8.1.0267/src/if_cscope.c 2018-07-25 21:19:09.363656976 +0200
--- src/if_cscope.c 2018-08-11 13:48:31.539925791 +0200
***
*** 550,556 
  }
  
  /* if filename is a directory, append the cscope database name to it 

Re: Submit syntax changes - cfg.vim

2018-08-11 Fir de Conversatie Bram Moolenaar


Rory Sales wrote:

> My name is Rory Sales
> I use vim often when doing sysadmin work on our multiple RedHat/Fedora/CentOS 
> servers.
> 
> I would like to now and then offer a syntax improvement to vim, and would 
> appreciate someone with knowledge adding them for me on github or being given 
> the ability to submit a change request.
> 
> First syntax update request.
> 
> example file affected: /etc/haproxy/haproxy.cfg
> github file: https://github.com/vim/vim/blob/master/runtime/syntax/cfg.vim
> 
> replace line
> syn match  CfgComment "\/\/.*"
> with line
> syn match  CfgComment   "\(http[s]\?:\)\@ 
> If my regex is not well formed please proceed to change as required.
> 
> This fix allows for comments in the .cfg files but not when the // forms part 
> of a http / https line. This maintains the colour syntax highlighting on that 
> line instead of colour and then suddenly a false positive on a comment.
> A common example in the HAProxy cfg files is as follows.
> 
> redirect prefix https://www.example.com code 301 if { ssl_fc_sni 
> secure.example.com }

CC'ing the maintainer.

A simpler way would be to check for white space before the //.

I also notice:

" Comments (Everything before '#' or '//' or ';')

s/before/after/

-- 
Q: Why does /dev/null accept only integers?
A: You can't sink a float.

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

2018-08-11 Fir de Conversatie Bram Moolenaar


Patch 8.1.0267
Problem:No good check if restoring quickfix list worked.
Solution:   Let qf_restore_list() return OK/FAIL. (Yegappan Lakshmanan)
Files:  src/quickfix.c


*** ../vim-8.1.0266/src/quickfix.c  2018-08-09 21:52:20.716362389 +0200
--- src/quickfix.c  2018-08-11 13:35:15.874757811 +0200
***
*** 4338,4345 
   * If the current list is not "save_qfid" and we can find the list with that 
ID
   * then make it the current list.
   * This is used when autocommands may have changed the current list.
   */
! static void
  qf_restore_list(qf_info_T *qi, int_u save_qfid)
  {
  int curlist;
--- 4338,4347 
   * If the current list is not "save_qfid" and we can find the list with that 
ID
   * then make it the current list.
   * This is used when autocommands may have changed the current list.
+  * Returns OK if successfully restored the list. Returns FAIL if the list with
+  * the specified identifier (save_qfid) is not found in the stack.
   */
! static int
  qf_restore_list(qf_info_T *qi, int_u save_qfid)
  {
  int curlist;
***
*** 4347,4356 
  if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
  {
curlist = qf_id2nr(qi, save_qfid);
!   if (curlist >= 0)
!   qi->qf_curlist = curlist;
!   // else: what if the list can't be found?
  }
  }
  
  /*
--- 4349,4360 
  if (qi->qf_lists[qi->qf_curlist].qf_id != save_qfid)
  {
curlist = qf_id2nr(qi, save_qfid);
!   if (curlist < 0)
!   // list is not present
!   return FAIL;
!   qi->qf_curlist = curlist;
  }
+ return OK;
  }
  
  /*
***
*** 4359,4367 
  static void
  qf_jump_first(qf_info_T *qi, int_u save_qfid, int forceit)
  {
! qf_restore_list(qi, save_qfid);
  
! // Autocommands might have cleared the list, check for it
  if (!qf_list_empty(qi, qi->qf_curlist))
qf_jump(qi, 0, 0, forceit);
  }
--- 4363,4372 
  static void
  qf_jump_first(qf_info_T *qi, int_u save_qfid, int forceit)
  {
! if (qf_restore_list(qi, save_qfid) == FAIL)
!   return;
  
! // Autocommands might have cleared the list, check for that.
  if (!qf_list_empty(qi, qi->qf_curlist))
qf_jump(qi, 0, 0, forceit);
  }
***
*** 5025,5031 
}
  }
  
! qf_restore_list(qi, qfid);
  
  return TRUE;
  }
--- 5030,5037 
}
  }
  
! if (qf_restore_list(qi, qfid) == FAIL)
!   return FALSE;
  
  return TRUE;
  }
***
*** 5371,5377 
  if (!qflist_valid(wp, save_qfid))
goto theend;
  
! qf_restore_list(qi, save_qfid);
  
  /* Jump to first match. */
  if (!qf_list_empty(qi, qi->qf_curlist))
--- 5377,5384 
  if (!qflist_valid(wp, save_qfid))
goto theend;
  
! if (qf_restore_list(qi, save_qfid) == FAIL)
!   goto theend;
  
  /* Jump to first match. */
  if (!qf_list_empty(qi, qi->qf_curlist))
*** ../vim-8.1.0266/src/version.c   2018-08-10 23:13:07.934024645 +0200
--- src/version.c   2018-08-11 13:32:28.919832152 +0200
***
*** 796,797 
--- 796,799 
  {   /* Add new patch number below this line */
+ /**/
+ 267,
  /**/

-- 
BRIDGEKEEPER: What is your favorite editor?
GAWAIN:   Emacs ...  No, Viiimmm!
   "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD

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

2018-08-11 Fir de Conversatie Bram Moolenaar


Yegappan wrote:

> >> In all the places where qf_restore_list() is currently invoked, there
> >> is a call to
> >> qflist_valid() to check whether the list with the specified id is
> >> present or not.
> >> If the list is not present, then qf_restore_list() is not called. But
> >> in the future,
> >> someone might call qf_restore_list() without first checking whether the 
> >> list
> >> is still present in the stack or not.
> >
> > Yes, so the current construction is brittle, if someone makes changes
> > and forgets to call qflist_valid() then things break.  That's basically
> > what Coverity complains about: unless you are careful qf_curlist becomes
> > negative.
> >
> > We should move qflist_valid() into qf_restore_list(), and let it return
> > FAIL when the list isn't valid.
> >
> 
> There is no need to call qflist_valid() in qf_restore_list() as the qf_id2nr()
> function (called by qf_restore_list()) already iterates through all the lists
> in the stack.
> 
> >
> > Then the caller must deal with the
> > failure.  This also applies to qf_jump_first() indirectly.
> >
> > Can you make it work like that?
> 
> I am attaching a patch that does this.

Thanks!

-- 
BRIDGEKEEPER: What is your favorite colour?
GAWAIN:   Blue ...  No yelloww!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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


Submit syntax changes - cfg.vim

2018-08-11 Fir de Conversatie Rory Sales
To whom it may concern

My name is Rory Sales
I use vim often when doing sysadmin work on our multiple RedHat/Fedora/CentOS 
servers.

I would like to now and then offer a syntax improvement to vim, and would 
appreciate someone with knowledge adding them for me on github or being given 
the ability to submit a change request.

First syntax update request.

example file affected: /etc/haproxy/haproxy.cfg
github file: https://github.com/vim/vim/blob/master/runtime/syntax/cfg.vim

replace line
syn match  CfgComment   "\/\/.*"
with line
syn match  CfgComment   "\(http[s]\?:\)\@https://www.example.com code 301 if { ssl_fc_sni 
secure.example.com }

Kind Regards
Rory Sales

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