On Fri, Jul 27, 2007 at 11:28:54AM +0200, Martin Toft wrote:
> On Thu, Jul 26, 2007 at 07:30:47PM -0500, Larson, David wrote:
> > matchadd() produces a runtime error. To reproduce:
> > 
> > :highlight MyGroup ctermbg=green guibg=green
> > :let m = matchadd("MyGroup", "TODO")
> > :let m = matchadd("MyGroup", "name")
> > 
> > E685: Internal error: get_tv_number()
> 
> Hi,
> 
> being the author of this patch, I'm eager to help.
> 
> It seems to be a weird kind of bug -- with debugging on (-g), I cannot
> reproduce it anymore.  I'll have to look into it and get back to you.
> 
> Thanks for the feedback, and I'm sorry that my patch causes this.
> 
> Martin

Here is a patch that fixes the problem on my machine.  Please try it
out.  When applied, the optional fourth argument to matchadd() is only
checked for when there was a third argument.

Martin
Index: eval.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/eval.c,v
retrieving revision 1.220
diff -c -r1.220 eval.c
*** eval.c	26 Jul 2007 20:58:42 -0000	1.220
--- eval.c	27 Jul 2007 14:55:54 -0000
***************
*** 12526,12534 ****
      if (grp == NULL || pat == NULL)
  	return;
      if (argvars[2].v_type != VAR_UNKNOWN)
  	prio = get_tv_number_chk(&argvars[2], &error);
!     if (argvars[3].v_type != VAR_UNKNOWN)
! 	id = get_tv_number_chk(&argvars[3], &error);
      if (error == TRUE)
  	return;
      if (id >= 1 && id <= 3)
--- 12526,12536 ----
      if (grp == NULL || pat == NULL)
  	return;
      if (argvars[2].v_type != VAR_UNKNOWN)
+     {
  	prio = get_tv_number_chk(&argvars[2], &error);
! 	if (argvars[3].v_type != VAR_UNKNOWN)
! 	    id = get_tv_number_chk(&argvars[3], &error);
!     }
      if (error == TRUE)
  	return;
      if (id >= 1 && id <= 3)

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui