Patch 8.0.0038

2016-10-15 Fir de Conversatie Bram Moolenaar

Patch 8.0.0038
Problem:OPEN_CHR_FILES not defined for FreeBSD using Debian userland
files.
Solution:   Check for __FreeBSD_kernel__. (James McCoy, closes #1166)
Files:  src/vim.h


*** ../vim-8.0.0037/src/vim.h   2016-10-15 15:39:34.689059624 +0200
--- src/vim.h   2016-10-15 19:32:06.017435971 +0200
***
*** 2495,2501 
  #define FNE_INCL_BR   1   /* include [] in name */
  #define FNE_CHECK_START   2   /* check name starts with valid 
character */
  
! #if (defined(sun) || defined(__FreeBSD__)) && defined(S_ISCHR)
  # define OPEN_CHR_FILES
  #endif
  
--- 2495,2502 
  #define FNE_INCL_BR   1   /* include [] in name */
  #define FNE_CHECK_START   2   /* check name starts with valid 
character */
  
! #if (defined(sun) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) \
!   && defined(S_ISCHR)
  # define OPEN_CHR_FILES
  #endif
  
*** ../vim-8.0.0037/src/version.c   2016-10-15 19:28:09.243181069 +0200
--- src/version.c   2016-10-15 19:33:06.036993609 +0200
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 38,
  /**/

-- 
A special law prohibits unmarried women from parachuting on Sunday or she
shall risk arrest, fine, and/or jailing.
[real standing law in Florida, 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.0.0037

2016-10-15 Fir de Conversatie Bram Moolenaar

Patch 8.0.0037
Problem:Get E924 when switching tabs. ()
Solution:   Use win_valid_any_tab() instead of win_valid(). (Martin Vuille,
closes #1167, closes #1171)
Files:  src/quickfix.c, src/testdir/test_quickfix.vim


*** ../vim-8.0.0036/src/quickfix.c  2016-10-09 16:10:02.135942266 +0200
--- src/quickfix.c  2016-10-15 19:20:23.402614457 +0200
***
*** 2266,2272 
  
ok = buflist_getfile(qf_ptr->qf_fnum,
(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
!   if (qi != _info && !win_valid(oldwin))
{
EMSG(_("E924: Current window was closed"));
is_abort = TRUE;
--- 2266,2272 
  
ok = buflist_getfile(qf_ptr->qf_fnum,
(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
!   if (qi != _info && !win_valid_any_tab(oldwin))
{
EMSG(_("E924: Current window was closed"));
is_abort = TRUE;
*** ../vim-8.0.0036/src/testdir/test_quickfix.vim   2016-10-09 
16:10:02.135942266 +0200
--- src/testdir/test_quickfix.vim   2016-10-15 19:19:46.17067 +0200
***
*** 617,622 
--- 617,638 
  augroup! testgroup
  endfunction
  
+ function Test_locationlist_cross_tab_jump()
+   call writefile(['loclistfoo'], 'loclistfoo')
+   call writefile(['loclistbar'], 'loclistbar')
+   set switchbuf=usetab
+ 
+   edit loclistfoo
+   tabedit loclistbar
+   silent lgrep loclistfoo loclist*
+   call assert_equal(1, tabpagenr())
+ 
+   enew | only | tabonly
+   set switchbuf
+   call delete('loclistfoo')
+   call delete('loclistbar')
+ endfunction
+ 
  " More tests for 'errorformat'
  function! Test_efm1()
  if !has('unix')
*** ../vim-8.0.0036/src/version.c   2016-10-15 18:36:45.353910276 +0200
--- src/version.c   2016-10-15 19:22:55.749491613 +0200
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 37,
  /**/

-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 8.0.0036

2016-10-15 Fir de Conversatie Bram Moolenaar

Patch 8.0.0036
Problem:Detecting that a job has finished may take a while.
Solution:   Check for a finished job more often (Ozaki Kiichi)
Files:  src/channel.c, src/os_unix.c, src/os_win32.c,
src/proto/os_unix.pro, src/proto/os_win32.pro,
src/testdir/test_channel.vim


*** ../vim-8.0.0035/src/channel.c   2016-10-09 17:27:56.859388538 +0200
--- src/channel.c   2016-10-15 18:34:49.054767438 +0200
***
*** 4428,4433 
--- 4428,4466 
  }
  }
  
+ static void
+ job_cleanup(job_T *job)
+ {
+ if (job->jv_status != JOB_ENDED)
+   return;
+ 
+ if (job->jv_exit_cb != NULL)
+ {
+   typval_Targv[3];
+   typval_Trettv;
+   int dummy;
+ 
+   /* invoke the exit callback; make sure the refcount is > 0 */
+   ++job->jv_refcount;
+   argv[0].v_type = VAR_JOB;
+   argv[0].vval.v_job = job;
+   argv[1].v_type = VAR_NUMBER;
+   argv[1].vval.v_number = job->jv_exitval;
+   call_func(job->jv_exit_cb, (int)STRLEN(job->jv_exit_cb),
+   , 2, argv, NULL, 0L, 0L, , TRUE,
+   job->jv_exit_partial, NULL);
+   clear_tv();
+   --job->jv_refcount;
+   channel_need_redraw = TRUE;
+ }
+ if (job->jv_refcount == 0)
+ {
+   /* The job was already unreferenced, now that it ended it can be
+* freed. Careful: caller must not use "job" after this! */
+   job_free(job);
+ }
+ }
+ 
  #if defined(EXITFREE) || defined(PROTO)
  void
  job_free_all(void)
***
*** 4445,4454 
  static int
  job_still_useful(job_T *job)
  {
! return job->jv_status == JOB_STARTED
!  && (job->jv_stoponexit != NULL || job->jv_exit_cb != NULL
!  || (job->jv_channel != NULL
!  && channel_still_useful(job->jv_channel)));
  }
  
  /*
--- 4478,4492 
  static int
  job_still_useful(job_T *job)
  {
! return (job->jv_stoponexit != NULL || job->jv_exit_cb != NULL
!   || (job->jv_channel != NULL
!   && channel_still_useful(job->jv_channel)));
! }
! 
! static int
! job_still_alive(job_T *job)
! {
! return (job->jv_status == JOB_STARTED) && job_still_useful(job);
  }
  
  /*
***
*** 4462,4468 
  typval_T  tv;
  
  for (job = first_job; job != NULL; job = job->jv_next)
!   if (job_still_useful(job))
{
tv.v_type = VAR_JOB;
tv.vval.v_job = job;
--- 4500,4506 
  typval_T  tv;
  
  for (job = first_job; job != NULL; job = job->jv_next)
!   if (job_still_alive(job))
{
tv.v_type = VAR_JOB;
tv.vval.v_job = job;
***
*** 4478,4484 
  {
/* Do not free the job when it has not ended yet and there is a
 * "stoponexit" flag or an exit callback. */
!   if (!job_still_useful(job))
{
job_free(job);
}
--- 4516,4522 
  {
/* Do not free the job when it has not ended yet and there is a
 * "stoponexit" flag or an exit callback. */
!   if (!job_still_alive(job))
{
job_free(job);
}
***
*** 4503,4509 
  
  for (job = first_job; job != NULL; job = job->jv_next)
if ((job->jv_copyID & mask) != (copyID & mask)
!   && !job_still_useful(job))
{
/* Free the channel and ordinary items it contains, but don't
 * recurse into Lists, Dictionaries etc. */
--- 4541,4547 
  
  for (job = first_job; job != NULL; job = job->jv_next)
if ((job->jv_copyID & mask) != (copyID & mask)
!&& !job_still_alive(job))
{
/* Free the channel and ordinary items it contains, but don't
 * recurse into Lists, Dictionaries etc. */
***
*** 4523,4529 
  {
job_next = job->jv_next;
if ((job->jv_copyID & mask) != (copyID & mask)
!   && !job_still_useful(job))
{
/* Free the job struct itself. */
job_free_job(job);
--- 4561,4567 
  {
job_next = job->jv_next;
if ((job->jv_copyID & mask) != (copyID & mask)
!&& !job_still_alive(job))
{
/* Free the job struct itself. */
job_free_job(job);
***
*** 4614,4647 
  job_T *job;
  
  for (job = first_job; job != NULL; job = job->jv_next)
!   if (job->jv_status == JOB_STARTED && job_still_useful(job))
return TRUE;
  return FALSE;
  }
  
  /*
   * Called once in a while: check if any jobs that seem useful have ended.
   */
  void
  job_check_ended(void)
  {
! static time_t   last_check = 0;
! time_tnow;
! job_T *job;
! job_T *next;
  
! /* Only do 

Re: [patch] improve ended-job check

2016-10-15 Fir de Conversatie Bram Moolenaar

Ozaki Kiichi wrote:

> I updated patch.
> 
> - remove JOB_WAITED
> - separate job_cleanup process from job_status
> - get off jv_status check from job_still_useful, and new job_still_alive 
> checks
> jv_status and job_still_useful (i.e. job_still_alive is original 
> job_still_useful)

Thanks!

> > Does that fix #1155?
> 
> Unfortunately not. But I will post a fix-patch soon.

-- 
There is no right or wrong, there is only your personal opinion.
 (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.


Patch 8.0.0035

2016-10-15 Fir de Conversatie Bram Moolenaar

Patch 8.0.0035 (after 7.4.2013)
Problem:Order of matches for 'omnifunc' is messed up. (Danny Su)
Solution:   Do not set compl_curr_match when called from complete_check().
(closes #1168)
Files:  src/edit.c, src/evalfunc.c, src/proto/edit.pro, src/search.c,
src/spell.c, src/tag.c, src/testdir/test76.in, 
src/testdir/test76.ok, src/testdir/test_popup.vim, src/Makefile,
src/testdir/Make_all.mak


*** ../vim-8.0.0034/src/edit.c  2016-09-05 20:53:05.0 +0200
--- src/edit.c  2016-10-15 17:01:00.865374961 +0200
***
*** 179,186 
  #endif
  static int  ins_compl_get_exp(pos_T *ini);
  static void ins_compl_delete(void);
! static void ins_compl_insert(void);
! static int  ins_compl_next(int allow_get_expansion, int count, int 
insert_match);
  static int  ins_compl_key2dir(int c);
  static int  ins_compl_pum_key(int c);
  static int  ins_compl_key2count(int c);
--- 179,186 
  #endif
  static int  ins_compl_get_exp(pos_T *ini);
  static void ins_compl_delete(void);
! static void ins_compl_insert(int in_compl_func);
! static int  ins_compl_next(int allow_get_expansion, int count, int 
insert_match, int in_compl_func);
  static int  ins_compl_key2dir(int c);
  static int  ins_compl_pum_key(int c);
  static int  ins_compl_key2count(int c);
***
*** 861,867 
   && (c == CAR || c == K_KENTER || c == NL)))
{
ins_compl_delete();
!   ins_compl_insert();
}
}
}
--- 861,867 
   && (c == CAR || c == K_KENTER || c == NL)))
{
ins_compl_delete();
!   ins_compl_insert(FALSE);
}
}
}
***
*** 3297,3303 
break;
}
line_breakcheck();
!   ins_compl_check_keys(50);
}
fclose(fp);
}
--- 3297,3303 
break;
}
line_breakcheck();
!   ins_compl_check_keys(50, FALSE);
}
fclose(fp);
}
***
*** 4036,4043 
  }
  
  #ifdef FEAT_COMPL_FUNC
- static void expand_by_function(int type, char_u *base);
- 
  /*
   * Execute user defined complete function 'completefunc' or 'omnifunc', and
   * get matches in "matches".
--- 4036,4041 
***
*** 4596,4602 
break;
/* Fill the popup menu as soon as possible. */
if (type != -1)
!   ins_compl_check_keys(0);
  
if ((ctrl_x_mode != 0 && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode))
 || compl_interrupted)
--- 4594,4600 
break;
/* Fill the popup menu as soon as possible. */
if (type != -1)
!   ins_compl_check_keys(0, FALSE);
  
if ((ctrl_x_mode != 0 && !CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode))
 || compl_interrupted)
***
*** 4653,4661 
  set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
  }
  
! /* Insert the new text being completed. */
  static void
! ins_compl_insert(void)
  {
  dict_T*dict;
  
--- 4651,4662 
  set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc());
  }
  
! /*
!  * Insert the new text being completed.
!  * "in_compl_func" is TRUE when called from complete_check().
!  */
  static void
! ins_compl_insert(int in_compl_func)
  {
  dict_T*dict;
  
***
*** 4682,4688 
EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_INFO]));
  }
  set_vim_var_dict(VV_COMPLETED_ITEM, dict);
! compl_curr_match = compl_shown_match;
  }
  
  /*
--- 4683,4690 
EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_INFO]));
  }
  set_vim_var_dict(VV_COMPLETED_ITEM, dict);
! if (!in_compl_func)
!   compl_curr_match = compl_shown_match;
  }
  
  /*
***
*** 4706,4712 
  int   allow_get_expansion,
  int   count,  /* repeat completion this many times; 
should
   be at least 1 */
! int   insert_match)   /* Insert the newly selected match */
  {
  int   num_matches = -1;
  int   i;
--- 4708,4715 
  int   allow_get_expansion,
  int   count,  /* repeat completion this many times; 
should
   be at least 1 */
! int   insert_match,   /* Insert the newly selected match */
! int   in_compl_func)  /* called from complete_check() */
  {
  int   num_matches = -1;
  int   i;
***
*** 4856,4862 
  else if (insert_match)
  {
if 

Re: [patch] improve ended-job check

2016-10-15 Fir de Conversatie Ozaki Kiichi
I updated patch.

- remove JOB_WAITED
- separate job_cleanup process from job_status
- get off jv_status check from job_still_useful, and new job_still_alive checks
jv_status and job_still_useful (i.e. job_still_alive is original 
job_still_useful)


> Does that fix #1155?

Unfortunately not. But I will post a fix-patch soon.

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

2016-10-15 Fir de Conversatie Bram Moolenaar

Patch 8.0.0034
Problem:No completion for ":messages".
Solution:   Complete "clear" argument. (Hirohito Higashi)
Files:  src/ex_docmd.c, src/ex_getln.c, src/proto/ex_docmd.pro,
src/testdir/test_cmdline.vim, src/vim.h,
runtime/doc/eval.txt, runtime/doc/map.txt


*** ../vim-8.0.0033/src/ex_docmd.c  2016-10-12 14:19:55.742357780 +0200
--- src/ex_docmd.c  2016-10-15 15:22:09.672808290 +0200
***
*** 4281,4286 
--- 4281,4291 
xp->xp_pattern = arg;
break;
  
+   case CMD_messages:
+   xp->xp_context = EXPAND_MESSAGES;
+   xp->xp_pattern = arg;
+   break;
+ 
  #if defined(FEAT_CMDHIST)
case CMD_history:
xp->xp_context = EXPAND_HISTORY;
***
*** 5893,5898 
--- 5898,5904 
  #endif
  {EXPAND_MAPPINGS, "mapping"},
  {EXPAND_MENUS, "menu"},
+ {EXPAND_MESSAGES, "messages"},
  {EXPAND_OWNSYNTAX, "syntax"},
  #if defined(FEAT_PROFILE)
  {EXPAND_SYNTIME, "syntime"},
***
*** 11901,11906 
--- 11907,11924 
return (char_u *)"xterm";
  return NULL;
  }
+ 
+ /*
+  * Function given to ExpandGeneric() to obtain the possible arguments of the
+  * ":messages {clear}" command.
+  */
+ char_u *
+ get_messages_arg(expand_T *xp UNUSED, int idx)
+ {
+ if (idx == 0)
+   return (char_u *)"clear";
+ return NULL;
+ }
  #endif
  
  #ifdef FEAT_AUTOCMD
*** ../vim-8.0.0033/src/ex_getln.c  2016-09-09 21:35:27.0 +0200
--- src/ex_getln.c  2016-10-15 15:22:09.672808290 +0200
***
*** 4832,4837 
--- 4832,4838 
{
{EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
{EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
+   {EXPAND_MESSAGES, get_messages_arg, TRUE, TRUE},
  #ifdef FEAT_CMDHIST
{EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
  #endif
*** ../vim-8.0.0033/src/proto/ex_docmd.pro  2016-09-12 13:04:02.0 
+0200
--- src/proto/ex_docmd.pro  2016-10-15 15:22:09.672808290 +0200
***
*** 61,64 
--- 61,65 
  int put_line(FILE *fd, char *s);
  void dialog_msg(char_u *buff, char *format, char_u *fname);
  char_u *get_behave_arg(expand_T *xp, int idx);
+ char_u *get_messages_arg(expand_T *xp, int idx);
  /* vim: set ft=c : */
*** ../vim-8.0.0033/src/testdir/test_cmdline.vim2016-08-28 
13:34:01.0 +0200
--- src/testdir/test_cmdline.vim2016-10-15 15:22:09.672808290 +0200
***
*** 129,134 
--- 129,139 
let l = getcompletion('dark', 'highlight')
call assert_equal([], l)
  
+   let l = getcompletion('', 'messages')
+   call assert_true(index(l, 'clear') >= 0)
+   let l = getcompletion('not', 'messages')
+   call assert_equal([], l)
+ 
if has('cscope')
  let l = getcompletion('', 'cscope')
  let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show']
*** ../vim-8.0.0033/src/vim.h   2016-09-04 21:27:13.0 +0200
--- src/vim.h   2016-10-15 15:22:09.672808290 +0200
***
*** 793,798 
--- 793,799 
  #define EXPAND_SYNTIME43
  #define EXPAND_USER_ADDR_TYPE 44
  #define EXPAND_PACKADD45
+ #define EXPAND_MESSAGES   46
  
  /* Values for exmode_active (0 is no exmode) */
  #define EXMODE_NORMAL 1
*** ../vim-8.0.0033/runtime/doc/eval.txt2016-10-02 16:51:32.748592858 
+0200
--- runtime/doc/eval.txt2016-10-15 15:24:39.175697407 +0200
***
*** 4281,4287 
--- 4287,4295 
locale  locale names (as output of locale -a)
mapping mapping name
menumenus
+   messages|:messages| suboptions
option  options
+   packadd optional package |pack-add| names
shellcmdShell command
sign|:sign| suboptions
syntax  syntax file names |'syntax'|
*** ../vim-8.0.0033/runtime/doc/map.txt 2016-09-12 12:45:26.0 +0200
--- runtime/doc/map.txt 2016-10-15 15:24:55.571575607 +0200
***
*** 1280,1285 
--- 1280,1286 
-complete=localelocale names (as output of locale -a)
-complete=mapping   mapping name
-complete=menu  menus
+   -complete=messages  |:messages| suboptions
-complete=optionoptions
-complete=packadd   optional package |pack-add| names
-complete=shellcmd  Shell command
*** ../vim-8.0.0033/src/version.c   2016-10-15 14:56:25.868257421 +0200
--- src/version.c   2016-10-15 15:23:36.340164248 +0200
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 34,
  /**/

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

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote 

Re: [patch] Add completion for :messages

2016-10-15 Fir de Conversatie Bram Moolenaar

Hirohito Higashi wrote:

> Type `:messages ` and push Tab key.
> 
> None patched behavior:
> - Output Ctrl-I code
>   :messages ^I
> 
> Patched behavior:
> - Complete `clear`
>   :messages clear
> 
> 
> Attach a patch. (Contains a test)
> Check it please.

Thanks!


-- 
Q: What kind of stuff do you do?
A: I collect hobbies.

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

2016-10-15 Fir de Conversatie Bram Moolenaar

Patch 8.0.0033
Problem:Cannot use overlapping positions with matchaddpos().
Solution:   Check end of match. (Ozaki Kiichi) Add a test (Hirohito Higashi)
Files:  src/screen.c, src/testdir/test_match.vim


*** ../vim-8.0.0032/src/screen.c2016-10-02 23:09:27.643153731 +0200
--- src/screen.c2016-10-15 14:52:51.297854046 +0200
***
*** 7786,7806 
  shl->lnum = 0;
  for (i = posmatch->cur; i < MAXPOSMATCH; i++)
  {
!   if (posmatch->pos[i].lnum == 0)
break;
!   if (posmatch->pos[i].col < mincol)
continue;
!   if (posmatch->pos[i].lnum == lnum)
{
if (shl->lnum == lnum)
{
/* partially sort positions by column numbers
 * on the same line */
!   if (posmatch->pos[i].col < posmatch->pos[bot].col)
{
!   llpos_T tmp = posmatch->pos[i];
  
!   posmatch->pos[i] = posmatch->pos[bot];
posmatch->pos[bot] = tmp;
}
}
--- 7786,7808 
  shl->lnum = 0;
  for (i = posmatch->cur; i < MAXPOSMATCH; i++)
  {
!   llpos_T *pos = >pos[i];
! 
!   if (pos->lnum == 0)
break;
!   if (pos->col + pos->len - 1 <= mincol)
continue;
!   if (pos->lnum == lnum)
{
if (shl->lnum == lnum)
{
/* partially sort positions by column numbers
 * on the same line */
!   if (pos->col < posmatch->pos[bot].col)
{
!   llpos_T tmp = *pos;
  
!   *pos = posmatch->pos[bot];
posmatch->pos[bot] = tmp;
}
}
*** ../vim-8.0.0032/src/testdir/test_match.vim  2016-08-27 18:28:13.0 
+0200
--- src/testdir/test_match.vim  2016-10-15 14:50:58.442694482 +0200
***
*** 181,186 
--- 181,196 
redraw!
call assert_equal(screenattr(2,2), screenattr(1,6))
  
+   " Check overlapping pos
+   call clearmatches()
+   call setline(1, ['1234567890', 'NH'])
+   call matchaddpos('Error', [[1,1,5], [1,3,5], [2,2]])
+   redraw!
+   call assert_notequal(screenattr(2,2), 0)
+   call assert_equal(screenattr(2,2), screenattr(1,5))
+   call assert_equal(screenattr(2,2), screenattr(1,7))
+   call assert_notequal(screenattr(2,2), screenattr(1,8))
+ 
nohl
syntax off
set hlsearch&
*** ../vim-8.0.0032/src/version.c   2016-10-12 17:52:39.199701825 +0200
--- src/version.c   2016-10-15 14:54:57.816912413 +0200
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 33,
  /**/

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


Re: [bug][patch] matchaddpos() may not draw overldapped pos.

2016-10-15 Fir de Conversatie Bram Moolenaar

Hirohito Higashi wrote:

> 2016-10-15(Sat) 3:41:58 UTC+9 Bram Moolenaar:
> > Ozaki Kiichi wrote:
> > 
> > > This is matchaddpos() problem.
> > > 
> > > [repro steps]
> > > 
> > > vim -Nu NONE
> > > 
> > > i1234567890
> > > :call matchaddpos('ErrorMsg', [[1, 1, 5], [1, 3, 5]])
> > > 
> > > expected: colored 1~7 ("12345" and "34567"; pos [1, 1, 5] and [1, 3, 5], 
> > > overlapped "345")
> > > 
> > > actual: colored 1~5 ("12345"; only first pos [1, 1, 5])
> > > 
> > > This problem occurs when overlapping more than 1 char.
> > > e.g. [[1, 1, 5], [1, 5, 5]] is no problem.
> > > 
> > > [cause]
> > > 
> > > https://github.com/vim/vim/blob/fd89d7e/src/screen.c#L7770-L7771
> > > 
> > > On processing second pos [1, 3, 5], mincol is 5 (end of first pos col).
> > > Thus, col (== 3) is less then mincol, and second pos is skipped.
> > > 
> > > I think that the case of "col < mincol < col + len -1" should be also 
> > > processed.
> > > 
> > > [patch]
> > > 
> > > https://gist.github.com/ichizok/f34c9018f5e9e452d3bc78cc9026a720
> > 
> > Can you please add a test that fails without the patch?
> 
> Here is a test patch.
> I confirmed pass the test with Kiichi's patch, and fails without it.

Thanks!

-- 
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] Add completion for :messages

2016-10-15 Fir de Conversatie h_east
Hi All,

I update a patch.  (Modified documents)

--
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/runtime/doc/eval.txt b/runtime/doc/eval.txt
index d4a005a..88599dd 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -4287,7 +4287,9 @@ getcompletion({pat}, {type} [, {filtered}])		*getcompletion()*
 		locale		locale names (as output of locale -a)
 		mapping		mapping name
 		menu		menus
+		messages	|:messages| suboptions
 		option		options
+		packadd		optional package |pack-add| names
 		shellcmd	Shell command
 		sign		|:sign| suboptions
 		syntax		syntax file names |'syntax'|
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 7989d64..25ed827 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1280,6 +1280,7 @@ completion can be enabled:
 	-complete=locale	locale names (as output of locale -a)
 	-complete=mapping	mapping name
 	-complete=menu		menus
+	-complete=messages	|:messages| suboptions
 	-complete=option	options
 	-complete=packadd	optional package |pack-add| names
 	-complete=shellcmd	Shell command
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index ac7beb7..6802b8b 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4281,6 +4281,11 @@ set_one_cmd_context(
 	xp->xp_pattern = arg;
 	break;
 
+	case CMD_messages:
+	xp->xp_context = EXPAND_MESSAGES;
+	xp->xp_pattern = arg;
+	break;
+
 #if defined(FEAT_CMDHIST)
 	case CMD_history:
 	xp->xp_context = EXPAND_HISTORY;
@@ -5893,6 +5898,7 @@ static struct
 #endif
 {EXPAND_MAPPINGS, "mapping"},
 {EXPAND_MENUS, "menu"},
+{EXPAND_MESSAGES, "messages"},
 {EXPAND_OWNSYNTAX, "syntax"},
 #if defined(FEAT_PROFILE)
 {EXPAND_SYNTIME, "syntime"},
@@ -11901,6 +11907,18 @@ get_behave_arg(expand_T *xp UNUSED, int idx)
 	return (char_u *)"xterm";
 return NULL;
 }
+
+/*
+ * Function given to ExpandGeneric() to obtain the possible arguments of the
+ * ":messages {clear}" command.
+ */
+char_u *
+get_messages_arg(expand_T *xp UNUSED, int idx)
+{
+if (idx == 0)
+	return (char_u *)"clear";
+return NULL;
+}
 #endif
 
 #ifdef FEAT_AUTOCMD
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 25a12be..5d098cc 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4832,6 +4832,7 @@ ExpandFromContext(
 	{
 	{EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
 	{EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
+	{EXPAND_MESSAGES, get_messages_arg, TRUE, TRUE},
 #ifdef FEAT_CMDHIST
 	{EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
 #endif
diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro
index b92ce80..11a3f71 100644
--- a/src/proto/ex_docmd.pro
+++ b/src/proto/ex_docmd.pro
@@ -61,4 +61,5 @@ int put_eol(FILE *fd);
 int put_line(FILE *fd, char *s);
 void dialog_msg(char_u *buff, char *format, char_u *fname);
 char_u *get_behave_arg(expand_T *xp, int idx);
+char_u *get_messages_arg(expand_T *xp, int idx);
 /* vim: set ft=c : */
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 4bacf57..3718087 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -129,6 +129,11 @@ func Test_getcompletion()
   let l = getcompletion('dark', 'highlight')
   call assert_equal([], l)
 
+  let l = getcompletion('', 'messages')
+  call assert_true(index(l, 'clear') >= 0)
+  let l = getcompletion('not', 'messages')
+  call assert_equal([], l)
+
   if has('cscope')
 let l = getcompletion('', 'cscope')
 let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show']
diff --git a/src/vim.h b/src/vim.h
index a787575..0ac296e 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -793,6 +793,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
 #define EXPAND_SYNTIME		43
 #define EXPAND_USER_ADDR_TYPE	44
 #define EXPAND_PACKADD		45
+#define EXPAND_MESSAGES		46
 
 /* Values for exmode_active (0 is no exmode) */
 #define EXMODE_NORMAL		1